Update to video 1.2 api

pull/1/head
Svein-Tore Griff With 2015-02-17 11:14:49 +01:00
parent d6ecc1705a
commit 061c15a2d6
1 changed files with 8 additions and 6 deletions

View File

@ -293,21 +293,23 @@ H5P.QuestionSet = function (options, contentId) {
var $videoContainer = $('<div class="video-container"></div>').appendTo($myDom);
var video = new H5P.Video({
files: videoData,
sources: videoData,
fitToWrapper: true,
controls: false,
autoplay: false
}, contentId);
video.endedCallback = function () {
displayResults();
$videoContainer.hide();
};
video.on('stateChange', function (event) {
if (event.data === H5P.Video.ENDED) {
displayResults();
$videoContainer.hide();
}
});
video.attach($videoContainer);
video.play();
if (params.endGame.skipButtonText) {
$('<a class="h5p-button skip">' + params.endGame.skipButtonText + '</a>').click(function () {
video.stop();
video.pause();
$videoContainer.hide();
displayResults();
}).appendTo($videoContainer);