async function initializePlayer(id, url, drmKey, enableCustomConfig) {
const video = document.getElementById(id);
const ui = video['ui'];
const controls = ui.getControls();
const player = controls.getPlayer();
const config = {
'controlPanelElements': ['time_and_duration','playback_rate','mute','spacer','captions','language' ,'quality','fullscreen'],
'playbackRates': [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2],
'seekBarColors': {base: 'rgba(255,255,255,.2)', buffered: 'rgba(255,255,255,.4)', played: 'rgb(255,0,0)'} };
ui.configure(config);
player.configure({drm: {clearKeys: drmKey}});
window.player = player;
window.ui = ui;
player.addEventListener('error', onPlayerErrorEvent);
controls.addEventListener('error', onUIErrorEvent);
if (enableCustomConfig) {
player.configure('manifest.dash.ignoreMinBufferTime', true);
player.configure('streaming.rebufferingGoal', 5 /* second */);
}
try {
await player.load(url);
console.log('The video has now been loaded!');
} catch (error) {
onPlayerError(error);
}
}
function onPlayerErrorEvent(errorEvent) {
onPlayerError(errorEvent.detail);
}
function onPlayerError(error) {
console.error('Error code', error.code, 'object', error);
}
function onUIErrorEvent(errorEvent) {
onPlayerError(errorEvent.detail);
}
document.addEventListener('shaka-ui-loaded', function() {
initializePlayer('dazn1_spain', 'https://live.ll.ww.aiv-cdn.net/OTTB/dub-nitro/live/clients/dash/enc/bmnelo5c7a/out/v1/3ce2cdc4589f46189322bd3717c77957/cenc.mpd', {'44dd9cd370b08a868ead115fe84ecfde':'bff19ab0a51cf14e848389b152913fd0'});
initializePlayer('dazn2_spain', 'https://live.ll.ww.aiv-cdn.net/OTTB/dub-nitro/live/clients/dash/enc/xnk4m9bnxt/out/v1/4ced7b7329a54652b9bb0521ed38bd4d/cenc.mpd', {'0eab5a3f3e3b4ba5d42d40ca30d17571':'f3f061ded9b70e8160590d5802ecda6d'});
initializePlayer('vextra', 'https://cors-proxy.pulsesoftware.com/https://director.streaming.telia.com/tvm-packager-prod/group3/60ae4f5e1522bd739f6959a1/manifest.mpd', {'bc972382f04c531983b7aab6bf642ad8': 'ddfd212680eb891b755610eac5becf85'});
initializePlayer('skycalcio', 'https://linear302-it-dash1-prd-ll.cdn13.skycdp.com/016a/31209/FHD/skysportseriea/master.mpd', {'0036e5d0e88dfb087f1791da6150ced9': '0bc653d830837dceb13bd17169f0f8e2'});
initializePlayer('orange3', 'https://ott1.cyberhost.ro/sdash/LIVE$DolceSport3/index.mpd/Manifest?start=LIVE&end=END&device=MPD-LIVE-PC-Widevine-HD-ENC', {'b87857ba74ce03f9fa2866f1e086d05d': '1cd289ac71ce5fb306a5e7653192ce3a'});
initializePlayer('ss4', 'https://dsgtq5sngxkde.cloudfront.net/live/eds/Sportstar4/sa_dash_vmx/Sportstar4.mpd', {'a07dc4d86f51db7195f4b7e2abe9d9e8': 'b81b1942c65f35547ced1bff074206a5'});
});