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.
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 switch has started, false – another rendition switch 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 ) – invoked when user changes rendition, or changeRendition() method is executed.
onChangeRenditionComplete( rendition ) – invoked when rendition switch is complete.
You can go to Referene page and start some stream there to see an example of player implmentation with our SDK with all existing controls.