Properties
load
load: (mediaInfo: IPlayerSessionMediaInfo, loadParams?: IPlayerSessionLoadParams, sessionId?: IPlayerSessionId) => Promise<void>
Request the PlayerServer to load the content using the given URL.
Parameters
mediaInfo
IPlayerSessionMediaInfo
loadParams?
any
sessionId?
any
Returns
Promise<void>
A Promise that resolves when the request is successfully handled,
or rejects with an error if the request fails.
Examples
unload
unload: (sessionId?: IPlayerSessionId) => Promise<void>
Request the media session in PlayerServer to unload media content.
To unload media content synchronously, for instance, in case when
app state changes to background, call unloadSync.
Parameters
sessionId?
any
Returns
Promise<void>
A Promise that resolves when the request is successfully handled,
or rejects with an error if the request fails.
Examples
unloadSync
unloadSync: (timeoutMsec: number, sessionId?: IPlayerSessionId) => IUnloadSyncStatus
Request the media session in PlayerServer to unload media content synchronously.
Use this API to release media resources when app state changes to background.
2.2.0
Parameters
timeoutMsec
number
sessionId?
any
Returns
IUnloadSyncStatus
One of the enum values in PlayerServer IUnloadSyncStatus.
Examples
setVideoView
setVideoView: (viewHandle: IViewHandle, sessionId?: IPlayerSessionId) => Promise<void>
Request the media session in PlayerServer to set the KeplerVideoSurfaceView with the loaded content.
setVideoView should be called after the media content has been loaded by calling one of the load APIs.
Parameters
viewHandle
IViewHandle
sessionId?
any
Returns
Promise<void>
A Promise that resolves when the request is successfully handled,
or rejects with an error if the request fails.
Examples
clearVideoView
clearVideoView: (sessionId?: IPlayerSessionId) => Promise<void>
Request the media session in PlayerServer to clear the KeplerVideoSurfaceView rendering the video content.
Parameters
sessionId?
any
Returns
Promise<void>
A Promise that resolves when the request is successfully handled,
or rejects with an error if the request fails.
Examples
setTextView
setTextView: (viewHandle: IViewHandle, sessionId?: IPlayerSessionId) => Promise<void>
Request the media session in PlayerServer to set the KeplerCaptionsView with the loaded content.
setTextView should be called after the media content has been loaded by calling one of the load APIs.
Parameters
viewHandle
IViewHandle
sessionId?
any
Returns
Promise<void>
A Promise that resolves when the request is successfully handled,
or rejects with an error if the request fails.
Examples
clearTextView
clearTextView: (sessionId?: IPlayerSessionId) => Promise<void>
Request the media session in PlayerServer to clear the KeplerCaptionsView rendering the captions content.
Parameters
sessionId?
any
Returns
Promise<void>
A Promise that resolves when the request is successfully handled,
or rejects with an error if the request fails.
Examples
play
play: (sessionId?: IPlayerSessionId) => Promise<void>
Request the PlayerServer to start or resume playback.
The media sesssion should update its IPlayerSessionStatus to reflect the new playback status.
The Kepler player server may reset playback speed back to normal.
Parameters
sessionId?
any
Returns
Promise<void>
A Promise that resolves when the request is successfully handled,
or rejects with an error if the request fails.
Examples
pause
pause: (sessionId?: IPlayerSessionId) => Promise<void>
Request the PlayerServer to pause playback.
The media sesssion should update its IPlayerSessionStatus to reflect the new playback status.
Parameters
sessionId?
any
Returns
Promise<void>
A Promise that resolves when the request is successfully handled,
or rejects with an error if the request fails.
Examples
seek
seek: (position: number, isRelative?: boolean, sessionId?: IPlayerSessionId) => Promise<void>
Request the PlayerServer to seek to a given playback position (in seconds).
The media sesssion should update its IPlayerSessionStatus to reflect the new playback position.
Parameters
position
number
isRelative?
boolean
sessionId?
any
Returns
Promise<void>
A Promise that resolves when the request is successfully handled,
or rejects with an error if the request fails.
Examples
setMute
setMute: (isMuted: boolean, sessionId?: IPlayerSessionId) => Promise<void>
Request the PlayerServer to mute or unmute playback.
The media sesssion should update its IPlayerSessionStatus to reflect the new playback status.
Parameters
isMuted
boolean
sessionId?
any
Returns
Promise<void>
A Promise that resolves when the request is successfully handled,
or rejects with an error if the request fails.
Examples
setPlaybackRate
setPlaybackRate: (playbackRate: number, sessionId?: IPlayerSessionId) => Promise<void>
Request the PlayerServer to set playback rate of media playback.
The media sesssion should update its IPlayerSessionStatus to reflect the new playback status.
Parameters
playbackRate
number
sessionId?
any
Returns
Promise<void>
A Promise that resolves when the request is successfully handled,
or rejects with an error if the request fails.
Examples
setVolume
setVolume: (volume: number, sessionId?: IPlayerSessionId) => Promise<void>
Request the PlayerServer to set volume of media playback.
The media sesssion should update its IPlayerSessionStatus to reflect the new playback status.
Parameters
volume
number
sessionId?
any
Returns
Promise<void>
A Promise that resolves when the request is successfully handled,
or rejects with an error if the request fails.
Examples
setActiveTrack
setActiveTrack: (trackType: ITrackType, trackId: string, sessionId?: IPlayerSessionId) => Promise<void>
Request the PlayerServer to set the active track of media playback.
The media sesssion should update its IPlayerSessionStatus to reflect the new playback status.
Parameters
trackType
ITrackType
trackId
string
sessionId?
any
Returns
Promise<void>
A Promise that resolves when the request is successfully handled,
or rejects with an error if the request fails.
Examples
setMediaControlFocus
setMediaControlFocus:Register PlayerClientMediaControlHandler instance Available since version 2.1.0.(componentInstance: IComponentInstance, mediaControlHandler?:PlayerClientMediaControlHandler) => Promise<void>
Parameters
componentInstance
IComponentInstance
mediaControlHandler?
PlayerClientMediaControlHandlerReturns
Promise<void>
A Promise that resolves when the request is successfully handled,
or rejects with an error if the request fails, or targeted version is less than 2.1.0
Examples
getCurrentPosition
getCurrentPosition: (sessionId?: IPlayerSessionId) => Promise<number>
Request the PlayerServer to get the current playback position of media playback (in seconds).
The media sesssion should update its IPlayerSessionStatus to reflect the new playback status.
Parameters
sessionId?
any
Returns
Promise<number>
A Promise that resolves when the request is successfully handled,
or rejects with an error if the request fails; and it returns number indicating current playback
position corresponding to sessionId in seconds.
Examples
registerBufferedRangesListener
registerBufferedRangesListener:Subscribes a listener to monitor changes in the buffered ranges.(listener:IPlayerSessionBufferedRangesListener, sessionId?: IPlayerSessionId) => Promise<ISubscription>
Parameters
listener
IPlayerSessionBufferedRangesListenersessionId?
any
Returns
Promise<ISubscription>
A Promise that resolves with an ISubscription object.
This object can be used to unsubscribe the listener when it’s no longer needed.
Examples
registerStatusListener
registerStatusListener:Subscribes a listener to monitor changes in the player session status.(listener:IPlayerSessionStatusListener, sessionId?: IPlayerSessionId) => Promise<ISubscription>
Parameters
listener
IPlayerSessionStatusListenersessionId?
any
Returns
Promise<ISubscription>
A Promise that resolves with an ISubscription object.
This object can be used to unsubscribe the listener when it’s no longer needed.
Examples
registerPositionListener
registerPositionListener:Subscribes a listener to monitor updates in the playback position. This position will be in seconds.(listener:IPlayerSessionPositionListener, interval: number, sessionId?: IPlayerSessionId) => Promise<ISubscription>
Parameters
listener
IPlayerSessionPositionListenerinterval
number
sessionId?
any
Returns
Promise<ISubscription>
A Promise that resolves with an ISubscription object.
This object can be used to unsubscribe the listener when it’s no longer needed.
Examples
registerTrackListener
registerTrackListener:Subscribes a listener to monitor changes in the track information.(listener:IPlayerSessionTrackListener, sessionId?: IPlayerSessionId) => Promise<ISubscription>
Parameters
listener
IPlayerSessionTrackListenersessionId?
any
Returns
Promise<ISubscription>
A Promise that resolves with an ISubscription object.
This object can be used to unsubscribe the listener when it’s no longer needed.
Examples
registerMessageListener
registerMessageListener:Subscribes a listener to receive message from service component.(listener:IPlayerSessionMessageListener, sessionId?: IPlayerSessionId) => Promise<ISubscription>
Parameters
listener
IPlayerSessionMessageListenersessionId?
any
Returns
Promise<ISubscription>
A Promise that resolves with an ISubscription object.
This object can be used to unsubscribe the listener when it’s no longer needed.
Examples
registerErrorListener
registerErrorListener:Subscribes a listener to receive error from service component.(listener:IPlayerSessionErrorListener, sessionId?: IPlayerSessionId) => Promise<ISubscription>
Parameters
listener
IPlayerSessionErrorListenersessionId?
any
Returns
Promise<ISubscription>
A Promise that resolves with an ISubscription object.
This object can be used to unsubscribe the listener when it’s no longer needed.
Examples
sendMessage
sendMessage: (message: any, sessionId?: IPlayerSessionId) => Promise<void>
Provides a way for interactive component to send custom message to service component.
Any JSON type can be sent as a message (except undefined).
Parameters
message
any
sessionId?
any
Returns
Promise<void>
A Promise that resolves when the request is successfully handled,
or rejects with an error if the request fails or message is undefined.
Examples
destroy
destroy: () => void
Destroys the kepler player client instance and stop the Kepler Player Service.
Clients are expected to call this API for cleanup of media resources
when interactive components gets destroyed.

