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();
}
}
}
}