VideoPlayer in 5.6.0b4 can only play URL set in inspector

Hello,

Im trying to use the VideoPlayer component in WebGL Unity version 5.6.0.b4

So I add the VideoPlayer component to a cube, then in the inspector i set the URL to point to a video, then build for WebGL and it plays, yeah!!!

Since the simple mickey mouse scenario worked, i thought i could set the URL from code and have it play whatever video i want.

But it seems setting the SAME URL from code doesnt work, it only want to play the video URL set in the inspector.

Here is the code:

     vPlayer = gameObject.GetComponent<UnityEngine.Video.VideoPlayer>();
     vPlayer.url = newUrl;
     vPlayer.Play();

In the browser, this will either always play the video URL set in the inspector (ignoring the value set in code) , or if i set the URL in the inspector to blank and just set it in the code, it never plays anything.

  1. Anybody knows why i cant set the url to be played from code?
  2. If its playing a video, how can I change the url and have it play a different video?

Thanks

I am pretty sure this is a bug. Would you mind submitting a bug report with a simple project?

Actually, don’t worry about a bug report. I was able to reproduce the problem and figured it is a bug. We will fix it in one of the next Beta.

thanks for bringing this up.

Hello Marco,

Thanks for that, if im playing one video at a particular URL, can i stop it playing and start a new video at a different URL without much drama?

Also chrome was complaining that the video texture on wasnt a power of 2 (or something like that), is that a bug or can that be fixed? what does that mean, i have to make the scale of the cube a power of 2?

I didnt see that error in firefox

Thanks

Honestly I am not sure as I haven’t played around with the new Video Player. Though I know the warnings should be fixed in a future beta.

BTW, here is the public tracker for the URL bug.

Do you know if this fix will be in the next Unity release? I really need it because right now i cant play a video from code.

Have you tried the latest beta?