0

I am trying to play a large video on a unity webgl build. Im using VideoPlayer component and video source is a URL. The video plays but is very jittery and keeps getting stuck. My internet speed is decent. Is there a way to pre-buffer the video before playing? And if so, are there delegates or events to notify you when buffering is complete?

Here is what my code is doing:

First I assign event callback to start video when it is prepared. I call Prepare on Start. Then I play the video once prepared.

void Start() 
{
     video_player.Prepare();
}

void OnEnable ()
{
    video_player.prepareCompleted += VideoPrepared;
}

void OnDisable ()
{
    video_player.prepareCompleted -= VideoPrepared;
}

void VideoPrepared (VideoPlayer vPlayer)
{
    //Code to play video
    video_player.Play();
}
anivader
  • 364
  • 1
  • 4
  • 17
  • Show the code you're using to play the video – Programmer Oct 21 '18 at 13:00
  • It's just video_player.Play (); . Source is a URL, all standard stuff – anivader Oct 21 '18 at 15:00
  • Why not post it? Really can't help without that – Programmer Oct 21 '18 at 15:01
  • I just did. That is just that 1 line of code. Other stuff is in inspector. Could you explain what specifically you are needing? – anivader Oct 21 '18 at 15:47
  • Try to do video playing stuff from code. You must call the prepare function, make sure it's done preparing **before** playing the video. See duplicate. – Programmer Oct 21 '18 at 15:50
  • I actually did. I called prepare on Start. And then also I used used the event prepareCompleted. But it still buffered after it started playing. I am wondering if I should switch to Movie texture – anivader Oct 21 '18 at 16:10
  • You refused to post your code and said you only used the play function, I marked as a duplicate now you you're claiming you used prepare too. Exactly what I'm trying to prevent. Your code is still not in your question and this is not how to ask a question. – Programmer Oct 21 '18 at 16:14
  • Sorry I added the prepare code after writing that comment. I'm going to edit the question to show my full code now. – anivader Oct 21 '18 at 16:43

0 Answers0