From c18c8cfd944b0c0f2892edd63208d8b3729c9c90 Mon Sep 17 00:00:00 2001 From: xiongguangjie Date: Sat, 16 Oct 2021 19:33:48 +0800 Subject: [PATCH] for rtc client demo add methond echo (#1167) --- www/webrtc/index.html | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/www/webrtc/index.html b/www/webrtc/index.html index 9a1764f1..a72bac29 100644 --- a/www/webrtc/index.html +++ b/www/webrtc/index.html @@ -46,7 +46,8 @@

- + + echo push play

@@ -84,17 +85,15 @@ document.getElementById('streamUrl').value = url document.getElementsByName("methond").forEach((el,idx)=>{ el.onclick=function(e){ - if(el.value == "play") - { - let url = document.getElementById('streamUrl').value; - - document.getElementById('streamUrl').value = url.replace("&type=push","&type=play"); + let url = new URL(document.getElementById('streamUrl').value); + url.searchParams.set("type",el.value) + document.getElementById('streamUrl').value = url.toString() + + if(el.value == "play"){ recvOnly = true; - } - else - { - let url = document.getElementById('streamUrl').value; - document.getElementById('streamUrl').value = url.replace("&type=play","&type=push"); + }else if(el.value == "echo"){ + recvOnly = false; + }else{ recvOnly = false; } };