Please find the player methods and callbacks described below.
SLDP.isMediaSourceSupported() – returns whether current browser supports Media Source Extensions API and hence ability to run SLDP player.
Return value: true if supports, false otherwise.
destroy() – destroys given player instance, including MSE objects (Media Source Extensions), UI and connections.
play() – starts playback for given player instance.
pause() – pauses playback for given player instance. Current connection to media server is retained during pause_timeout interval if specified.
stop() – stops playback for given player instance. Current connection to media server is closed immediately.
getVolume() – retruns player volume.
Return value: integer from 0 (muted) to 100 (full volume).
setVolume( volume ) – sets player volume. UI controls are updated according to selected value.
startAbr() – starts adaptive bitrate algorithm (ABR), which performs automatic switching to the best available rendition at a time according to network conditions and CPU processing.
stopAbr() – stops adaptive bitrate algorithm (ABR).
isAbr() – returns whether adaptive bitrate algorithm (ABR) is turned on.
getRenditions() – returns list of available stream renditions.
Return value: array of strings containing available renditions, e.g. ['360p', '720p'].
getCurrentRendition() – returns currently selected rendition.
Return value: string with current rendition, e.g. '720p'.
changeRendition( rendition ) – switches playback to the specified rendition.
Return value: boolean status (true – rendition switching has started, false – another switching is currently in progress).
getStreams() – returns list of streams available for select as renditions.
Return value: array of objects with the following fields:
getCurrentStream() – returns currently selected stream.
Return value: object with the following fields:
changeStream( name ) – switches playback to the stream with the name specified.
Return value: boolean status (true – stream switching has started, false – another switching is currently in progress).
setStreamURL( url ) – sets new SLDP stream URL. Currently playing stream is aborted. If given player instance has "autoplay" parameter set to true, then new stream's playback starts immediately if possible.
setCallbacks( callbacks ) – sets callback functions for given player instance.
onConnectionStarted( url ) – invoked when player starts connection to media server.
onConnectionEstablished( streams ) – invoked when connection to media server is established and list of available streams is received. List of renditions available for user is composed depending on those streams and browser capabilities.
onPlay() – invoked when user presses play button, or play() method is executed.
onPause() – invoked when user presses pause button, or pause() method is executed.
onVolumeSet( volume ) – invoked when user changes volume using volume control elements, or setVolume() method is executed.
onConnectionClosed() – invoked when connection to media server is closed due to whatever reason.
onError( error ) – invoked when player error is encountered.
onChangeRendition( rendition, name ) – invoked when user changes rendition, or either changeRendition() or changeStream() method is executed.
onChangeRenditionComplete( rendition, name ) – invoked when rendition switch is complete.
onError( error ) – invoked if SLDP player can't handle given stream URL.
onLatencyAdjustSeek( from, to ) – invoked when seek is performed for automatic latency adjustment (latency_tolerance parameter must be set).
You can go to Reference page and start some stream there to see an example of player implmentation with our SDK with all existing controls.