Source Selection for Web Player
Updated: Tue Jul 30 02:08:55 2019, By Contribute to this page
Let us assume that the following player configuration is given and we would like to apply source selection logic.
var config = {
sources: {
hls: [
{
mimetype: 'application/x-mpegurl',
url: 'http://wowzaec2demo.streamlock.net/vod-multitrack/_definst_/smil:ElephantsDream/ElephantsDream.smil/playlist.m3u8'
}
]
},
playback: {
preferNative: {
hls: true,
dash: false
},
streamPriority: [
{
engine: 'html5',
format: 'dash'
},
{
engine: 'html5',
format: 'hls'
}
]
}
};- The player looks at the
streamPriorityarray and see that thedashstream has the highest priority. - The player will check whether it received any
dashsources within thesourcesobject. - Since there are no
dashsources in it, the player will move to the next priority from thestreamPrioritylist which ishls. - After checking the
sourcesobject again and foundhlssources, the player will choose to playhls.
However, will the player use the native HLS or not? This depends on the preferNative value for hls. Because this value is set to true, the player knows that if the browser supports native hls playback, the source will be played natively.
Given the configuration information above, which source will be played in each browser?
Following summarize the results for this scenario:
| Chrome | Safari | Firefox | Edge |
|---|---|---|---|
HLS with hls.js |
native HLS | HLS with hls.js |
native HLS |