Config to determine the initial playback state of the Player.

All options passed in this config, will be considered as the starting state of the player, therefore no events will be triggered signaling a potential change compared to the player default logic.

Example:

playback : {
autoplay: false,
muted: false,
audioLanguage: ['en', 'es', 'de'],
subtitleLanguage: 'en',
preferredTech: [{
player: 'html5',
streaming: 'dash'
}, {
player: 'native',
streaming: 'hls'
}]
}
interface PlaybackConfig {
    allowDecodingErrorRecovery?: boolean;
    audioCodecPriority?: string[];
    audioLanguage?: string | string[];
    autoplay?: boolean;
    isForcedSubtitle?: ((subtitle) => boolean);
    muted?: boolean;
    playsInline?: boolean;
    preferredTech?: PreferredTechnology[];
    seeking?: boolean;
    subtitleLanguage?: string | string[];
    timeShift?: boolean;
    videoCodecPriority?: string[];
    volume?: number;
}

Properties

allowDecodingErrorRecovery?: boolean

Whether to allow automatic recovery from PLAYBACK_VIDEO_DECODING_ERROR.

When enabled, the player reloads the current source and resumes playback at the position where the error occurred.

Recovery flow:

  1. A Warning with code PLAYBACK_VIDEO_DECODING_ERROR_RECOVERY is dispatched to signal that a recovery attempt is starting.
  2. The source is reloaded internally. Lifecycle events (SourceLoaded, SourceUnloaded, Play, Ready, Playing, Paused, Seek, Seeked, TimeShift, TimeShifted) are suppressed during this process to avoid spurious state changes in the application.
  3. Player state is restored automatically after the reload: playback position (seek for VoD; time shift for live streams), audio track, audio quality, video quality, playback speed, and the active subtitle track.

Retry behaviour: Recovery is attempted at most once per playback position. If a PLAYBACK_VIDEO_DECODING_ERROR occurs again at the same position (within a 0.1-second tolerance), recovery is skipped and the error is surfaced immediately. Once playback advances to a sufficiently different position, a new recovery attempt is allowed.

Failure: If the reload itself fails, the original PLAYBACK_VIDEO_DECODING_ERROR is dispatched as a Error.

When set to false, PLAYBACK_VIDEO_DECODING_ERROR is always fired immediately without any recovery attempt.

Default is true.

Since

8.251.0

audioCodecPriority?: string[]

Specify the priority of audi codecs. If more than one audio codec is available this order will be respected while finding a codec which is supported by the current browser. If there is a codec which is not in this priority list, it will be tried only if none of this list are available / supported Default is ['ec-4', 'ac-4', 'ec-3', 'mp4a.a6', 'ac-3', 'mp4a.a5', 'mp4a.40']

Since

7.6

audioLanguage?: string | string[]

Defines one or more audio languages which should be used in the specified order on start up.

autoplay?: boolean

Whether the player starts playing after loading a source or not (false, default). Note that unmuted autoplay is blocked on several browsers, check for Warning with code PLAYBACK_COULD_NOT_BE_STARTED for detecting the blocking.

isForcedSubtitle?: ((subtitle) => boolean)

Determines if the subtitle should be selected by the player per default and kept in sync with the selected audio language. The subtitle will not appear in list and can't be deactivated or activated through the API.

Per default subtitle tracks with forced=true will be selected. In case of DASH these are subtitles with the role forced_subtitle or forced-subtitle and in case of HLS subtitles with the attribute FORCED=YES.

Type declaration

    • (subtitle): boolean
    • Parameters

      Returns boolean

muted?: boolean

Whether the sound is muted on startup or not (false, default).

playsInline?: boolean

Whether to add the playsinline attribute to the video element or not. This stops videos immediately going fullscreen after starting playback on iOS for example. Default is true.

preferredTech?: PreferredTechnology[]

An array of objects to specify the player and streaming technology order to use. If the first is supported, this technologies are used. If not, the second is tried etc. If none of the specified combinations are supported, then a SOURCE_NO_SUPPORTED_TECHNOLOGY will be thrown.

Player technologies:

  • html5 refers to the MediaSource Extension (MSE) based JavaScript player
  • native refers to the browser’s native capabilities are being used, e.g. playing back HLS in Safari on iOS

Currently supported combinations:

{ player: 'html5', streaming: 'dash'}
{ player: 'html5', streaming: 'hls'}
{ player: 'html5', streaming: 'smooth'}
{ player: 'native', streaming: 'hls'}
{ player: 'native', streaming: 'progressive'}

Example:

preferredTech : [{
player: 'html5',
streaming: 'dash'
}, {
player: 'native',
streaming: 'hls'
}]
seeking?: boolean

Whether to allow seeking or not. Default is true.

subtitleLanguage?: string | string[]

Defines one or more subtitle languages which should be used in the specified order on start up.

timeShift?: boolean

Enables time shift / DVR for live streams. Default is true (enabled). If time shift is disabled (set to false), the timeline (scrub bar) will not be shown any more.

videoCodecPriority?: string[]

Specify the priority of video codecs for this source. If more than one video codec is available this order will be respected while finding a codec which is supported by the current browser. If there is a codec which is not in this priority list, it will be tried only if none of this list are available / supported. Default is ['dvhe', 'dvh1', 'vvc', 'vvi', 'av01', 'av1', 'hevc', 'hev', 'hvc', 'vp9', 'avc']

Since

7.6

volume?: number

Defines the volume level of the player when started for the first time. Default value is 100.