Add play audio feature to links page

This commit is contained in:
Alexey Khit
2023-02-17 13:06:58 +03:00
parent df5f585064
commit 3f22c010ce
+14
View File
@@ -41,10 +41,24 @@
<body>
<script src="main.js"></script>
<div id="links"></div>
<div id="audio">
<h2>Play audio</h2>
<input id="source" type="text" placeholder="source">
<a id="send" href="#">send</a> / cameras with two way audio support
</div>
<script>
const params = new URLSearchParams(location.search);
const src = params.get("src");
document.querySelector("#send")
.addEventListener("click", () => {
const source = document.querySelector("#source");
const url = new URL("api/streams", location.href);
url.searchParams.set("dst", src);
url.searchParams.set("src", source.value);
fetch(url, {method: "POST"});
});
const links = document.querySelector("#links");
links.innerHTML = `
<h2>Any codec in source</h2>