THEOplayer > MediaTrack
Inherits from Track, EventDispatcher<MediaTrackEventMap> . See parent page for inherited properties and methods.
Represents a media track (audio or video) of a media resource.
Signature:
export interface MediaTrack extends Track, EventDispatcher<MediaTrackEventMap>
Property |
Type |
Description |
---|---|---|
Quality |
The active quality of the media track, i.e. the quality that is currently being played. |
|
|
Whether the track is enabled. |
|
|
The identifier of the media track. |
|
|
The kind of the media track, represented by a value from the following list: |
|
|
The label of the media track. |
|
|
The language of the media track. |
|
The qualities of the media track. |
||
One or more desired qualities of the media track. |
||
|
A unique identifier of the media track. |
Method |
Description |
---|---|
addEventListener(type: |
Add the given listener for the given event type(s). |
removeEventListener(type: |
Remove the given listener for the given event type(s). |
The active quality of the media track, i.e. the quality that is currently being played.
Signature:
readonly activeQuality: Quality | undefined;
Whether the track is enabled.
Signature:
enabled: boolean;
- Only one track of the same type (e.g. video) can be enabled at the same time.
- Enabling a track will disable all other tracks of the same type.
- Disabling a track will not enable a different track of the same type.
The identifier of the media track.
Signature:
readonly id: string;
- This identifier can be used to distinguish between related tracks, e.g. tracks in the same list.
The kind of the media track, represented by a value from the following list:
- 'main'
: The track is the default track for playback
- 'alternative'
: The track is not the default track for playback
Signature:
readonly kind: string;
The label of the media track.
Signature:
label: string;
The language of the media track.
Signature:
readonly language: string;
The qualities of the media track.
Signature:
readonly qualities: QualityList;
One or more desired qualities of the media track.
Signature:
targetQuality: Quality | Quality[] | undefined;
- If desired qualities are present, the Adaptive Bitrate mechanism of the player will limit itself to these qualities.
- If one desired quality is present, the Adaptive Bitrate mechanism of the player will be disabled and the desired quality will be played back.
A unique identifier of the media track.
Signature:
readonly uid: number;
- This identifier is unique across tracks of a THEOplayer instance and can be used to distinguish between tracks.
- This identifier is a randomly generated number.
Add the given listener for the given event type(s).
Signature:
addEventListener<TType extends StringKeyOf<MediaTrackEventMap>>(type: TType | readonly TType[], listener: EventListener<MediaTrackEventMap[TType]>): void;
Parameter |
Type |
Description |
---|---|---|
type |
|
The type of the event. |
listener |
EventListener |
The callback which is executed when the event occurs. |
Remove the given listener for the given event type(s).
Signature:
removeEventListener<TType extends StringKeyOf<MediaTrackEventMap>>(type: TType | readonly TType[], listener: EventListener<MediaTrackEventMap[TType]>): void;
Parameter |
Type |
Description |
---|---|---|
type |
|
The type of the event. |
listener |
EventListener |
The callback which will be removed. |