修复了非安全环境下客机浏览不了的问题
This commit is contained in:
parent
bee67543dd
commit
1f5d2e06c3
@ -11,11 +11,20 @@ const peerConfig = { iceServers: [{ urls: "stun:stun.l.google.com:19302" }] };
|
||||
|
||||
let signal;
|
||||
let peer;
|
||||
let viewerId = crypto.randomUUID();
|
||||
let viewerId = generateId();
|
||||
let retryTimer;
|
||||
let playPromise;
|
||||
let remoteStream;
|
||||
|
||||
function generateId() {
|
||||
const bytes = new Uint8Array(16);
|
||||
crypto.getRandomValues(bytes);
|
||||
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
||||
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
||||
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
||||
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
||||
}
|
||||
|
||||
player.muted = true;
|
||||
player.defaultMuted = true;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user