- Home /
WWW streaming ogg video problems
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();
}
}
}
isDone not going true sounds about right, after all it's a stream
It could be that 'WWW' simply doesn't support what you are trying to do, the web page at http://docs.unity3d.com/ScriptReference/WWW.html suggests it is more about "retrieving the contents of URLs". Although it does mention 'stream', I think it's more referring to asset bundles being streamed off the net rather than a video stream.
That Editor crash does worry me a bit though. I guess there is no harm in submitting a bug report using the Bug Reporter tool though. $$anonymous$$ake sure you tell QA in the report exactly how you have your video stream set up (what software to install, what hardware you have etc) so that they can try to reproduce the issue.
Answer by Paulius-Liekis · Dec 22, 2014 at 01:14 PM
isDone does not become true if it's not done and with stream it's never done. So the behaviour that you're describing makes sense.
Your answer
Follow this Question
Related Questions
VideoPlayer streaming and buffering 0 Answers
Is it possible to access a file from the android Internal storage on to a Unity app during run time? 0 Answers
Integrating Intel-Media SDK with Unity 0 Answers
Streaming Video In and Out of Unity 0 Answers
How to integrate a video with alpha channel (rgb+alpha) in the new 5.6 videoplayer? 5 Answers