z
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
temp
|
||||||
|
logs
|
@@ -16,17 +16,23 @@ events {
|
|||||||
rtmp {
|
rtmp {
|
||||||
server {
|
server {
|
||||||
listen 1935;
|
listen 1935;
|
||||||
|
chunk_size 4096;
|
||||||
|
|
||||||
application live {
|
application live {
|
||||||
live on;
|
live on;
|
||||||
|
record off;
|
||||||
|
hls on;
|
||||||
|
hls_path temp/hls;
|
||||||
|
hls_fragment 1s;
|
||||||
|
hls_playlist_length 10s;
|
||||||
}
|
}
|
||||||
|
|
||||||
application hls {
|
# application hls {
|
||||||
live on;
|
# live on;
|
||||||
hls on;
|
# hls on;
|
||||||
hls_path temp/hls;
|
# hls_path temp/hls;
|
||||||
hls_fragment 8s;
|
# hls_fragment 8s;
|
||||||
}
|
# }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,6 +100,25 @@ http {
|
|||||||
#}
|
#}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# hls
|
||||||
|
server {
|
||||||
|
listen 8080; # A non-standard port is good for local services.
|
||||||
|
|
||||||
|
location /hls {
|
||||||
|
# Serve HLS files
|
||||||
|
types {
|
||||||
|
application/vnd.apple.mpegurl m3u8;
|
||||||
|
video/mp2t ts;
|
||||||
|
}
|
||||||
|
# The path here MUST match the hls_path from the rtmp block
|
||||||
|
alias temp/hls;
|
||||||
|
|
||||||
|
# Add headers to prevent caching and allow cross-domain playback
|
||||||
|
add_header Cache-Control 'no-cache';
|
||||||
|
add_header Access-Control-Allow-Origin '*' always;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# another virtual host using mix of IP-, name-, and port-based configuration
|
# another virtual host using mix of IP-, name-, and port-based configuration
|
||||||
#
|
#
|
||||||
|
@@ -1,25 +1,31 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Welcome to nginx!</title>
|
<title>HLS Player Test</title>
|
||||||
<style>
|
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
|
||||||
body {
|
|
||||||
width: 35em;
|
|
||||||
margin: 0 auto;
|
|
||||||
font-family: Tahoma, Verdana, Arial, sans-serif;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Welcome to nginx!</h1>
|
<h1>Live Stream</h1>
|
||||||
<p>If you see this page, the nginx web server is successfully installed and
|
<video id="video" width="80%" controls></video>
|
||||||
working. Further configuration is required.</p>
|
|
||||||
|
|
||||||
<p>For online documentation and support please refer to
|
<script>
|
||||||
<a href="http://nginx.org/">nginx.org</a>.<br/>
|
var video = document.getElementById('video');
|
||||||
Commercial support is available at
|
// ** CHANGE THIS URL TO YOUR STREAM URL **
|
||||||
<a href="http://nginx.com/">nginx.com</a>.</p>
|
var videoSrc = 'https://hls.talldoor.uk/hls/sxlxc.m3u8';
|
||||||
|
|
||||||
<p><em>Thank you for using nginx.</em></p>
|
if (Hls.isSupported()) {
|
||||||
|
var hls = new Hls();
|
||||||
|
hls.loadSource(videoSrc);
|
||||||
|
hls.attachMedia(video);
|
||||||
|
hls.on(Hls.Events.MANIFEST_PARSED, function() {
|
||||||
|
video.play();
|
||||||
|
});
|
||||||
|
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||||
|
video.src = videoSrc;
|
||||||
|
video.addEventListener('loadedmetadata', function() {
|
||||||
|
video.play();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Reference in New Issue
Block a user