diff --git a/js/h5p.js b/js/h5p.js index d50855a..c2a7457 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -15,7 +15,7 @@ H5P.init = function () { H5P.getContentPath = function(contentId) { // TODO: Rewrite or remove... H5P.getContentPath = H5PIntegration.getContentPath would probably work f.i. return H5PIntegration.getContentPath(contentId); -} +}; // // Used from libraries to construct instances of other libraries' objects by @@ -58,6 +58,57 @@ H5P.Coords = function(x, y, w, h) { return this; }; +// Play a video. $target is jQuery object to attach video to. (Appended). +// Params are video-params from content. cp is content path. onEnded is +// function to call when finished. +// +// TODO: Try to get rid of content path. +H5P.playVideo = function ($target, params, cp, onEnded) { + var $ = H5P.jQuery; + + var $container = $('
').css({ + position: "absolute", + top: "0px", + left: "0px", + "z-index": "500" + }); + var $video; + var sources = ''; + for (var key in params) { + sources += '