Compare commits

...

2 Commits

Author SHA1 Message Date
9cb4300004 merge commit 2018-03-09 22:12:10 +05:30
bc374ef513 video auutoplay, reset video 2018-03-09 22:11:27 +05:30

View File

@ -9,7 +9,8 @@ init()
function init() {
document.querySelectorAll('.slide').forEach(function(slide) {
slides.push(slide)
var data = slideData[slides.length - 1] = load_slide(slide)
var data = slideData[slides.length - 1] = load_slide(slide);
data.idx = slides.length - 1;
if (data.video && data.video.length) {
data.embed = init_embed(data)
}
@ -62,7 +63,7 @@ function stop(idx) {
if (data.zoom_to) {
reset_zoom(data)
} else if (data.video && data.video.length) {
pause_video(data)
reset_video(data)
}
}
@ -93,12 +94,19 @@ function load_slide(slide) {
function init_embed(data) {
var embed = window.currentEmbed = new PandoraEmbed({
id: 'fixme',
id: 'slide-' + data.idx,
url: data.video[0],
container: data.container
});
embed.on('init', function(data) {
});
embed.on('playing', function(positionData) {
if (!slideData[data.idx].start) {
slideData[data.idx].start = positionData.position;
}
});
return embed;
}
@ -135,9 +143,10 @@ function start_video(data) {
})
}
function pause_video(data) {
function reset_video(data) {
data.embed.postMessage('options', {
'paused': true
'paused': true,
'position': data.start || 0
})
}