Skip to content

Commit

Permalink
fixed #7 Now you can "require" or "import"
Browse files Browse the repository at this point in the history
const MultiStreamsMixer = require('multistreamsmixer');
import { MultiStreamsMixer} from 'multistreamsmixer';
  • Loading branch information
muaz-khan committed Feb 20, 2019
1 parent 99110d4 commit b8b9801
Show file tree
Hide file tree
Showing 11 changed files with 2,046 additions and 15 deletions.
1 change: 1 addition & 0 deletions Gruntfile.js
Expand Up @@ -34,6 +34,7 @@ module.exports = function(grunt) {
dist: {
src: [
'dev/head.js',
'dev/amd.js',
'dev/init.js',
'dev/cross-browser-declarations.js',
'dev/start-drawing-frames.js',
Expand Down
105 changes: 103 additions & 2 deletions MultiStreamsMixer.js
@@ -1,7 +1,7 @@
// Last time updated: 2019-01-12 7:02:57 AM UTC
// Last time updated: 2019-02-20 3:06:25 PM UTC

// ________________________
// MultiStreamsMixer v1.0.7
// MultiStreamsMixer v1.0.8

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

Expand All @@ -12,6 +12,97 @@

function MultiStreamsMixer(arrayOfMediaStreams) {

var browserFakeUserAgent = 'Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45';

(function(that) {
if (!that) {
return;
}

if (typeof window !== 'undefined') {
return;
}

if (typeof global === 'undefined') {
return;
}

global.navigator = {
userAgent: browserFakeUserAgent,
getUserMedia: function() {}
};

if (!global.console) {
global.console = {};
}

if (typeof global.console.log === 'undefined' || typeof global.console.error === 'undefined') {
global.console.error = global.console.log = global.console.log || function() {
console.log(arguments);
};
}

if (typeof document === 'undefined') {
/*global document:true */
that.document = {
documentElement: {
appendChild: function() {
return '';
}
}
};

document.createElement = document.captureStream = document.mozCaptureStream = function() {
var obj = {
getContext: function() {
return obj;
},
play: function() {},
pause: function() {},
drawImage: function() {},
toDataURL: function() {
return '';
}
};
return obj;
};

that.HTMLVideoElement = function() {};
}

if (typeof location === 'undefined') {
/*global location:true */
that.location = {
protocol: 'file:',
href: '',
hash: ''
};
}

if (typeof screen === 'undefined') {
/*global screen:true */
that.screen = {
width: 0,
height: 0
};
}

if (typeof URL === 'undefined') {
/*global screen:true */
that.URL = {
createObjectURL: function() {
return '';
},
revokeObjectURL: function() {
return '';
}
};
}

/*global window:true */
that.window = global;
})(typeof global !== 'undefined' ? global : null);

// requires: chrome://flags/#enable-experimental-web-platform-features

var videos = [];
Expand Down Expand Up @@ -441,3 +532,13 @@ function MultiStreamsMixer(arrayOfMediaStreams) {
this.getMixedStream = getMixedStream;

}

if (typeof module !== 'undefined' /* && !!module.exports*/ ) {
module.exports = MultiStreamsMixer;
}

if (typeof define === 'function' && define.amd) {
define('MultiStreamsMixer', [], function() {
return MultiStreamsMixer;
});
}
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.

0 comments on commit b8b9801

Please sign in to comment.