Skip to main content
Skip table of contents

Browsers SDK 1 Migration Guide

Video Agent

Events

The CONNECT Player Browser SDK supports all the VideoAgent events present in the PPAPI/NPAPI plugins, these are now registered directly against the player instance using a listener, for example player.on("event", () =>{}).

VideoAgent events support:

  • abort
  • canplay
  • canplaythrough
  • durationchange
  • emptied
  • ended
  • error
  • loadedmetadata
  • loadstart
  • pause
  • play
  • playing
  • progress
  • seeked
  • seeking
  • stalled
  • timeupdate
  • volumechange
  • waiting

Properties

All VideoAgent properties are now functions against the player instance object.

PropertyFunctionNotes
autoplayautoplay()
controlscontrols()
currentSrccurrentSrc()
currentTimecurrentTime()
disableSeek
Not implemented
durationduration()
endedended()
errorerror()
maximumSeekBackseekable()Deprecated, see seekable()
mutedmuted()
networkStatenetworkState()
onerror

onload

pausedpaused()
readyStatereadyState()
seekableseekable()Returns a TimeRange object
seekingseeking()
srcsrc()
videoHeightvideoHeight()
videoWidthvideoWidth()
volumevolume()

Playback Agent

Track selection

The  activateTrack  and  deactivateTrack  methods do not have direct mappings in the Browser SDK. Track selection and deselection is now handled by iterating over a  TextTrackList  or  AudioTrackList  returned by the  textTracks()  and  audioTracks()  methods.

This is an example of selecting English subtitles:


JS
let tracks = player.textTracks();

for (let i = 0; i < tracks.length; i++) {
  let track = tracks[i];

  // Show the English subtitle track, disable all others
  if (track.kind === "subtitles" && track.language === "en") {
    track.mode = "showing";
  } else {
    track.mode = "disabled";
  }
}

Properties

PropertyMappingNotes
audioTracksaudioTracks()The track list returned is not compatible
subtitlingTrackstextTracks()The track list returned is not compatible

Events

Plugin eventBrowser eventNotes
errorChanged
Not implemented
ID3TagChanged
Not implemented
streamBitrateChanged

tracksChangedaddtrack / removetrackThese events are implemented in  TextTrackList  and  AudioTrackList

Network Agent

Events

EventObjectEvent
selectedBitrateChangednetworkStatisticsselectedBitrateChanged

Example:

JS
player.otvtoolkit().networkStatistics.setNetworkListener({
    selectedBitrateChanged: () => {
        console.log("Selected bitrate changed");
    }
});
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.