Skip to content

Events

The events are sent from the SDK and plugins using LocalBroadcastManager. The payload for the event is sent as extras in the broadcast intent.

To listen for events create a BroadcastReceiver, and register it with LocalBroadcastManager.

java
broadcastReceiver = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction() != null ? intent.getAction() : "";
        switch (action) {
            case EaseLiveNotificationKeys.EASE_LIVE_READY:
                break;
            case EaseLiveNotificationKeys.EASE_LIVE_ERROR:
                tv.easelive.easelivesdk.model.Error error = intent.getParcelableExtra(EaseLiveNotificationKeys.EXTRA_ERROR);
                break;
        }
    }
};
LocalBroadcastManager.getInstance(this).registerReceiver(broadcastReceiver, EaseLive.getIntentFilter());

To listen for more events like the ones described below it is also possible to register the following intent filter, that will listen for all the internal messages and not only the EaseLive ones.

java
EaseLive.sdkIntentFilter()

To post an event is possible using

java
Intent broadcast = new Intent(EaseLiveNotificationKeys.PLAYER_TIME);
broadcast.putExtra(EaseLiveNotificationKeys.EXTRA_TIMECODE, currentTimecode);
LocalBroadcastManager.getInstance(context).sendBroadcast(broadcast);

It is possible to send notification to the SDK from anywhere in the app and the SDK will receive them, an example of this is if the mobile app wants to communicate with the web app for both generic messages or language message.

Constants for all the broadcast actions of the events are defined in EaseLiveNotificationKeys.

Events from the SDK

EaseLiveNotificationKeys.EASE_LIVE_READY

Sent from the SDK when all the components becomes fully operational.

EaseLiveNotificationKeys.EASE_LIVE_ERROR

Sent when an error occurs in the SDK or plugins. The app should destroy the SDK on fatal errors, and send all the errors to our error monitoring system like Sentry.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_ERRORError objecttv.easelive.easelivesdk.model.ErrorRequired

The error contained in the notification has an identification code to specify if it's a Fatal error or just a Warning, it's possible to check that reading the error.getLevel() value and check if it's equal to Error.LEVEL_FATAL.

Events from the app

EaseLiveNotificationKeys.APP_LANGUAGE

Sent from the mobile app when it wants to change the language of the overlay UI.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_LANGUAGENew languageStringRequired

EaseLiveNotificationKeys.APP_MESSAGE

Sent from the mobile app to notify about a generic message, which can be used for custom functionality in the overlay.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_JSON_STRINGThe stringified JSON object to sendStringRequired

Example

Events from the overlay UI

EaseLiveNotificationKeys.BRIDGE_APP_STATUS

Sent when the status of the overlay changes. When the overlay was disabled, it should be removed from the app.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_STATUSNew statusStringRequired

Status is a String with possible values enabled, hidden, disabled.

EaseLiveNotificationKeys.BRIDGE_READY

Sent when the bridge is ready to receive events. The app should wait for this event before sending events over the bridge.

EaseLiveNotificationKeys.BRIDGE_STAGE

Sent when the stage of the overlay UI is clicked, and should trigger a change in the visibility of the player controls.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_CONTROLSNew controls stateStringRequired

The value of controls should be either visible or hidden.

EaseLiveNotificationKeys.BRIDGE_STAGE_SWIPED

Sent when the stage of the overlay UI is swiped, and can be used to trigger a change in the visibility of player controls.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_DIRECTIONSwipe directionStringRequired

The value of direction should be left, right, up or down.

EaseLiveNotificationKeys.BRIDGE_TIME

Sent when the player should change its current time (for example a seek action).

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_TIMECODENew timecodelongRequired

EaseLiveNotificationKeys.BRIDGE_STATE

Sent when the player should update its state, for example to pause or play.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_STATENew stateStringRequired

State is a String with possible values playing, stopped, paused, seeking, buffering.

EaseLiveNotificationKeys.BRIDGE_LANGUAGE

Sent when the overlay UI has set the active language.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_LANGUAGEActive languageStringRequired
EaseLiveNotificationKeys.EXTRA_AVAILABLEAvailable languagesString[]Required

EaseLiveNotificationKeys.BRIDGE_MESSAGE

Sent from the overlay UI to notify about a generic message, which can be used for custom functionality.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_JSON_STRINGThe info to sendStringRequired

Example

EaseLiveNotificationKeys.BRIDGE_SPEED

Sent when the player should change its speed (playback rate). Eg. 0.5 is half speed, 1 is normal speed, 2 is 2x fast forward.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_SPEEDNew playback speedfloatRequired

EaseLiveNotificationKeys.BRIDGE_VOLUME

Sent when the player should change its audio volume. Eg. 0 is silent, 100 is normal volume.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_VOLUMENew audio volumeintRequired

EaseLiveNotificationKeys.BRIDGE_MUTE

Sent when the player should change its audio mute status. Eg. true is muted, false is unmuted.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_MUTENew audio mute statusbooleanRequired

EaseLiveNotificationKeys.BRIDGE_VIDEO_SCALE

Sent when the player should change the video surface's scale and position.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_VIDEO_SCALE_XHorizontal scale factor, between 0 and 1.floatRequired
EaseLiveNotificationKeys.EXTRA_VIDEO_SCALE_YVertical scale factor, between 0 and 1.floatRequired
EaseLiveNotificationKeys.EXTRA_VIDEO_PIVOT_XHorizontal anchor for the scaling animation, between 0 and 1.floatRequired
EaseLiveNotificationKeys.EXTRA_VIDEO_PIVOT_YVertical anchor of the scaling animation, between 0 and 1.floatRequired
EaseLiveNotificationKeys.EXTRA_VIDEO_SCALE_DURATIONDuration of the scale animation in milliseconds.longRequired

Events from the player plugin

EaseLiveNotificationKeys.PLAYER_READY

Sent when the player becomes ready to play.

EaseLiveNotificationKeys.PLAYER_TIME

Sent when the player reads the timecode for the current playback position. The timecodes should be milliseconds since 1970-01-01T00:00:00Z.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_TIMECODETimecode at current playback positionlongRequired
EaseLiveNotificationKeys.EXTRA_INITIAL_TIMECODETimecode at the start of the seekable windowlongOptional
EaseLiveNotificationKeys.EXTRA_MAX_TIMECODETimecode at the end of the seekable windowlongOptional

The EXTRA_INITIAL_TIMECODE and EXTRA_MAX_TIMECODE are optional. If not present the stream is considered to be a Live stream without a seekable buffer.

EaseLiveNotificationKeys.PLAYER_ERROR

Notifies the SDK of an error in the player or player plugin.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_ERRORError objecttv.easelive.easelivesdk.model.ErrorRequired

EaseLiveNotificationKeys.PLAYER_METADATA

Sent when the player reads metadata from the stream. The payload should be a JSON formatted String.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_METADATAJSON string containing metadataStringRequired

EaseLiveNotificationKeys.PLAYER_STATE

Sent when the player changes state, for example a change from paused to playing.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_STATENew stateStringRequired

Where state is a String with possible values playing, stopped, paused, seeking, buffering.

EaseLiveNotificationKeys.PLAYER_STAGE

Sent when the player changes the visibility of the player controls. Typically when the player stage is clicked or if the native controls hide automatically after a timeout, the player plugin should notify about this change.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_CONTROLSNew controls stateStringRequired

The value of controls should be either visible or hidden.

EaseLiveNotificationKeys.PLAYER_SPEED

Sent when the player has changed its speed (playback rate). Eg. 0.5 is half speed, 1 is normal speed, 2 is 2x fast forward.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_SPEEDNew playback speedfloatRequired

EaseLiveNotificationKeys.PLAYER_VOLUME

Sent when the player has changed its audio volume. Eg. 0 is silent, 100 is normal volume.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_VOLUMENew audio volumeintRequired

EaseLiveNotificationKeys.PLAYER_MUTE

Sent when the player has changed its audio mute status. Eg. true is muted, false is unmuted.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_MUTENew audio mute statusbooleanRequired

EaseLiveNotificationKeys.PLAYER_VIDEO_SCALE

Sent when the player will change the video surface's scale and position.

AttributeDescriptionTypeRequired
EaseLiveNotificationKeys.EXTRA_VIDEO_SCALE_XHorizontal scale factor, between 0 and 1.floatRequired
EaseLiveNotificationKeys.EXTRA_VIDEO_SCALE_YVertical scale factor, between 0 and 1.floatRequired
EaseLiveNotificationKeys.EXTRA_VIDEO_PIVOT_XHorizontal anchor for the scaling animation, between 0 and 1.floatRequired
EaseLiveNotificationKeys.EXTRA_VIDEO_PIVOT_YVertical anchor of the scaling animation, between 0 and 1.floatRequired
EaseLiveNotificationKeys.EXTRA_VIDEO_SCALE_DURATIONDuration of the scale animation in milliseconds.longRequired