Search Unity

movie texture play

Discussion in 'Editor & General Support' started by rahuxx, Nov 19, 2009.

  1. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    Hello,

    How can i controll movie(avi) texture by scripting ?
    I want as slider play avi should play ?

    Thanx
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    Control over MovieTextures is currently very limited. It is possible to pause, stop and rewind, but there isn't any way to set the position of the playhead in the Unity API.
     
  3. Jeromy

    Jeromy

    Joined:
    Mar 3, 2010
    Posts:
    4
    It is possible to rewind the movie texture? How? :)
    IMHO the function Stop () doesn't work correctly. (It just stop the movie, but doesn't rewind it) and in the scripting reference I see only the functions Stopp, Play and Pause but no rewind.

    We use a little workaround to correctly start/stop-movies. It is not a perfect solution but for the moment it's a usable workaround for us.

    Greets

    Jeromy
     

    Attached Files:

  4. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    i will check and reply in detail if it works
     
  5. vogles

    vogles

    Joined:
    Sep 28, 2009
    Posts:
    131
    the Stop function will rewind the movie, but doesn't update the texture until you try to play it again. So if you want to restart a movie, you can do a Movie.Stop(); Movie.Play(); deal. and if you just want it to show the first frame you'll have to throw in some weird WaitForSeconds() stuff in there and then Movie.Stop().

    The whole MovieTexture thing is very clunky. You're probably better off writing your own plugin for movie playback. It'll give you more control over the movie, if you need it.
     
  6. Jeromy

    Jeromy

    Joined:
    Mar 3, 2010
    Posts:
    4
    That's exactly what I did in my script :). The only different is, that I work with jield, not with WaitForSeconds().
     
  7. vogles

    vogles

    Joined:
    Sep 28, 2009
    Posts:
    131
    right, well i meant you'd have to do something like

    Code (csharp):
    1.  
    2. Movie.Stop();
    3. Movie.Play();
    4.  
    5. yield return new WaitForSeconds(0.5f);
    6.  
    7. Movie.Stop();
    8.  
     
  8. BalrajWallace

    BalrajWallace

    Joined:
    Mar 13, 2020
    Posts:
    1
    Now they have a lot of improvement in that aspect
     
    Last edited: Apr 11, 2020