diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2016-01-18 19:44:34 +0100 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2016-01-18 19:49:58 +0100 |
commit | 69b83475a898b511d4e26544f2d0b4a09940c3ea (patch) | |
tree | fb95c909879c5d6d8cb4b84581a387b07c00812e /mediabrowser/templates/watch.html | |
parent | 0b91c6c444a83c8d8f93ae29882a485858c95c5f (diff) | |
download | flask-mediabrowser-69b83475a898b511d4e26544f2d0b4a09940c3ea.tar.gz flask-mediabrowser-69b83475a898b511d4e26544f2d0b4a09940c3ea.zip |
remove superflous asset controller function.
if http-authentication is directed do an redirect to
same page without authentication.
Diffstat (limited to 'mediabrowser/templates/watch.html')
-rw-r--r-- | mediabrowser/templates/watch.html | 23 |
1 files changed, 16 insertions, 7 deletions
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 @@ <html> <head> <title>Watch - {{ filename }}</title> - <script src="{{url_for('mediabrowser.assets', filename='hls.min.js')}}"></script> - <link rel="stylesheet" href="{{ url_for('mediabrowser.assets', filename='style.css') }}"/> + <script src="{{url_for('mediabrowser.static', filename='hls.js/hls.min.js')}}"></script> + <link rel="stylesheet" href="{{ url_for('mediabrowser.static', filename='style.css') }}"/> </head> <body class="watch"> <video controls id="video"></video> @@ -11,21 +11,21 @@ <div id="infos"> <a href="{{ url_for('mediabrowser.m3u8', path=path) }}"> <div> - <img src="{{ url_for('mediabrowser.assets', filename='playlist.png') }}"/> + <img src="{{ url_for('mediabrowser.static', filename='playlist.png') }}"/> <br/> HLS with transcoding </div> </a> <a href="{{ url_for('mediabrowser.download_inline', path=path) }}"> <div> - <img src="{{ url_for('mediabrowser.assets', filename='playlist.png') }}"/> + <img src="{{ url_for('mediabrowser.static', filename='playlist.png') }}"/> <br/> Inline </div> </a> <a href="{{ url_for('mediabrowser.download', path=path) }}"> <div> - <img src="{{ url_for('mediabrowser.assets', filename='playlist.png') }}"/> + <img src="{{ url_for('mediabrowser.static', filename='playlist.png') }}"/> <br/> Download </div> @@ -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) { |