IPlayerServerHandler
An interface for a handler that provides the service logic of the PlayerServer.
Properties
handleClearTextView()
handleClearTextView: (
sessionId
?) =>void
Handles a request to clear the text view. This call is received when apps call
IPlayerClient.clearTextView
from interactive component.
Apps must implement this function to call clearCaptionViewHandle
on
VideoPlayer instance corresponding to sessionId
.
Parameters
sessionId?
The session ID to target for clearing the captions surface. If not specified, the PlayerServer decides how to handle the request.
Returns
void
Throws
if the given sessionId does not exist.
handleClearVideoView()
handleClearVideoView: (
sessionId
?) =>void
Handles a request to clear the text view. This call is received when apps call
IPlayerClient.clearVideoView
from interactive component.
Apps must implement this function to call clearSurfaceHandle
on
VideoPlayer instance corresponding to sessionId
.
Parameters
sessionId?
The session ID to target for clearing the text view. If not specified, the PlayerServer decides how to handle the request.
Returns
void
Throws
if the given sessionId does not exist.
handleGetCurrentPosition()
handleGetCurrentPosition: (
sessionId
?) =>number
Handles request for interactive component to get the current playback position of media playback.
This call is received when apps call IPlayerClient.getCurrentPosition
from interactive component.
Apps must implement this function to get currentTime
from {Audio,Video} Player instance corresponding to sessionId
and then apps must resolve promise with number
indicating current playback position (in seconds).
Parameters
sessionId?
The session ID to target with the request. If not specified, the PlayerServer decides how to handle the request.
Returns
number
The current playback position of media playback session
corresponding to sessionId
.
Throws
if the given sessionId does not exist.
handleLoad()
handleLoad: (
mediaInfo
,loadParams
?,sessionId
?) =>void
Handles a request to load content by URL. This call is received when apps call
IPlayerClient.load
from interactive component.
Apps must implement this function to initialize MediaPlayer instance with the fields
values provided in mediaInfo
and loadParams
for player session corresponding to sessionId
.
Parameters
mediaInfo
The object to describe the necessary URLs and HTTP headers to load media content.
loadParams?
Params required to load content by URL.
sessionId?
The session ID to target for loading content. If not specified, the PlayerServer decides how to handle the request.
Returns
void
Throws
if the given sessionId does not exist.
handleMessage()
handleMessage: (
message
,sessionId
?) =>void
Handles a request to receive a custom message from interactive component. Apps can use
message
object to perform custom operations.
This call is received when apps call IPlayerClient.sendMessage
from interactive component.
Apps may implement this function to handle custom operations in service component.
Parameters
message
any
The message to be handled. To be sent as JSON object.
sessionId?
The session ID to target with the request. If not specified, the PlayerServer decides how to handle the request.
Returns
void
Throws
if the given sessionId does not exist.
handlePause()
handlePause: (
sessionId
?) =>void
Handles a request to pause playback. This call is received when apps call
IPlayerClient.pause
from interactive component.
Apps must implement this function to call pause
on {Video,Audio}Player instance corresponding to sessionId
.
Parameters
sessionId?
The session ID to target with the request. If not specified, the PlayerServer decides how to handle the request.
Returns
void
Details
Receiving multiple pause requests while already in pause state is not an error and should signal success.
The media server should update the corresponding IISessionStatus
to reflect the new playback status.
Throws
if the given sessionId does not exist.
handlePlay()
handlePlay: (
sessionId
?) =>void
Handles a request to resume or start playback. This call is received when apps call
IPlayerClient.play
from interactive component.
Apps must implement this function to call play
on {Video,Audio}Player instance corresponding to sessionId
.
Parameters
sessionId?
The session ID to target with the request. If not specified, the PlayerServer decides how to handle the request.
Returns
void
Details
If the application is already playing and the playback speed is not normal (not 1.0)
this may return playback to normal speed.
Receiving multiple play requests while already in playing state is not an error and should signal success.
The media server should update the corresponding IISessionStatus
to reflect the new playback status.
Throws
if the given sessionId does not exist.
handleSeek()
handleSeek: (
position
,isRelative
?,sessionId
?) =>void
Handles a request to seek to seek to a given playback position. This call is received when apps call
IPlayerClient.seek
from interactive component.
Apps must implement this function to change currentTime of {Video,Audio}Player
instance corresponding to sessionId
.
Parameters
position
number
The playback position to seek to, either relative to the current playback position (isRelative = true); or relative to the start of the media where 0 represents the start of the media (isRelative = false).
isRelative?
boolean
If the position provided is relative to the current playback position (isRelative = true) or an absolute position in the media (isRelative = false). Default value is false.
sessionId?
The session ID to target with the request. If not specified, the PlayerServer decides how to handle the request.
Returns
void
Details
The media server should update the corresponding IISessionStatus
to reflect the new playback position.
Throws
if the given sessionId does not exist.
handleSetActiveTrack()
handleSetActiveTrack: (
trackType
,trackId
,sessionId
?) =>void
Handles a request to set the active track of media playback. This call is received when apps call
IPlayerClient.setActiveTrack
from interactive component.
Apps must implement this function to set audio, video or text track by ID on MSE player instance.
Parameters
trackType
The type of the track to set as active.
trackId
string
The track ID of the track to set as active.
sessionId?
The session ID to target with the request. If not specified, the PlayerServer decides how to handle the request.
Returns
void
Details
The media sesssion should update its IISessionStatus
to reflect the new playback status.
Throws
if the given sessionId does not exist.
handleSetMute()
handleSetMute: (
isMuted
,sessionId
?) =>void
Handles a request to mute playback. This call is received when apps call
IPlayerClient.setMute
from interactive component.
Apps must implement this function to set muted
on {Video,Audio}Player instance corresponding to sessionId
.
Parameters
isMuted
boolean
If true, the media should be muted;
sessionId?
The session ID to target with the request. If not specified, the PlayerServer decides how to handle the request.
Returns
void
Details
The media server should update the corresponding IISessionStatus
to reflect the new playback status.
Throws
if the given sessionId does not exist.
handleSetPlaybackRate()
handleSetPlaybackRate: (
playbackRate
,sessionId
?) =>void
Handles a request to set playback speed of media playback. This call is received when apps call
IPlayerClient.setPlaybackRate
from interactive component.
Apps must implement this function to set playbackRate
on {Video,Audio}Player instance corresponding to sessionId
.
Parameters
playbackRate
number
The playback speed to set, like 0.25, 0.5, 2.0 etc
sessionId?
The session ID to target with the request. If not specified, the PlayerServer decides how to handle the request.
Returns
void
Details
The media sesssion should update its IISessionStatus
to reflect the new playback status.
Throws
if the given sessionId does not exist.
handleSetTextView()
handleSetTextView: (
handle
,sessionId
?) =>void
Handles a request to set the text view. This call is received when apps call
IPlayerClient.setTextView
from interactive component.
Apps must implement this function to call setCaptionViewHandle
on
VideoPlayer instance corresponding to sessionId
.
Parameters
handle
The identifier for the shared surface.
sessionId?
The session ID to target for setting the captions surface. If not specified, the PlayerServer decides how to handle the request.
Returns
void
Throws
if the given sessionId does not exist.
handleSetVideoView()
handleSetVideoView: (
handle
,sessionId
?) =>void
Handles a request to set the video view. This call is received when apps call
IPlayerClient.setVideoView
from interactive component.
Parameters
handle
The identifier for the shared surface.
sessionId?
The session ID to target for setting the video surface. If not specified, the PlayerServer decides how to handle the request.
Apps must implement this function to call setSurfaceHandle
on
VideoPlayer instance corresponding to sessionId
.
Returns
void
Throws
if the given sessionId does not exist.
handleSetVolume()
handleSetVolume: (
volume
,sessionId
?) =>void
Handles a request to set volume of media playback. This call is received when apps call
IPlayerClient.setVolume
from interactive component.
Apps must implement this function to set volume
on {Video,Audio}Player instance corresponding to sessionId
.
Parameters
volume
number
The volume to set, in the range of 0.0 to 1.0.
sessionId?
The session ID to target with the request. If not specified, the PlayerServer decides how to handle the request.
Returns
void
Details
The media sesssion should update its IISessionStatus
to reflect the new playback status.
Throws
if the given sessionId does not exist.
handleStartBufferedRangesUpdates()
handleStartBufferedRangesUpdates: (
sessionId
?) =>void
This call is received when apps make at least one IPlayerClient.registerBufferedRangesListener
call for sessionId from interactive component.
Apps must start sending buffered ranges updates corresponding to sessionId
by calling IPlayerServer.updateBufferedRanges
API from service component.
Parameters
sessionId?
The session ID to target with the request. If not specified, the session to target is decided by the server.
Returns
void
Throws
if the given sessionId does not exist.
handleStartErrorUpdates()
handleStartErrorUpdates: (
sessionId
?) =>void
This call is received when apps make at least one IPlayerClient.registerErrorListener
call for sessionId from interactive component.
Apps can start sending IPlayerSessionError
as JSON objects by calling
IPlayerServer.sendError
API corresponding to sessionId from service component.
Parameters
sessionId?
The session ID to target with the request. If not specified, the session to target is decided by the server.
Returns
void
Throws
if the given sessionId does not exist.
handleStartMessageUpdates()
handleStartMessageUpdates: (
sessionId
?) =>void
This call is received when apps make at least one IPlayerClient.registerMessageListener
call for sessionId from interactive component.
Apps can start sending custom messages as JSON objects by calling
IPlayerServer.sendMessage
API corresponding to sessionId from service component.
Parameters
sessionId?
The session ID to target with the request. If not specified, the session to target is decided by the server.
Returns
void
Throws
if the given sessionId does not exist.
handleStartStatusUpdates()
handleStartStatusUpdates: (
sessionId
?) =>void
This call is received when apps make at least one IPlayerClient.registerStatusListener
call for sessionId from interactive component.
Apps must start sending player session status updates corresponding to sessionId
by calling IPlayerServer.updateStatus
API from service component.
Parameters
sessionId?
The session ID to target with the request. If not specified, the session to target is decided by the server.
Returns
void
Throws
if the given sessionId does not exist.
handleStartTrackUpdates()
handleStartTrackUpdates: (
sessionId
?) =>void
This call is received when apps make at least one IPlayerClient.registerTrackListener
call for sessionId from interactive component.
Apps must start sending player session track updates corresponding to sessionId by calling
IPlayerServer.addTrack
or IPlayerServer.removeTrack
APIs from service component.
Parameters
sessionId?
The session ID to target with the request. If not specified, the session to target is decided by the server.
Returns
void
Throws
if the given sessionId does not exist.
handleStopBufferedRangesUpdates()
handleStopBufferedRangesUpdates: (
sessionId
?) =>void
This call is received when apps unsubscribe all IPlayerSessionBufferedRangesListener
instances for sessionId from interactive component.
Apps must stop sending buffered ranges updates corresponding to sessionId from service component.
Parameters
sessionId?
The session ID to target with the request. If not specified, the session to target is decided by the server.
Returns
void
Throws
if the given sessionId does not exist.
handleStopErrorUpdates()
handleStopErrorUpdates: (
sessionId
?) =>void
This call is received when apps unsubscribe all IPlayerSessionErrorListener
instances for sessionId from interactive component. So, service component should not
send any errors corresponding to sessionId as there is no receiver of
these messages available.
Parameters
sessionId?
The session ID to target with the request. If not specified, the session to target is decided by the server.
Returns
void
Throws
if the given sessionId does not exist.
handleStopMessageUpdates()
handleStopMessageUpdates: (
sessionId
?) =>void
This call is received when apps unsubscribe all IPlayerSessionTrackListener
instances for sessionId from interactive component. So, service component should not
send any message corresponding to sessionId as there is no receiver of
these messages available.
Parameters
sessionId?
The session ID to target with the request. If not specified, the session to target is decided by the server.
Returns
void
Throws
if the given sessionId does not exist.
handleStopStatusUpdates()
handleStopStatusUpdates: (
sessionId
?) =>void
This call is received when apps unsubscribe all IPlayerSessionStatusListener
instances for sessionId from interactive component.
Apps must stop sending player session status updates corresponding to sessionId from service compoenent.
Parameters
sessionId?
The session ID to target with the request. If not specified, the session to target is decided by the server.
Returns
void
Throws
if the given sessionId does not exist.
handleStopTrackUpdates()
handleStopTrackUpdates: (
sessionId
?) =>void
This call is received when apps unsubscribe all IPlayerSessionTrackListener
instances for sessionId from interactive component.
Apps must stop sending player session track updates corresponding to sessionId from service component.
Parameters
sessionId?
The session ID to target with the request. If not specified, the session to target is decided by the server.
Returns
void
Throws
if the given sessionId does not exist.
handleUnload()
handleUnload: (
sessionId
?) =>void
Unloads content from a media session in response to IPlayerClient.unload
calls from the interactive component.
Applications must implement this function to release MediaPlayer and Media Source Extensions (MSE) resources
for the player session associated with the given sessionId
.
Parameters
sessionId?
The session ID of the content to unload. If not provided, the PlayerServer determines how to handle the request.
Returns
void
Throws
if the given sessionId does not exist.
handleUnloadSync()?
optional
handleUnloadSync: (timeoutMsec
,sessionId
?) =>IUnloadSyncStatus
Unloads content from a media session in response to IPlayerClient.unloadSync
calls from the interactive component.
Applications must implement this function to release MediaPlayer and Media Source Extensions (MSE) resources
for the player session associated with the given sessionId
synchronously.
For W3CMedia MediaPlayer
instance, use deinitializeSync
API.
Parameters
timeoutMsec
number
Maximum allowed time (in milliseconds) for unloadSync API to execute. Minimum value is 1000, maximum value is 5000.
sessionId?
The session ID of the content to unload. If not provided, the PlayerServer determines how to handle the request.
Returns
The status of synchronous deinitialize of mediaplayer instance corresponding to sessionId
.
Throws
if the given sessionId does not exist.
Last updated: Oct 02, 2025