Skip to content

Instantly share code, notes, and snippets.

@ZipFile
Last active May 16, 2022 21:23
Show Gist options
  • Save ZipFile/a96f3b87559d1c47549c843ab17a56c4 to your computer and use it in GitHub Desktop.
Save ZipFile/a96f3b87559d1c47549c843ab17a56c4 to your computer and use it in GitHub Desktop.
DIY stream testing
<!doctype html>
<html>
<head>
<title>Stream Testing</title>
<script defer src="http://cdn.dashjs.org/latest/dash.all.min.js"></script>
<style>
:root {background: black; color: #ccc;}
body {margin: 0;}
video {width: 100%; height: 100%;}
</style>
</head>
<body>
<video id="player" data-dashjs-player autoplay controls></video>
<script>
const url = new URL(document.location.href);
const src = url.searchParams.get("src");
const key = url.searchParams.get("key");
const player = document.getElementById("player");
player.src = key ? `dash/${key}.mpd` : src;
</script>
</body>
</html>
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record off;
hls on;
hls_path /tmp/hls;
dash on;
dash_path /tmp/dash;
deny play all;
}
}
}
server {
listen 80;
listen [::]:80;
server_name example.com;
location / {
root /srv/stream; # index.html goes here
}
location /stat {
rtmp_stat all;
}
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /tmp;
add_header Cache-Control no-cache;
}
location /dash {
root /tmp;
add_header Cache-Control no-cache;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment