mbebenita / Broadway

A JavaScript H.264 decoder.
Other
2.73k stars 424 forks source link

Overcome webGL browser limitation #197

Open mbk2787 opened 5 years ago

mbk2787 commented 5 years ago

Hello everyone,

I have a question just to undestand if what I would achieve have sense or not. The idea is to open many broadway player per browser tab, but using webGL, after 16 instances I receive some warnings from browser and next players crashes.

Could be reasonable to use one decoder or webGL context per n players? Is it something feasible putting hands on broadway implementation?

Thanks in advance for help.

soliton4 commented 5 years ago

you could check for if the tab is in fore / background and whenever a tab gets moved to the background, just destroy the webgl canvas. recreated it once it gets in the foreground again

mbk2787 commented 5 years ago

Good idea if I use a single monitor, but unfortunately not if I have many.

From your opinion, it makes sense to try to render n streams in a single canvas, using n decoders? In this way I will have a single webGL context per browser window. Obviously a code change is needed.

Thanks

mbk2787 commented 5 years ago

Just to give an update:

I was able to use one canvas and hence one webgl context to render different streams. I used viewport method and basically putting different frames in different viewports, works.

The only issue is that, everytime I put a frame in a specific viewport, then the entire canvas is clean and it render only the image on viewport specified.

Do you know how to avoid the canvas to clean itself?

PS: if there is a way to solve this, maybe it can be a good feature to put on the project.

Thanks