muaz-khan / MultiStreamsMixer

MultiStreamsMixer is a JavaScript library that allows you pass multiple streams (e.g. screen+camera or multiple-cameras) and get single stream.

Home Page:https://www.webrtc-experiment.com/MultiStreamsMixer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Import MultiStreamsMixer Javascript file with dependency instead of script

luanraithz opened this issue · comments

Is there way way of doing the following in a javascript file?

import MultiStreamsMixer from 'multistreamsmixer'
// or even: 
import { MultiStreamsMixer } from 'multistreamsmixer'

It worked importing the script in the with a script tag, but we are trying to avoid this kind of approach (put things in the window).
I see that your MultStreamsMixer.ts file exports the class, are there any reason to don't do so at the js file?

Sadly the way it worked was download MultiStreamsMixer.js file manually, and change it so it exports what I need, but I think it's a really bad approach.

I'll add import and require in the next commit. Something like this:

const MultiStreamsMixer = require('multistreamsmixer');
import { MultiStreamsMixer} from 'multistreamsmixer';

Ok, thanks a lot.

Please install NPM package and test again. (npm install multistreamsmixer)

import { MultiStreamsMixer} from 'multistreamsmixer';

Yeap it works now, thanks.
But you exported as:

 module.exports = MultiStreamsMixer;

So I have to import it as:

import MultiStreamsMixer from 'multistreamsmixer';

Do you intend to keep that way ? If so, the readme would have to be changed, I may change it and open a pull request if you don't want to bother with it.