DEVELOPMENT: Use H5P.playVideo
parent
45d59b82fe
commit
511bf37c1f
|
@ -205,42 +205,17 @@ H5P.QuestionSet = function (options, contentId) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var $video;
|
|
||||||
if (params.endGame.animations.showAnimations) {
|
if (params.endGame.animations.showAnimations) {
|
||||||
var sources = "";
|
|
||||||
var videoData = success ? params.endGame.animations.successVideo : params.endGame.animations.failVideo;
|
var videoData = success ? params.endGame.animations.successVideo : params.endGame.animations.failVideo;
|
||||||
|
|
||||||
if (videoData) {
|
if (videoData) {
|
||||||
for (var key in videoData) {
|
H5P.playVideo($myDom, videoData, cp, function () {
|
||||||
sources += '<source src="' + cp + videoData[key] + '" type="' + key + '">';
|
|
||||||
}
|
|
||||||
// TODO: Width/height from somewhere.
|
|
||||||
// TODO: Embed media player fallback for IE.
|
|
||||||
$video = $('<video width="635" height="500">' + sources + '</video>');
|
|
||||||
if ($video[0].canPlayType === undefined) {
|
|
||||||
// Video is not supported. Skip to result page.
|
|
||||||
displayResults();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$video[0].autoplay = false;
|
|
||||||
$video[0].load();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start video.
|
|
||||||
$myDom.html($video);
|
|
||||||
$video.on('play', function(ev) {
|
|
||||||
console.log('Video started playing!!!');
|
|
||||||
}).on('ended', function(ev) {
|
|
||||||
console.log('Video is finished, quitting now!');
|
|
||||||
// On animation finished:
|
|
||||||
displayResults();
|
displayResults();
|
||||||
});
|
});
|
||||||
// Press play on tape!
|
return;
|
||||||
$video[0].play();
|
}
|
||||||
} else {
|
}
|
||||||
// Trigger finished event.
|
// Trigger finished event.
|
||||||
displayResults();
|
displayResults();
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Function for attaching the multichoice to a DOM element.
|
// Function for attaching the multichoice to a DOM element.
|
||||||
|
|
Loading…
Reference in New Issue