From dffa8419b54a876226bca77e490357120720a939 Mon Sep 17 00:00:00 2001 From: binhtlthien <46182951+binhtlthien@users.noreply.github.com> Date: Thu, 16 Jun 2022 10:32:29 +0700 Subject: [PATCH] Update MultiStreamsMixer.js --- MultiStreamsMixer.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/MultiStreamsMixer.js b/MultiStreamsMixer.js index 5abb002..414b3c6 100644 --- a/MultiStreamsMixer.js +++ b/MultiStreamsMixer.js @@ -475,9 +475,14 @@ function MultiStreamsMixer(arrayOfMediaStreams, elementClass) { if (stream.getTracks().filter(function(t) { return t.kind === 'audio'; - }).length) { + }).length) { + if (!Storage.AudioContextConstructor) { + Storage.AudioContextConstructor = new Storage.AudioContext(); + } + self.audioContext = Storage.AudioContextConstructor; + var audioSource = self.audioContext.createMediaStreamSource(stream); - // self.audioDestination = self.audioContext.createMediaStreamDestination(); + self.audioDestination = self.audioContext.createMediaStreamDestination(); audioSource.connect(self.audioDestination); newStream.addTrack(self.audioDestination.stream.getTracks().filter(function(t) {