Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
muaz-khan committed Jun 21, 2019
1 parent fb4d812 commit 37e8f40
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 33 deletions.
22 changes: 16 additions & 6 deletions MultiStreamsMixer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Last time updated: 2019-06-18 3:19:53 AM UTC
// Last time updated: 2019-06-21 4:09:42 AM UTC

// ________________________
// MultiStreamsMixer v1.2.1
// MultiStreamsMixer v1.2.2

// Open-Sourced: https://github.com/muaz-khan/MultiStreamsMixer

Expand Down Expand Up @@ -462,24 +462,34 @@ function MultiStreamsMixer(arrayOfMediaStreams, elementClass) {
streams = [streams];
}

arrayOfMediaStreams = arrayOfMediaStreams.concat(streams);

streams.forEach(function(stream) {
var newStream = new MediaStream();

if (stream.getTracks().filter(function(t) {
return t.kind === 'video';
}).length) {
var video = getVideo(stream);
video.stream = stream;
videos.push(video);

newStream.addTrack(stream.getTracks().filter(function(t) {
return t.kind === 'video';
})[0]);
}

if (stream.getTracks().filter(function(t) {
return t.kind === 'audio';
}).length && self.audioContext && self.audioDestination) {
}).length) {
var audioSource = self.audioContext.createMediaStreamSource(stream);
self.audioDestination = self.audioContext.createMediaStreamDestination();
audioSource.connect(self.audioDestination);
self.audioSources.push(audioSource);

newStream.addTrack(self.audioDestination.stream.getTracks().filter(function(t) {
return t.kind === 'audio';
})[0]);
}

arrayOfMediaStreams.push(newStream);
});
};

Expand Down
6 changes: 3 additions & 3 deletions MultiStreamsMixer.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "multistreamsmixer",
"description": "Pass multiple streams (e.g. screen+camera or multiple-cameras) and get single stream.",
"version": "1.2.1",
"version": "1.2.2",
"authors": [
{
"name": "Muaz Khan",
Expand Down
Loading

0 comments on commit 37e8f40

Please sign in to comment.