Rewrite JS player for better integration

This commit is contained in:
Alexey Khit
2023-01-02 16:33:00 +03:00
parent 4157a53dd8
commit 6d6e7010b4
3 changed files with 279 additions and 185 deletions
+5 -4
View File
@@ -3,13 +3,13 @@
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>go2rtc - Stream</title>
<script src="video-rtc.js"></script>
<style>
body {
background: black;
margin: 0;
padding: 0;
display: flex;
font-family: Arial, Helvetica, sans-serif;
}
html, body {
@@ -25,7 +25,8 @@
</style>
</head>
<body>
<script>
<script type="module" src="./video-stream.js"></script>
<script type="module">
const params = new URLSearchParams(location.search);
// support multiple streams and multiple modes
@@ -48,8 +49,8 @@
const width = "1 0 " + (params.get("width") || "320px");
for (let i = 0; i < streams.length; i++) {
/** @type {VideoRTC} */
const video = document.createElement("video-rtc");
/** @type {VideoStream} */
const video = document.createElement("video-stream");
video.background = background;
video.mode = modes[i] || video.mode;
video.style.flex = width;