Appearance
Events
The events are sent from the SDK and plugins using NotificationCenter. The payload for the event is sent in the Notification's userInfo dictionary.
To listen for events is necessary to add an observer using the method
Swift
NotificationCenter.default.addObserver(self,
selector: #selector(onEaseLiveReady(notification:)),
name: EaseLiveNotificationKeys.easeLiveReady,
object: nil)
To post an event is possible using
Swift
NotificationCenter.default.post(
name: EaseLiveNotificationKeys.playerTime,
object: nil,
userInfo: [
EaseLiveNotificationKeys.timecodeUserInfoKey: currentTimecode
])
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 notification names of the events are defined in EaseLiveNotificationKeys
.
Events from the SDK
EaseLiveNotificationKeys.easeLiveReady
Sent from the SDK when all the components becomes fully operational.
EaseLiveNotificationKeys.easeLiveError
Sent when an error occurs in the SDK or plugins. The app should destroy the SDK on fatal errors.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.errorUserInfoKey | Error object | EaseLiveError | 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.level
value and check if it's equal to EaseLiveError.Level.fatal
.
Events from the app
EaseLiveNotificationKeys.appLanguage
Sent from the mobile app when it wants to change the language of the overlay UI.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.languageUserInfoKey | New language | String | Required |
EaseLiveNotificationKeys.appMessage
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.jsonStringUserInfoKey | The stringified JSON object to send | String | Required |
Events from the overlay UI
EaseLiveNotificationKeys.bridgeAppStatus
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.statusUserInfoKey | New status | String | Required |
Status is a String with possible values enabled
, hidden
, disabled
.
EaseLiveNotificationKeys.bridgeReady
Sent when the bridge is ready to receive events. The app should wait for this event before sending events over the bridge.
EaseLiveNotificationKeys.bridgeStage
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.controlsUserInfoKey | New controls state | String | Required |
The value of controls
should be either visible
or hidden
.
EaseLiveNotificationKeys.bridgeStageSwipe
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.directionUserInfoKey | Swipe direction | String | Required |
The value of direction
should be left
, right
, up
or down
.
EaseLiveNotificationKeys.bridgeTime
Sent when the player should change its current time (for example a seek action).
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.timecodeUserInfoKey | New timecode | Int64 | Required |
EaseLiveNotificationKeys.bridgeState
Sent when the player should update its state, for example to pause or play.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.stateUserInfoKey | New state | String | Required |
State is a String with possible values playing
, stopped
, paused
, seeking
, buffering
.
EaseLiveNotificationKeys.bridgeLanguage
Sent when the overlay UI has set the active language.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.languageUserInfoKey | Active language | String | Required |
EaseLiveNotificationKeys.availableUserInfoKey | Available languages | String[] | Required |
EaseLiveNotificationKeys.bridgeMessage
Sent from the overlay UI to notify about a generic message, which can be used for custom functionality.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.jsonStringUserInfoKey | The info to send | String | Required |
EaseLiveNotificationKeys.bridgeSpeed
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.speedUserInfoKey | New playback speed. | Float | Required |
EaseLiveNotificationKeys.bridgeVolume
Sent when the player should change its audio volume. Eg. 0 is silent, 100 is normal volume.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.volumeUserInfoKey | New audio volume. | Int | Required |
EaseLiveNotificationKeys.bridgeMute
Sent when the player should change its audio mute status. Eg. true is muted, false is unmuted.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.muteUserInfoKey | New audio mute status. | Bool | Required |
EaseLiveNotificationKeys.bridgeVideoScale
Sent when the player should change the video surface's scale and position. Values are relative to the original video size.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.videoScaleXUserInfoKey | Horizontal scale factor, between 0 and 1. | Float | Required |
EaseLiveNotificationKeys.videoScaleYUserInfoKey | Vertical scale factor, between 0 and 1. | Float | Required |
EaseLiveNotificationKeys.videoPivotXUserInfoKey | Horizontal anchor for the scaling animation, between 0 and 1. | Float | Required |
EaseLiveNotificationKeys.videoPivotYUserInfoKey | Vertical anchor of the scaling animation, between 0 and 1. | Float | Required |
EaseLiveNotificationKeys.videoScaleDurationUserInfoKey | Duration of the scale animation in milliseconds. | Int | Required |
Events from the player plugin
EaseLiveNotificationKeys.playerReady
Sent when the player becomes ready to play.
EaseLiveNotificationKeys.playerTime
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.timecodeUserInfoKey | Timecode at current playback position | Int64 | Required |
EaseLiveNotificationKeys.initialTimecodeUserInfoKey | Timecode at the start of the seekable window | Int64 | Optional |
EaseLiveNotificationKeys.maxTimecodeUserInfoKey | Timecode at the end of the seekable window | Int64 | Optional |
The EaseLiveNotificationKeys.initialTimecodeUserInfoKey
and EaseLiveNotificationKeys.maxTimecodeUserInfoKey
are optional. If not present the stream is considered to be a Live stream without a seekable buffer.
EaseLiveNotificationKeys.playerError
Notifies the SDK of an error in the player or player plugin.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.errorUserInfoKey | Error object | EaseLiveError | Required |
EaseLiveNotificationKeys.playerMetadata
Sent when the player reads metadata from the stream. The payload should be a JSON formatted String.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.metadataUserInfoKey | JSON string containing metadata | String | Required |
EaseLiveNotificationKeys.playerState
Sent when the player changes state, for example a change from paused to playing.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.stateUserInfoKey | New state | String | Required |
Where state is a String with possible values playing
, stopped
, paused
, seeking
, buffering
.
EaseLiveNotificationKeys.playerStage
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.controlsUserInfoKey | New controls state | String | Required |
The value of controls
should be either visible
or hidden
.
EaseLiveNotificationKeys.playerSpeed
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.speedUserInfoKey | The new playback speed | Float | Required |
EaseLiveNotificationKeys.playerVolume
Sent when the player has changed its audio volume. Eg. 0 is silent, 100 is normal volume.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.volumeUserInfoKey | The new audio volume | Int | Required |
EaseLiveNotificationKeys.playerMute
Sent when the player has changed its audio mute status. Eg. true is muted, false is unmuted.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.muteUserInfoKey | The new audio mute status | Bool | Required |
EaseLiveNotificationKeys.playerVideoScale
Sent when the player will change the video surface's scale and position.
Attribute | Description | Type | Required |
---|---|---|---|
EaseLiveNotificationKeys.videoScaleXUserInfoKey | Horizontal scale factor, between 0 and 1. | Float | Required |
EaseLiveNotificationKeys.videoScaleYUserInfoKey | Vertical scale factor, between 0 and 1. | Float | Required |
EaseLiveNotificationKeys.videoPivotXUserInfoKey | Horizontal anchor for the scaling animation, between 0 and 1. | Float | Required |
EaseLiveNotificationKeys.videoPivotYUserInfoKey | Vertical anchor of the scaling animation, between 0 and 1. | Float | Required |
EaseLiveNotificationKeys.videoScaleDurationUserInfoKey | Duration of the scale animation in milliseconds. | Int | Required |