setVideoTrack
Description
Change the current video track.
The argument to this method is the wanted track's id
property. This id
can for example
be obtained on the corresponding track object returned by the getAvailableVideoTracks
method.
If trickmode tracks are enabled (usually through the corresponding setPlaybackRate
method option) and if that new video track is linked to trickmode tracks, one of the
trickmode tracks will be loaded instead.
Note that trickmode tracks cannot be forced through the setVideoTrack
method by giving
directly the trickmode tracks' id.
If you want to enable or disable trickmode tracks, you should use setPlaybackRate
instead.
etting a new video track when a previous one was already playing can lead the rx-player to "reload" this content.
During this period of time:
- the player will have the state
RELOADING
- Multiple APIs linked to the current content might not work. Most notably:
play
will not workpause
will not workseekTo
will not workgetPosition
will return 0getWallClockTime
will return 0getVideoDuration
will returnNaN
getAvailableAudioTracks
will return an empty arraygetAvailableTextTracks
will return an empty arraygetAvailableVideoTracks
will return an empty arraygetTextTrack
will returnnull
getAudioTrack
will returnnull
setAudioTrack
will throwsetTextTrack
will throw
This method will only have an effect on the Period that is currently playing. If you want to update the track for other Periods as well, you might want to either:
- update the current video track once a `"periodChange"` event has been received.
- update first the preferred video tracks through the setPreferredVideoTracks method.
Syntax
player.setVideoTrack(videoTrackId);
-
arguments:
- videoTrackId
string|Number
: Theid
of the track you want to set
- videoTrackId