I’m using 2020.3.22f1c1 and I used two videoplayers in the scene to play two video, and when I tested it on my computer using WebGL, it played smoothly. However, when I visited this website on my phone for testing, only one video was playing. I printed videoPlayer.time in the update and found that only one was increasing, while the other remained at 0. However, on the computer, both times were increasing normally. what I should do?
Not playing two videos simultaneously?
WebGL is a severely limited platform, it only uses a single CPU thread. I assume those two videos at once are just too much to take for a phone.
You could experiment with Unity 2022 or 6 since a lot of the web tech has improved since 2020. But more likely you will have to redesign. Consider that on a small screen a user is unlikely to even want to have two videos playing simultaneously.
Video playback on the web doesn’t happen through WebGL/GPU, it’s always a video element that does the playback and then the texture is fed into WebGL/GPU. So I don’t think upgrading Unity will really help you here.
You should check the web inspector when this happens (there’s ways to connect your desktop browser to your phone so you can open a web inspector on your desktop for the page that’s open on your phone for both Android and iOS) and see if there’s an error. Maybe VideoPlayer.errorReceived will work as well.
But there are many limitations on mobile and some phones might simply be unable to play multiple video streams at once. They might only have the ability to hardware-decode one video and no software-decode fallback because the performance/efficiency would be too bad.
You could combine your two videos into one, a bit like it’s done for VR video, and then use a custom shader to split and un-stretch the videos again on playback.