diff --git a/config/frontend/config.yml.dist b/config/frontend/config.yml.dist index f3b2a6f..8bb1d43 100644 --- a/config/frontend/config.yml.dist +++ b/config/frontend/config.yml.dist @@ -18,7 +18,7 @@ stat_url : http://rtmp:18080/stat # web protocol - used for generating hls and internal links. # change this to https if you are using https for example via traefik in front of this setup -web_proto: http +web_proto: https # if you want to add another template you can place it in the "templates" folder # leave it at "default" to use the included default template diff --git a/frontend/app/templates/default/main.html.j2 b/frontend/app/templates/default/main.html.j2 index e9fb218..bd2e2e7 100644 --- a/frontend/app/templates/default/main.html.j2 +++ b/frontend/app/templates/default/main.html.j2 @@ -27,21 +27,17 @@ - RTMP + RTMP url rtmp://{{ configuration["rtmp_base"] }}/{{ item[0] }}/{{ item[1] }} -
RTMP
+
RTMP
- HTTP-FLV - {{ configuration["web_proto"] }}://{{ configuration["base_url"] }}/flv?app={{ item[0] }}&stream={{ item[1] }} -
HTTP-FLV
+ HLS m3u8 + {{ configuration['web_proto'] }}://{{ configuration['base_url'] }}/hls/{{ item[1] }}/index.m3u8 +
HLS.js
- - ▷ Web Player - {% endfor %} diff --git a/frontend/app/templates/default/player.html.j2 b/frontend/app/templates/default/player.html.j2 index faa1781..4cb0e43 100644 --- a/frontend/app/templates/default/player.html.j2 +++ b/frontend/app/templates/default/player.html.j2 @@ -22,7 +22,7 @@ var hls = new Hls({ debug: true, }); - hls.loadSource("{{ configuration['web_proto'] }}://{{ configuration['base_url'] }}/hls/{{ streamname }}/index.m3u8'); + hls.loadSource("{{ configuration['web_proto'] }}://{{ configuration['base_url'] }}/hls/{{ streamname }}/index.m3u8"); hls.attachMedia(video); hls.on(Hls.Events.MEDIA_ATTACHED, function () { video.muted = true; @@ -33,7 +33,7 @@ // When the browser has built-in HLS support (check using `canPlayType`), we can provide an HLS manifest (i.e. .m3u8 URL) directly to the video element throught the `src` property. // This is using the built-in support of the plain video element, without using hls.js. else if (video.canPlayType('application/vnd.apple.mpegurl')) { - video.src = "{{ configuration['web_proto'] }}://{{ configuration['base_url'] }}/hls/{{ streamname }}/index.m3u8'"; + video.src = "{{ configuration['web_proto'] }}://{{ configuration['base_url'] }}/hls/{{ streamname }}/index.m3u8"; video.addEventListener('canplay', function () { video.play(); }); diff --git a/frontend/app/zomstream.py b/frontend/app/zomstream.py index 26d004a..6ab7b6d 100644 --- a/frontend/app/zomstream.py +++ b/frontend/app/zomstream.py @@ -53,22 +53,22 @@ class Zomstream: app = streamName[0] name = streamName[1] - flv_url = self.getFlvUrl (app,name) + hls_url = self.getHlsUrl (app,name) rtmp_url = self.getRtmpUrl(app,name) - urls.append({'url': flv_url, 'type':'http_flv'}) + urls.append({'url': hls_url, 'type':'hls'}) urls.append({'url': rtmp_url,'type':'rtmp'}) stream = Stream(app=app, name=name, urls=urls) streams.append(stream.__dict__) return streams - def getFlvUrl(self,app_name,stream_name): - return '%s://%s/flv?app=%s&stream=%s' % ( + def getHlsUrl(self,app_name,stream_name): + return '%s://%s/hls/%s/index.m3u8' % ( self.configuration['web_proto'], self.configuration['base_url'], - app_name, stream_name) + def getRtmpUrl(self,app_name,stream_name): return "rtmp://%s/%s/%s" % ( self.configuration['rtmp_base'],