File tree Expand file tree Collapse file tree
src/components/Main/DialogCall Expand file tree Collapse file tree Original file line number Diff line number Diff 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) {
You can’t perform that action at this time.
0 commit comments