From ef213f16a712ff8f12dcdb8192f2bd315661fc81 Mon Sep 17 00:00:00 2001 From: xgj Date: Fri, 17 Sep 2021 11:59:01 +0800 Subject: [PATCH] warning when access rtc demo when http site and auto get url of site to anti mistake operation --- www/webrtc/index.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/www/webrtc/index.html b/www/webrtc/index.html index b2d52e6d..9a1764f1 100644 --- a/www/webrtc/index.html +++ b/www/webrtc/index.html @@ -69,6 +69,19 @@ var recvOnly = true var resArr = [] + var ishttps = 'https:' == document.location.protocol ? true : false + var isLocal = "file:" == document.location.protocol ? true : false + var url = document.location.protocol+"//"+window.location.host+"/index/api/webrtc?app=live&stream=test&type=play" + + + if(!ishttps && !isLocal){ + alert('本demo需要在https的网站访问 (this demo must access in site of https)') + } + + if(isLocal){ + url = "http://127.0.0.1"+"/index/api/webrtc?app=live&stream=test&type=play" + } + document.getElementById('streamUrl').value = url document.getElementsByName("methond").forEach((el,idx)=>{ el.onclick=function(e){ if(el.value == "play")