Multi-technology support
Provide a single source in multiple formats and let the player pick the one it can play
A single source can list several resources of different types. When the source is played, Player Web X automatically selects the resource it can play in the current environment. This lets you ship one source configuration that works across browsers, instead of detecting the environment yourself and building a different source config for each one.
const player = bitmovin.playerx.Player({
key: 'YOUR-PLAYER-KEY',
defaultContainer: document.getElementById("player-container")
});
const sourceConfig = {
resources: [
{ url: 'https://.../stream.mpd', type: 'dash' },
{ url: 'https://.../master.m3u8', type: 'hls' },
{ url: 'https://.../fallback.mp4', type: 'progressive' },
],
}
const sourceApi = player.sources.add(sourceConfig);
sourceApi.play();How the player selects a resource
The player walks the resources array in order and plays the first resource it can handle in the current environment. The order you list resources in is therefore your fallback preference - put the format you prefer first.
For each resource, the player assembles the technology needed to play it:
- A manifest technology parses the stream (the HLS or DASH parser). Progressive resources have no manifest, so they skip this step.
- A presentation technology renders it. This is either Media Source Extensions (MSE), where the player feeds media to its own
SourceBuffer, or the browser's native<video>element.
If the current environment supports a valid combination for a resource, that resource is selected. Otherwise the player moves on to the next resource in the array. MSE-based playback is preferred, with native <video> playback used as the fallback.
What each resource type needs
A resource type can only be selected if the bundle you load includes the technology that handles it. Progressive playback uses the browser's <video> element and is available in every bundle that supports playback.
type | How it is played | Provided by bundle |
|---|---|---|
'hls' | HLS manifest parsed and played via MSE (or natively) | Hls, Playback, BitmovinV8 |
'dash' | DASH manifest parsed and played via MSE | Dash, Playback, BitmovinV8 |
'progressive' | Played directly by the browser's native <video> element | any bundle with playback |
HLS/DASH fallback needs a bundle that includes bothThe
Hlsbundle only registers the HLS technology, and theDashbundle only registers the DASH technology. If you list adashresource while using theHlsbundle, that resource can never be selected - and if no resource in the source resolves, the player simply stays idle with no error. To fall back between HLS and DASH, load thePlaybackorBitmovinV8bundle (or a custom bundle that includes both manifest packages).
Notes and limitations
- Every resource must declare its
type. See Resource types. - Listing multiple resources of the same type is allowed, but only the first one that resolves is used.
Updated 21 days ago