Skip to content

Commit 9e124ac

Browse files
authored
fix: web dialer communication issues using firefox (#39)
1 parent 26595b7 commit 9e124ac

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

src/components/Main/DialogCall/DialogCall.vue

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,29 @@ export default {
107107
this.$refs.localStream.srcObject = stream
108108
},
109109
remoteStream(stream) {
110-
this.$refs.remoteStream.srcObject = stream
110+
const media = this.$refs.remoteStream
111+
if (!media || !stream) return
112+
113+
const currentSrc = media.srcObject
114+
if (currentSrc && currentSrc.getTracks().length > 0) {
115+
const mergedStream = new MediaStream()
116+
const newAudio = stream.getAudioTracks()
117+
const newVideo = stream.getVideoTracks()
118+
119+
const audio = newAudio.length > 0 ? newAudio : currentSrc.getAudioTracks()
120+
const video = newVideo.length > 0 ? newVideo : currentSrc.getVideoTracks()
121+
122+
audio.forEach((t) => mergedStream.addTrack(t))
123+
video.forEach((t) => mergedStream.addTrack(t))
124+
125+
media.srcObject = mergedStream
126+
} else {
127+
media.srcObject = stream
128+
}
129+
130+
if (audioContext.state === 'suspended') {
131+
audioContext.resume()
132+
}
111133
},
112134
isCallAccepted(value) {
113135
if (!value) {

0 commit comments

Comments
 (0)