Created
July 26, 2017 18:35
-
-
Save oboshto/488d3eed445a9084cb9cf1359af91cd9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by dsi on 11.05.2015. | |
*/ | |
(function() { | |
var player = dashjs.MediaPlayer().create(); | |
playerAd = dashjs.MediaPlayer().create(); | |
contentUrl = 'http://vm2.dashif.org/livesim/scte35_1/testpic_2s/Manifest.mpd ', | |
adUrl = 'http://dash.edgesuite.net/fokus/adinsertion-samples/scte/dash.mpd', | |
currentlyAd = false; | |
player.initialize(document.querySelector("#vid"), contentUrl, true); | |
player.on('urn:scte:scte35:2013:xml',scteEvent,this); | |
playerAd.initialize(document.querySelector("#vidAd"), adUrl, false); | |
function scteEvent(e) { | |
if(!currentlyAd) { | |
startAd(); | |
} | |
else { | |
removeAd(); | |
} | |
currentlyAd = !currentlyAd; | |
} | |
function removeEvent(e) { | |
} | |
function startAd() { | |
$('#vid').css({ | |
'display':'none' | |
}); | |
$('#vid').prop('muted',true); | |
$('#vidAd').css({ | |
'display':'block' | |
}); | |
$('#vidAd').prop('muted',false); | |
playerAd.play(); | |
} | |
function removeAd() { | |
$('#vid').css({ | |
'display':'block' | |
}); | |
$('#vid').prop('muted',false); | |
$('#vidAd').css({ | |
'display':'none' | |
}); | |
$('#vidAd').prop('muted',true); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment