Optimize index file

This commit is contained in:
Deepslient 2023-10-06 19:16:04 +08:00
parent cd1fae2acb
commit f72358518f
1 changed files with 3 additions and 3 deletions

View File

@ -93,8 +93,8 @@
var recvOnly = true; var recvOnly = true;
var resArr = []; var resArr = [];
var ishttps = 'https:' == document.location.protocol ? true : false; var ishttps = 'https:' === document.location.protocol;
var isLocal = "file:" == document.location.protocol ? true : false; var isLocal = "file:" === document.location.protocol;
const searchParams = new URL(document.location.href).searchParams; const searchParams = new URL(document.location.href).searchParams;
let type = searchParams.get('type'); let type = searchParams.get('type');
@ -105,7 +105,7 @@
const apiPath = `/index/api/webrtc?app=${searchParams.get('app') ?? 'live'}&stream=${searchParams.get('stream') ?? 'test'}&type=${type}`; const apiPath = `/index/api/webrtc?app=${searchParams.get('app') ?? 'live'}&stream=${searchParams.get('stream') ?? 'test'}&type=${type}`;
if(!ishttps && !isLocal){ if(!ishttps && !isLocal){
alert('本demo需要在https的网站访问 ,如果你要推流的话(this demo must access in site of https if you want push stream)'); alert('本demo需要在https的网站访问, 如果你要推流的话(this demo must access in site of https if you want to push stream)');
} }
const apiHost = isLocal ? "http://127.0.0.1" : `${document.location.protocol}//${window.location.host}`; const apiHost = isLocal ? "http://127.0.0.1" : `${document.location.protocol}//${window.location.host}`;