Be sure to update the ip_address with the ip address of your server.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Live Cam</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<video id="video1" autoplay controls="controls"></video>
<script>
if (Hls.isSupported()) {
var video1 = document.getElementById('video1');
var hls1 = new Hls();
// bind them together
hls1.attachMedia(video1);
hls1.on(Hls.Events.MEDIA_ATTACHED, function () {
console.log("video and hls.js are now bound together !");
hls1.loadSource("http://ip_address/live/stream1/mystream.m3u8");
hls1.on(Hls.Events.MANIFEST_PARSED, function (event, data) {
console.log("manifest loaded, found " + data.levels.length + " quality level");
});
});
}
</script>
<video id="video2" autoplay controls="controls"></video>
<script>
if (Hls.isSupported()) {
var video2 = document.getElementById('video2');
var hls2 = new Hls();
// bind them together
hls2.attachMedia(video2);
hls2.on(Hls.Events.MEDIA_ATTACHED, function () {
console.log("video and hls.js are now bound together !");
hls2.loadSource("http://ip_address/live/stream2/mystream.m3u8");
hls2.on(Hls.Events.MANIFEST_PARSED, function (event, data) {
console.log("manifest loaded, found " + data.levels.length + " quality level");
});
});
}
</script>
<video id="video3" autoplay controls="controls"></video>
<script>
if (Hls.isSupported()) {
var video3 = document.getElementById('video3');
var hls3 = new Hls();
// bind them together
hls3.attachMedia(video3);
hls3.on(Hls.Events.MEDIA_ATTACHED, function () {
console.log("video and hls.js are now bound together !");
hls3.loadSource("http://ip_address/live/stream3/mystream.m3u8");
hls3.on(Hls.Events.MANIFEST_PARSED, function (event, data) {
console.log("manifest loaded, found " + data.levels.length + " quality level");
});
});
}
</script>
<video id="video4" autoplay controls="controls"></video>
<script>
if (Hls.isSupported()) {
var video4 = document.getElementById('video4');
var hls4 = new Hls();
// bind them together
hls4.attachMedia(video4);
hls4.on(Hls.Events.MEDIA_ATTACHED, function () {
console.log("video and hls.js are now bound together !");
hls4.loadSource("http://ip_address/live/stream4/mystream.m3u8");
hls4.on(Hls.Events.MANIFEST_PARSED, function (event, data) {
console.log("manifest loaded, found " + data.levels.length + " quality level");
});
});
}
</script>
</body>
</html>