I have a pretty simple script that loads a MovieTexture, sets the movie to loop then plays it (along with audio). It starts off fine, loops a couple of times (never the same number) then eventually stops.
public class LoopingVideo : MonoBehaviour
{
private MovieTexture movieTexture = null;
public AudioSource audioSource;
// Use this for initialization
void Start ()
{
StartCoroutine(loadAndPlayMovieAtURL(LoginManager.Instance.Address + "movie.unity3d"));
}
public IEnumerator loadAndPlayMovieAtURL(string url)
{
WWW movie;
movie = new WWW(url);
yield return movie;
movieTexture = ((MovieTexture)(((GameObject)movie.assetBundle.mainAsset).GetComponent<GUITexture>().texture));
movieTexture.Stop();
audioSource.clip = movieTexture.audioClip;
movieTexture.loop = true;
audioSource.loop = true;
gameObject.GetComponent<MeshRenderer>().material.mainTexture = movieTexture;
movieTexture.Play();
audioSource.Play();
}
}
Like I said the movie loads and plays fine, loops some number of times and then stops. Has anyone else run into this problem or see anything with the code that looks wrong?