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