x


Stream movie problem, How to know the buffer length of the movie turns to NOT enough again

Hi,

I had followed the demo in Help Doc to play a stream movie(.ogv) by using WWW.movie and MovieTexture, but when I tested it in a slower connection, I found the movie(actually the audio of the movie) was doing repeating the current frame (just like a stammerer speaking) when the buffer turned to NOT enough again. Is there anyone got the same problem or know how to avoid this?

I wanted to pause the movie and audio to avoid them repeating the current frame when the buffer turned to NOT enough, but I have no idea how to check the buffer was enough or not. I had tried to use isReadyToPlay, but seemed like it wouldn't be false when the buffer was NOT enough again after the first playing start.

Thanks for any help.

Here is My code demo:

function Start(){

var www = new WWW("..some url..");
movieTexture = www.movie;
while (!movieTexture.isReadyToPlay){
    Debug.Log("waiting..." + www.progress);
    yield;
}

audio.clip = movieTexture.audioClip;
//The Update function will check and resume the movie and audio,
//so I don't have to play them here.

}

function Update(){

if(movieTexture){

    // Actually after the fist play start, 

    //the isReadyToPlay wouldn' be false when the buffer

    // turned to NOT enough again, so the below if never

    // be true again after the first play start. 

    if(!movieTexture.isReadyToPlay){
        if(movieTexture.isPlaying){
            movieTexture.Pause();
            audio.Pause();
        }
    }else{
        if(!movieTexture.isPlaying){
            movieTexture.Play();
            audio.Play();
        }
    }
}

}

more ▼

asked Oct 21 '11 at 08:30 AM

solomonZ gravatar image

solomonZ
1 2 2 3

(comments are locked)
10|3000 characters needed characters left

1 answer: sort oldest

Unity is not streaming videos in the sense that YouTube is. When enough video has downloaded to start the playback the flag is set, but hiccups in the delivery can mean that the video stalls, as you see. I don't think the buffer is exposed in any way.

more ▼

answered Oct 21 '11 at 01:05 PM

Graham Dunnett gravatar image

Graham Dunnett ♦♦
11.7k 11 20 64

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x116
x39
x22

asked: Oct 21 '11 at 08:30 AM

Seen: 669 times

Last Updated: Oct 21 '11 at 01:05 PM