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:
playwill not workpausewill not workseekTowill not workgetPositionwill return 0getWallClockTimewill return 0getVideoDurationwill returnNaNgetAvailableAudioTrackswill return an empty arraygetAvailableTextTrackswill return an empty arraygetAvailableVideoTrackswill return an empty arraygetTextTrackwill returnnullgetAudioTrackwill returnnullsetAudioTrackwill throwsetTextTrackwill 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: Theidof the track you want to set
- videoTrackId