This commit is contained in:
Dw9 2022-09-22 21:16:56 +08:00
parent 02aad5d256
commit b782832a74

View File

@ -46,14 +46,14 @@
</p> </p>
<p> <p>
<label for="methond">methond(play or push or echo):</label> <label for="method">method(play or push or echo):</label>
<input type="radio" name="methond" value="echo" >echo <input type="radio" name="method" value="echo" >echo
<input type="radio" name="methond" value="push" >push <input type="radio" name="method" value="push" >push
<input type="radio" name="methond" value="play" checked = true>play <input type="radio" name="method" value="play" checked = true>play
</p> </p>
<p> <p>
<label for="resilution">resolution:</label> <label for="resolution">resolution:</label>
<select id="resilution"> <select id="resolution">
</select> </select>
</p> </p>
<p> <p>
@ -98,7 +98,7 @@
url = "http://127.0.0.1"+"/index/api/webrtc?app=live&stream=test&type=play" url = "http://127.0.0.1"+"/index/api/webrtc?app=live&stream=test&type=play"
} }
document.getElementById('streamUrl').value = url document.getElementById('streamUrl').value = url
document.getElementsByName("methond").forEach((el,idx)=>{ document.getElementsByName("method").forEach((el,idx)=>{
el.onclick=function(e){ el.onclick=function(e){
let url = new URL(document.getElementById('streamUrl').value); let url = new URL(document.getElementById('streamUrl').value);
url.searchParams.set("type",el.value) url.searchParams.set("type",el.value)
@ -118,14 +118,14 @@
opt = document.createElement('option'); opt = document.createElement('option');
opt.text = r.label +"("+r.width+"x"+r.height+")"; opt.text = r.label +"("+r.width+"x"+r.height+")";
opt.value = r; opt.value = r;
document.getElementById("resilution").add(opt,null) document.getElementById("resolution").add(opt,null)
//console.log(opt.text.match(/\d+/g)) //console.log(opt.text.match(/\d+/g))
}) })
function start_play(){ function start_play(){
let elr = document.getElementById("resilution"); let elr = document.getElementById("resolution");
let res = elr.options[elr.selectedIndex].text.match(/\d+/g); let res = elr.options[elr.selectedIndex].text.match(/\d+/g);
let h = parseInt(res.pop()); let h = parseInt(res.pop());
let w = parseInt(res.pop()); let w = parseInt(res.pop());
@ -204,7 +204,7 @@
function start() function start()
{ {
stop(); stop();
let elr = document.getElementById("resilution"); let elr = document.getElementById("resolution");
let res = elr.options[elr.selectedIndex].text.match(/\d+/g); let res = elr.options[elr.selectedIndex].text.match(/\d+/g);
let h = parseInt(res.pop()); let h = parseInt(res.pop());
let w = parseInt(res.pop()); let w = parseInt(res.pop());