Efficient products for your streaming infrastructure


HTML5 player SDK documentation

JavaScript player for Softvelum Low Delay Protocol

SLDP Player HTML5 SDK

Softvelum provides JavaScript SDK packages which you can use on your web sites to enable SLDP low-latency playback. It's a JavaScript-based library that has its API to operate. Here's how you can obtain it:

  1. You subscribe for the SDK using this page.
  2. You send a helpdesk request, specifying the list of domains where you plan using our player. Domain levels 2 and below are supported.
  3. Within 2 business days we generate individual builds for each specified domain and send them to you.
  4. As soon as we make SDK update, we'll send you new builds for each domain.
SDK subscription covers our technical support which is provided as long as you are subscribed.

Subscribe now

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.

SLDP Player interfaces

  • destroy( callback )
    Destroys given player instance, including MSE objects (Media Source Extensions), UI and connections.
    Parameters:
    • callback - (optional) callback function that is invoked after given player instance is destroyed
  • 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.
    Parameters:
    • volume - integer from 0 (muted) to 100 (full volume)
  • 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).
    Parameters:
    • rendition - string representing desired rendition, e.g. '1080p'
  • getStreams()
    Returns list of streams available for select as renditions.
    Return value: array of objects with the following fields:
    • name - application and stream name, e.g. 'live/stream'
    • width - video width in pixels, if present
    • height - video height in pixels, if present
    • bandwidth - stream bandwidth expressed in bits per second
  • getCurrentStream()
    Returns currently selected stream.
    Return value: object with the following fields:
    • name - application and stream name, e.g. 'live/stream'
    • width - video width in pixels, if present
    • height - video height in pixels, if present
    • bandwidth - stream bandwidth expressed in bits per second
  • 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).
    Parameters:
    • name - target application and stream name, e.g. 'live/stream'
  • 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.
    Parameters:
    • url - string representing desired SLDP stream URL, e.g. 'ws://example.com/app/stream'
  • refreshVUMeterUI()
    Re-draws VU meter UI. Should be used in case of VU meter container size has been changed, so the UI will be updated accordingly.
  • unmuteVUMeter()
    Applicable for input type VU meter. Activates VU meter that was automatically suspended by browser in case of muted autoplay. Must be accompanied with user's action like click or tap.
  • setCallbacks( callbacks )
    Sets callback functions for given player instance.
    Parameters:
    • callbacks - object, where keys are callback names and values are references to developer's callback functions. Acceptable callback names are: onConnectionStarted, onConnectionEstablished, onPlay, onPause, onVolumeSet, onConnectionClosed, onChangeRendition, onChangeRenditionComplete, onError, onLatencyAdjustSeek, onLowBuffer, onVUMeterUpdate

SLDP player callbacks:

  • onConnectionStarted( url )
    Invoked when player starts connection to media server.
    Parameters:
    • url - SLDP stream URL, which player connects to, e.g. 'ws://example.com/live/stream'
  • 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.
    Parameters:
    • streams - array of available streams.
      Each stream is an object with the following fields:
      • name - application and stream name, e.g. 'live/stream'
      • width - stream width in pixels if video is present
      • height - stream height in pixels if video is present
      • vcodec - stream video codec if present
      • video - either 'supported' or 'not supported' depending on browser capabilities
      • acodec - stream audio codec if present
      • audio - either 'supported' or 'not supported' depending on browser capabilities
      • bandwidth - stream bandwidth expressed in bits per second
  • 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.
    Parameters:
    • volume - integer from 0 to 100, representing selected volume level
  • onConnectionClosed()
    Invoked when connection to media server is closed due to whatever reason.
  • onError( error )
    Invoked when player error is encountered.
    Parameters:
    • error - string with error description, e.g. 'MEDIA_SOURCE_NOT_SUPPORTED' or 'NO_PLAYABLE_SOURCE_FOUND'
  • onChangeRendition( rendition, name )
    Invoked when user changes rendition, or either changeRendition() or changeStream() method is executed.
    Parameters:
    • rendition - string with user selected rendition, e.g. '1080p' or 'Auto'
    • name - selected application and stream name, e.g. 'live/stream'
  • onChangeRenditionComplete( rendition, name )
    Invoked when rendition switch is complete.
    Parameters:
    • rendition - string representing actual rendition, e.g. '1080p'
    • name - actual application and stream name, e.g. 'live/stream'
  • onError( error )
    Invoked if SLDP player can't handle given stream URL.
    Parameters:
    • error - 'MEDIA_SOURCE_NOT_SUPPORTED' if current browser doesn't support Media source API (e.g. Internet Explorer < 11) or 'NO_PLAYABLE_SOURCE_FOUND' for other cases
  • onLatencyAdjustSeek( from, to )
    Invoked when seek is performed for automatic latency adjustment (latency_tolerance parameter must be set).
    Parameters:
    • from - position in seconds that seek is performed from
    • to - position in seconds that seek is performed to
  • onLowBuffer()
    Invoked when player encounters low buffer conditions, e. g. it doesn't have data enough to continue playback.
  • onVUMeterUpdate( magnitudes, decibels )
    Invoked each time audio level is calculated for next 2048 samples. So, for 48KHz audio this callback will be executed about 24 times per second. The execution frequency can be limited by setting 'rate' parameter. Applicable only if VU meter settings are defined. This callback is executed within main browser thread, therefore no heavy processing related to UI rendering should be invoked within it (use window.requestAnimationFrame method instead).
    Parameters:
    • magnitudes - array of audio magnitudes for each channel, calculated according to the mode specified in the VU meter settings. Possible values should be from 0 to 1, but may be greater than 1, if that's set in the audio source.
    • decibels - array of audio levels for each channel in decibels, calculated according to the mode specified in the VU meter settings. Possible values should be from -100 dB to 0 dB, but may be greater than 0, if that's set in the audio source.

Reference implementation

You can go to Reference page and start some stream there to see an example of player implementation with our SDK with all existing controls.

Subscribe now