From 69b83475a898b511d4e26544f2d0b4a09940c3ea Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Mon, 18 Jan 2016 19:44:34 +0100 Subject: remove superflous asset controller function. if http-authentication is directed do an redirect to same page without authentication. --- mediabrowser/templates/watch.html | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'mediabrowser/templates/watch.html') diff --git a/mediabrowser/templates/watch.html b/mediabrowser/templates/watch.html index 808e372..db7ab6e 100644 --- a/mediabrowser/templates/watch.html +++ b/mediabrowser/templates/watch.html @@ -2,8 +2,8 @@ Watch - {{ filename }} - - + + @@ -11,21 +11,21 @@
- +
HLS with transcoding
- +
Inline
- +
Download
@@ -64,13 +64,22 @@ levelLoadingTimeOut: 20000, fragLoadingTimeOut: 120000 }; + video.setAttribute('poster', + "{{ url_for('mediabrowser.poster', path=path) }}"); var hls = new Hls(config); + hls.on(Hls.Events.MANIFEST_LOADED, function(event, data) { + // test if url contains authentication (http://user:pass@host/) + var authUrl = /(http?:\/\/)[^\/]*@([^\/]+\/.*)/.exec(data.url) + if (authUrl) { + // redirect to same page without authentication. + // hls.js fails otherwise in src/utils/url.js #buildAbsoluteURL() + window.location = window.location.href; + } + }); hls.loadSource("{{ url_for('mediabrowser.m3u8', path=path) }}"); hls.attachMedia(video); hls.on(Hls.Events.MANIFEST_PARSED, function (event, data) { video.play(); - video.setAttribute('poster', - "{{ url_for('mediabrowser.poster', path=path) }}"); }); hls.on(Hls.Events.ERROR, function (event, data) { if (data.fatal) { -- cgit v1.2.1