Fix Firefox WebRTC support

This commit is contained in:
Alexey Khit
2022-12-18 22:38:44 +03:00
parent 4df44645d7
commit aca3bab238
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -422,7 +422,8 @@ class VideoRTC extends HTMLElement {
video2.addEventListener("loadeddata", () => {
console.debug("VideoRTC.video.loadeddata", video2.readyState, pc.connectionState);
if (pc.connectionState === "connected" || pc.connectionState === "connecting") {
// Firefox doesn't support pc.connectionState
if (pc.connectionState === "connected" || pc.connectionState === "connecting" || !pc.connectionState) {
// Video+Audio > Video, H265 > H264, Video > Audio, WebRTC > MSE
let rtcPriority = 0, msePriority = 0;
@@ -498,7 +499,7 @@ class VideoRTC extends HTMLElement {
this.onmessage["webrtc"] = msg => {
switch (msg.type) {
case "webrtc/candidate":
pc.addIceCandidate({candidate: msg.value, sdpMid: ""}).catch(() => console.debug);
pc.addIceCandidate({candidate: msg.value, sdpMid: "0"}).catch(() => console.debug);
break;
case "webrtc/answer":
pc.setRemoteDescription({type: "answer", sdp: msg.value}).catch(() => console.debug);
+1 -1
View File
@@ -48,7 +48,7 @@
console.debug('ws.onmessage', msg);
if (msg.type === 'webrtc/candidate') {
pc.addIceCandidate({candidate: msg.value, sdpMid: ''});
pc.addIceCandidate({candidate: msg.value, sdpMid: '0'});
} else if (msg.type === 'webrtc/answer') {
pc.setRemoteDescription({type: 'answer', sdp: msg.value});
}