cycjimmy / jsmpeg-player

MPEG1 Video Player Based On JSMpeg.
https://www.npmjs.com/package/@cycjimmy/jsmpeg-player
MIT License
159 stars 38 forks source link

Can't create multiple jsmpeg at once #41

Open mehranmd opened 2 years ago

mehranmd commented 2 years ago

I Have a React application which uses your module to play camera feeds from web socket. when we try to load 2 or more camera at once the camera won't start playing and console log is also empty without any error or warning.

Steps to reproduce the behavior:

  1. put multiple instance of JSMpeg into a 'map' function and create multiple instance of it
  2. when we press "F5" on the browser, the problem resolves, until next time we open the browser again.
  3. I use the latest Chrome, Edge to test this matter
mehranmd commented 2 years ago

It might be useful, i create my JSMpeg instance like this:

componentDidMount() { new JSMpeg.VideoElement(this.els.videoWrapper, this.props.videoUrl, this.props.options, this.props.overlayOptions); };

KevinSalmon commented 2 years ago

I have the same behaviour with my Angular app only on Android WebView.

I found a workaround. I create one player at a time. When the first player calls play or load hooks, I instantiate the second player, and so on.