diff options
Diffstat (limited to '')
-rw-r--r-- | assets/js/lustiges-script.js | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/assets/js/lustiges-script.js b/assets/js/lustiges-script.js index 1693cbd..3af4250 100644 --- a/assets/js/lustiges-script.js +++ b/assets/js/lustiges-script.js @@ -1,5 +1,18 @@ // mediaelement-player $(function() { + function deserialize(string) { + var result = {}; + if (string) { + var parts = string.split(/&|\?/); + for (var i = 0; i < parts.length; i++) { + var part = parts[i].split("="); + if (part.length === 2) + result[decodeURIComponent(part[0])] = decodeURIComponent(part[1]); + } + } + return result; + } + (function(strings) { strings['en-US'] = { 'Download File': 'Open Stream in Desktop-Player' @@ -36,7 +49,7 @@ $(function() { var player = new Clappr.Player({ baseUrl: 'assets/clapprio/', plugins: { - core: [ClapprThumbnailsPlugin] + core: [ClapprThumbnailsPlugin, PlaybackRatePlugin] }, source: $relivePlayer.data('m3u8'), @@ -50,9 +63,14 @@ $(function() { }, events: { onReady: function() { - var playback = player.getPlugin('hls'); + var playback = player.core.getCurrentContainer().playback; + var params = deserialize(location.href) + playback.once(Clappr.Events.PLAYBACK_PLAY, function() { - if(player.getPlugin('hls').getPlaybackType() == 'vod') { + var seek = parseFloat(params.t); + if (!isNaN(seek)) { + player.seek(seek); + } else if (playback.getPlaybackType() == 'vod') { // skip forward to scheduled beginning of the talk at ~ 0:14:30 (30 sec offset, if speaker starts on time) player.seek(14 * 60 + 30); } |