Track Selection
Track Manipulation
FLPlayer
node component provides fields and functions to retrieve a current audio or subtitle track, retrieve available list of audio or subtitle tracks and select a audio or subtitle track.
List available Tracks
Upon loading the media FLPlayer
updates the list of available audio or subtitle tracks. The same can be read from player fields. The value is an array of assocarray objects each containing track name, description and identifier.
' Get available audio tracks
audioTracks = flPlayer.getField(m.flPlayerFields.AVAILABLE_AUDIO_TRACKS)
' Get available subtitle tracks
subtitleTracks = flPlayer.getField(m.flPlayerFields.AVAILABLE_SUBTITLE_TRACKS)
A subtitle track object
Key | Type | Value |
---|---|---|
Description | string | Descriptive name of the subtitle track |
Language | string | ISO 639-2 three-letter language code |
TrackName | string | The track identifier. The value of this field may be used to select the subtitle track. |
An audio track object
Key | Type | Value |
---|---|---|
Description | string | Descriptive name of the audio track |
Language | string | ISO 639-2 three-letter language code |
Track | string | The track identifier. The value of this field may be used to select the audio track. |
Get active Track
The currently active track in each type can be obtained from the Player using the selectedTrack(for:)
API. This API returns the active track of any given a MediaTrack
.
' Get current audio track
audioTrack = flPlayer.getField(m.flPlayerFields.CURRENT_AUDIO_TRACK)
' Get current substitle track
subtitleTrack = flPlayer.getField(m.flPlayerFields.CURRENT_SUBTITLE_TRACK)
Set a track
A audio or subtitle track could be selected by invoking set track functions on FLPlayer
with the track identifier string as param.
' Set a audio track
flPlayer.callFunc(m.flPlayerFunctions.SET_AUDIO_TRACK, audioIdentifierString)
' Set a video track
flPlayer.callFunc(m.flPlayerFunctions.SET_SUBTITLE_TRACK), subtitleIdentifierString)
Passing an empty string with SET_SUBTITLE_TRACK
function will turn off captions.