Unity webgl multiple video players not working

I have two video players. If I play both only one player is rendered. Other one is definetly playing because I can hear the audio, but not rendered. If I pause the first one, second is rendered. If I play the first one again, second stops rendering but still playing. In standalone/editor everything works properly, this happens only in WebGL. Do any of know why this is happening ? I use RenderTexture and assigning it to a material which is assigned to mesh in which the video is rendered. I create the RenderTexture runtime and instantiate the material runtime too.

Do you use the only Render Texture for both Players?

1 Like

No, for one player I have the render texture in the assets. For other player I create the render texture runtime. Also I printed the videoplayer.targettexture.getinstanceid(), I can see two different values for both players. Also the same setup works in windows standalone/editor.

I have a similar issue. Everything runs great on Mac and Windows builds, but completely unusable as a WebGL build. For testing purposes, I created a new project with just this:

(3) Planes,
(3) Video Players,
(3) Videos in StreamingAssets folder.

Video Player: Material Override, Loop, Skip On Drop.
Renderer assigned in Editor, One plane to each Video Player

Awake(): Assign URLs
TMP Button to start all 3 players simultaneously.

1 Plane functions correctly.
1 Plane freezes on a frame first time through.
1 Plane never displays a single frame.

I’ve hosted this on 2 different servers, all with completely unusable / terrible results.

Videos are 5 seconds long, mostly black and Rendered: mp4 h.264, limited to 4mb/s datarate.
Plane scales all match Video Aspect Ratios.
2640 x 720 = 2.64, 0.72
2160 x 960 = 2.16, 096
1920 x 240 = 1.92, 0.24

1 Like

This is a classic WebGL thing…WebGL has some strict limits on resources, especially with videos. What’s happening is most likely a GPU texture limit issue. WebGL doesn’t handle multiple video textures well, so it’ll only render one at a time, but both are playing, which is why you hear the audio from both.
Check is if you’re hitting any errors in the browser’s dev console—WebGL can be sneaky with silent fails.