diff --git a/roles/nginx-rtmp/files/index.html b/roles/nginx-rtmp/files/index.html index 3f0323cc..24c9c749 100644 --- a/roles/nginx-rtmp/files/index.html +++ b/roles/nginx-rtmp/files/index.html @@ -15,16 +15,42 @@
-rtmp://stream.adm.crans.org/live
,rtmps://stream.adm.crans.org:1935/live
,
ffmpeg -re -i mavideo.webm -vcodec libx264 -vprofile baseline
-acodec aac -strict -2 -f flv
- rtmp://stream.adm.crans.org/live/identifiant
+ rtmps://stream.adm.crans.org:1935/live/identifiant
@@ -99,7 +125,7 @@
const streamUrl = `/hls/${streamId}.m3u8`
document.getElementById("linkStream").href = streamUrl
- // If stream exists, then load
+ // Create player
const player = videojs('my-video', {
controls: true,
autoplay: true,
@@ -109,21 +135,32 @@
aspectRatio: '16:9'
})
- fetch(streamUrl, {
- method: 'HEAD',
- cache: 'no-cache'
- }).then((response) => {
- if (response.ok) {
- // Stream exists, load!
- player.src({
- type: 'application/x-mpegURL',
- src: streamUrl
- });
- } else {
- // Stream does not exist, alert!
- player.poster('/no-stream.jpg')
- }
- });
+ function loadStream() {
+ fetch(streamUrl, {
+ method: 'HEAD',
+ cache: 'no-cache'
+ }).then((response) => {
+ if (response.ok) {
+ // Stream exists, load!
+ player.poster()
+ player.src({
+ type: 'application/x-mpegURL',
+ src: streamUrl
+ })
+ } else {
+ // Stream does not exist, alert!
+ player.poster('/no-stream.jpg')
+ }
+ })
+ }
+
+ $(document).ready(function () {
+ loadStream()
+
+ document.getElementById("refreshStream").addEventListener("click", function(){
+ loadStream()
+ })
+ })