Appearance
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.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_ERROR | Error object | tv.easelive.easelivesdk.model.Error | Required |
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.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_LANGUAGE | New language | String | Required |
EaseLiveNotificationKeys.APP_MESSAGE
Sent from the mobile app to notify about a generic message, which can be used for custom functionality in the overlay.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_JSON_STRING | The stringified JSON object to send | String | Required |
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.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_STATUS | New status | String | Required |
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.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_CONTROLS | New controls state | String | Required |
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.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_DIRECTION | Swipe direction | String | Required |
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).
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_TIMECODE | New timecode | long | Required |
EaseLiveNotificationKeys.BRIDGE_STATE
Sent when the player should update its state, for example to pause or play.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_STATE | New state | String | Required |
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.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_LANGUAGE | Active language | String | Required |
EaseLiveNotificationKeys.EXTRA_AVAILABLE | Available languages | String[] | Required |
EaseLiveNotificationKeys.BRIDGE_MESSAGE
Sent from the overlay UI to notify about a generic message, which can be used for custom functionality.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_JSON_STRING | The info to send | String | Required |
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.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_SPEED | New playback speed | float | Required |
EaseLiveNotificationKeys.BRIDGE_VOLUME
Sent when the player should change its audio volume. Eg. 0 is silent, 100 is normal volume.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_VOLUME | New audio volume | int | Required |
EaseLiveNotificationKeys.BRIDGE_MUTE
Sent when the player should change its audio mute status. Eg. true is muted, false is unmuted.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_MUTE | New audio mute status | boolean | Required |
EaseLiveNotificationKeys.BRIDGE_VIDEO_SCALE
Sent when the player should change the video surface's scale and position.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_VIDEO_SCALE_X | Horizontal scale factor, between 0 and 1. | float | Required |
EaseLiveNotificationKeys.EXTRA_VIDEO_SCALE_Y | Vertical scale factor, between 0 and 1. | float | Required |
EaseLiveNotificationKeys.EXTRA_VIDEO_PIVOT_X | Horizontal anchor for the scaling animation, between 0 and 1. | float | Required |
EaseLiveNotificationKeys.EXTRA_VIDEO_PIVOT_Y | Vertical anchor of the scaling animation, between 0 and 1. | float | Required |
EaseLiveNotificationKeys.EXTRA_VIDEO_SCALE_DURATION | Duration of the scale animation in milliseconds. | long | Required |
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.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_TIMECODE | Timecode at current playback position | long | Required |
EaseLiveNotificationKeys.EXTRA_INITIAL_TIMECODE | Timecode at the start of the seekable window | long | Optional |
EaseLiveNotificationKeys.EXTRA_MAX_TIMECODE | Timecode at the end of the seekable window | long | Optional |
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.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_ERROR | Error object | tv.easelive.easelivesdk.model.Error | Required |
EaseLiveNotificationKeys.PLAYER_METADATA
Sent when the player reads metadata from the stream. The payload should be a JSON formatted String.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_METADATA | JSON string containing metadata | String | Required |
EaseLiveNotificationKeys.PLAYER_STATE
Sent when the player changes state, for example a change from paused to playing.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_STATE | New state | String | Required |
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.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_CONTROLS | New controls state | String | Required |
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.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_SPEED | New playback speed | float | Required |
EaseLiveNotificationKeys.PLAYER_VOLUME
Sent when the player has changed its audio volume. Eg. 0 is silent, 100 is normal volume.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_VOLUME | New audio volume | int | Required |
EaseLiveNotificationKeys.PLAYER_MUTE
Sent when the player has changed its audio mute status. Eg. true is muted, false is unmuted.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_MUTE | New audio mute status | boolean | Required |
EaseLiveNotificationKeys.PLAYER_VIDEO_SCALE
Sent when the player will change the video surface's scale and position.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.EXTRA_VIDEO_SCALE_X | Horizontal scale factor, between 0 and 1. | float | Required |
EaseLiveNotificationKeys.EXTRA_VIDEO_SCALE_Y | Vertical scale factor, between 0 and 1. | float | Required |
EaseLiveNotificationKeys.EXTRA_VIDEO_PIVOT_X | Horizontal anchor for the scaling animation, between 0 and 1. | float | Required |
EaseLiveNotificationKeys.EXTRA_VIDEO_PIVOT_Y | Vertical anchor of the scaling animation, between 0 and 1. | float | Required |
EaseLiveNotificationKeys.EXTRA_VIDEO_SCALE_DURATION | Duration of the scale animation in milliseconds. | long | Required |