Search Unity

Unity Freeze with OGV Streaming

Discussion in 'Editor & General Support' started by Kaldorei, Jan 25, 2011.

  1. Kaldorei

    Kaldorei

    Joined:
    Aug 12, 2010
    Posts:
    112
    Hello,

    First of all, sorry for my bad english i'm french.

    I'm experiencing some serious problems with live ogg streaming with livecast server, we have created a live video conversion service who convert flv videos to theora / vorbis (ogv) videos. They are streamed through icecast server. It work fine when WWW is started at the beginning of the stream but when we start WWW in the middle of the stream unity hang, we found the problem is with audio, when we only set video to be played it work flawlessly but with audio if it's not the begginning of the stream we hear the audio but unity freeze. Anyone else experience this problem ? Maybe a critical bug in unity ?

    (I use width != 16 to known if movie is playable since isReadyToPlay doesn't work with streamed movie but return real width of the movie if movie is available

    Code (csharp):
    1.  
    2. public class StreamedVideo : MonoBehaviour
    3. {
    4.     private WWW videodata;
    5.  
    6.     void Start()
    7.     {
    8.         videodata = new WWW("http://127.0.0.1:8001/stream.ogv");
    9.  
    10.         renderer.material.mainTexture = videodata.movie;
    11.         StartCoroutine(LoadVideo());
    12.     }
    13.  
    14.     IEnumerator LoadVideo()
    15.     {
    16.         while (!((MovieTexture)renderer.material.mainTexture).isReadyToPlay  ((MovieTexture)renderer.material.mainTexture).width == 16)
    17.             yield return new WaitForFixedUpdate();
    18.  
    19.         audio.clip = ((MovieTexture)renderer.material.mainTexture).audioClip;
    20.  
    21.         ((MovieTexture)renderer.material.mainTexture).Play();
    22.         audio.Play();
    23.     }
    24. }
    25.  
     
  2. Kaldorei

    Kaldorei

    Joined:
    Aug 12, 2010
    Posts:
    112
    Little up since it's blocking our project, thanks.
     
  3. soren

    soren

    Joined:
    Feb 18, 2008
    Posts:
    123
    Hi,
    Did you report a bug on this with an attached project that reproduces this? (Help->Report a bug).

    cheers
    -søren
     
  4. cfloutier

    cfloutier

    Joined:
    Jul 30, 2009
    Posts:
    35
    I've got the same kind of trouble and it's not easy to send our whole project to repport bugs
     
  5. R-Villani

    R-Villani

    Joined:
    Sep 27, 2011
    Posts:
    11
    Same here. Without audio, everything goes fine.
    Use a single audio.Play() and Unity hangs for about 3 seconds.
    Strange is that it hangs the video. The audio starts playing instantly.

    Unity 3.4.1, by the way
     
  6. grimmy

    grimmy

    Joined:
    Feb 2, 2009
    Posts:
    409
    Any news on this? I'm on Unity 3.5.0 f5 now and the problem is still occurring. This basically prevents us from downloading and playing movies from a server unless we expose our users to a 5 seconds game freeze every time the movie/audio starts to play.
     
  7. grimmy

    grimmy

    Joined:
    Feb 2, 2009
    Posts:
    409
    Actually, I just ran some more tests and I'm getting the game freeze at the end of a movie even if the movie is loaded locally. I tried a couple of different movies and the result is the same in each one.
     
  8. kundo

    kundo

    Joined:
    Jul 19, 2010
    Posts:
    25
    Hi !
    Anyone finds a solution for this problem ?
    I try to do the same thing and I have the same problem.
    This is the code:

    ...
    url = path + oi.nombreMedia[p] + ".ogv";
    www = new WWW(url);
    yield return www;
    video = www.movie;
    while ( !video.isReadyToPlay ) yield return 0;
    oi.audio.clip = video.audioClip;
    oi.audio.Play();
    video.Play();

    The video and the sound are synchronized but the video is black for a few seconds at the beginning.

    Kundo
     
  9. budwheizzah

    budwheizzah

    Joined:
    Apr 3, 2014
    Posts:
    13
    Bump... is this a joke? This critical project blocking bug is still going strong and this thread is from like 2011?!
    If I connect the audio from an OGG stream to an actual audio source in the project and try to play it, Unity hangs and operates at its preferred optimal two frames per second.
    Without the audio, no problem.

    Is this a joke or a prank given it still hasn't been fixed? :)
     
  10. budwheizzah

    budwheizzah

    Joined:
    Apr 3, 2014
    Posts:
    13
  11. Graham-Dunnett

    Graham-Dunnett

    Administrator

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    What do you expect the forum community here to do? Our QA and Devs work with bug reports, which is why Soren, who was our Audio programmer back in 2011 asked for a bug report. If you have reported a bug with a reproducible, post the bug number here, and I'll prod the QA team for you.
     
  12. howchmo

    howchmo

    Joined:
    Oct 30, 2014
    Posts:
    1
    I submitted bug report for 5.3.4f1 (Case 795672). I could try the upgrade, but honestly, this bug has been in the code since 2010 and there is no indication of anything updated along these lines in any of the the newer versions. This bug report included a sample test project I created, as well as a BAT script to stream video using VLC.