-
Notifications
You must be signed in to change notification settings - Fork 241
/
demo.js
36 lines (31 loc) · 1.26 KB
/
demo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var conf = {
key: '<YOUR PLAYER KEY>'
};
var source = {
dash: 'https://bitmovin-a.akamaihd.net/498364_fcb0257026d0bd3ee0ba3aad95674188/manifest.mpd',
hls: 'https://bitmovin-a.akamaihd.net/498364_fcb0257026d0bd3ee0ba3aad95674188/playlist.m3u8',
poster: 'https://bitmovin-a.akamaihd.net/498364_fcb0257026d0bd3ee0ba3aad95674188/poster.jpg'
};
var hidden = false;
var played = false;
var playerContainer = document.getElementById('player-container');
bitmovin.player.Player.addModule(bitmovin.analytics.PlayerModule);
var player = new bitmovin.player.Player(playerContainer, conf);
player.load(source).then(function () {
player.on(bitmovin.player.PlayerEvent.TimeChanged, function (data) {
if (player.getCurrentTime() >= 29.081333 && player.getCurrentTime() < 41.138666) {
document.getElementsByClassName('bmpui-ui-container bmpui-controlbar-top')[0].style.display = 'none';
hidden = true;
played = true;
} else if (hidden) {
document.getElementsByClassName('bmpui-ui-container bmpui-controlbar-top')[0].style.display = 'block';
}
});
player.on(bitmovin.player.PlayerEvent.Seek, function (data) {
if (data.seekTarget > 29 && !played
) {
player.seek(29);
played = true;
}
});
});