I’am using standard Unity VideoPlayer component.
Unity version is 5.6.1.
The problem is that the game freezes when I call VideoPlayer.Prepare(); or VideoPlayer.Play(); when trying to play video from URL. And resumes only when VideoPlayer operations are completed.
the code is something like this:
videoPlayer.url = url;
videoPlayer.Play(); // <<<- Whole game freezes until this operation is completed. It's looks like VideoPlayer is downloading video in UI thread and blocking it.
or this
videoPlayer.prepareCompleted += (source) =>
{
source.Play ();
}
videoPlayer.url ="http://...";
videoPlayer.Prepare(); // Freeze starts from this point.
Also, when I try to use VideoPlayer.Prepare(); method I’ve got the same - the game freezes until Prepare() is completed and playback is started. Looks like that this operations works at the same UI thread and blocking it;
Is there any way to run VideoPlayer.Prepare() operation in another thread, or something like coroutine with it?
Looks like it’s Unity VideoPlayer bug or I missed something?
I tried to preload in a separate thread, but the issue is squarely in VideoPlayer.Prepare().
I can live with it for a prototype. Did I miss something though? You cant stream?
Should we move this issue to the Unity Answer section? I thought that there are unity engineers monitoring the forum?
We just want to know if we missed any step or this is a bug that will be addressed in the future.
Thanks. I just voted it up!! In addition, do you think it’s worth to repost this question in Unity Answer. Maybe, someone with more experiences can come up a work around since we do not know when Unity will fix the issue.
I think It’s good idea! We should use any possibility to solve this issue. It’s serious blocker not just for us. I don’t see anything wrong to ask for help. So, do it.
Maybe someone who has acces to Unity source code can take a look on VideoPlayer.Prepare() implementation and make a guess or figure out what is wrong with it.
Also, we can collaborate to solve this issue or to find some workaround.
We have the same problem here, unusable.
What we try to make is to have 1s clips that we use contextually, to react to player action. It’s a face in a screen, clips are 130x130 pixels, lasting 1s, but on Android it justs freezes the app and display like the 2 last frames. Totally useless.
Please unity make something about this
I have the same problem. When I try to play the video, everything hangs for about 4 seconds. I tried preparing the video in a background thread but Unity won’t allow it (has to be done in the main thread). Been stuck on this for days and I am out of ideas.