I am trying to display a ogg video stream as a texture on an object using WWW. When I use an ogv file (file://path/myfile.ogv), everything works fine. When I use a video stream (http://mycomputer:8080), isDone is never true, isReadyToPlay is never true and yield return on the object never returns although the video will play fine most of the time if I go ahead and just use it without the checks. Sometimes though it will cause the editor (or the build) to just crash. Why doesn’t it work with a stream? coroutine code:
IEnumerator StartVideo()
{
wwwData = new WWW(sourceString);
// yield return wwwData; - this will hang
yield return new WaitForSeconds(3.0f); // using instead
// yield return wwwData; - this will hang
// while (!wwwData.isDone) -- this will never complete
// {
// yield return new WaitForSeconds(1.0f);
// }
if (wwwData != null)
{
movieObj = wwwData.movie;
string error = wwwData.error;
if (string.IsNullOrEmpty(error))
{
// while (!movieObj.isReadyToPlay) - never completes
// {
// yield return new WaitForSeconds(1.0f);
// }
renderer.material.mainTexture = movieObj;
movieObj.Play();
}
}
}