Search Unity

Playing QuickTime to a texture

Discussion in 'Scripting' started by fhmiv, Feb 3, 2007.

  1. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    No need to bombard David alone, instead of writing him you're much better off writing sales@unity3d.com. It's not that David won't reply to you it's just that he's ultra-busy and the sales@ address goes to a few of us that can help you out (translation: you're likely to get a faster reply and ease David's stressed workload :) ).
     
  2. ammon

    ammon

    Joined:
    Feb 6, 2009
    Posts:
    4
    Can anyone tell me if this plugin has every worked for Windows standalone? I've seen some references to configuring for Windows, but I have not been able to get it to work.

    thanks!
     
  3. fhmiv

    fhmiv

    Joined:
    Jan 31, 2007
    Posts:
    38
    Ammon,

    Sorry for the long delay in replying to your query. I wrote this plug-in quite some time ago, before Unity 2.0 shipped and possibly even before 1.5. It worked on Windows at that time.

    Since then, I tried briefly to get it working with Unity 2.x on Windows, but wasn't successful, and didn't pursue it further since my company decided to use the built-in OGG support instead. That method wasn't available at the time I wrote the plug-in.

    Regards,

    Frank
     
  4. wuwu

    wuwu

    Joined:
    Jun 17, 2008
    Posts:
    72
    i realize this is an old topic i just got around to it myself.

    and i will be checking it out later on sunday.
    but the question will be..
    will it work on web prints >.<
     
  5. didier

    didier

    Joined:
    Jun 6, 2009
    Posts:
    24
    I'm trying to play a quicktime inside my game that will be realease on Iphone. A way to attach a texture sequence to a plane will be fine too. I look around the forum but with no luck so far.

    1- I downloaded this link
    http://auroralux.net/unity/QTMovieInTextureExample-20070404.zip posted by fhmiv

    2 Then I tried to plugin a quicktime in it => sample.mov

    But for some reasons it doesn't work. :(
    I'm getting this type of errors Rebuilding GUID cache: Deleting metadata Assets/Plugins/UnityCocoaQT.bundle/Contents/MacOS/UnityCocoaQT because the asset doesn't exist anymore.
    MetaData path library/metadata/22/22dad359bd11471ba000213826600b59


    It will be VERY helpful if someone who could make it works could post a unity zip sample with a movie already plug in. I'm sure it's working but I cannot figure out what is the issue.

    Thanks a lot!
     
  6. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    I don't believe that Unity content of any kind will print well when printing a web page containing that content (regardless of movie texture usage or not).


    Unity iPhone does not yet support video playback at all, that support is coming in the 1.1 update later this summer.
     
  7. didier

    didier

    Joined:
    Jun 6, 2009
    Posts:
    24
    In that case is there a way to attach a texture sequence to a plane.
    I read a lot about it on the forum and tried many things but nothing really work for me.
    If someone could share a script that work it will be great!

    Thanks
     
  8. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    You don't "attach a sequence" so much as you can assign an array of textures to variables, then manually flip through them over time. Or alternatively, you can have one texture that's really a long series of "frames" and then adjust the off-set of the texture over time (example).
     
  9. didier

    didier

    Joined:
    Jun 6, 2009
    Posts:
    24
    Mmmm... Does it need so complex?
    Thad script seems easiest to plug in but I don't understand
    where and what is the syntax to connect my textures.
    Should I replace FileTexture by the full path of my texture like : C:/documents/diretory/file.###.tif


    Code (csharp):
    1. public var texture : FileTexture;
    2. public var framesPerSecond = 30.0;
    3.  
    4. public var animate : boolean = false;
    5.  
    6. function Update () {
    7.  
    8. if ( animate ) {
    9.  
    10. // Get Play Length And Time
    11. var playLength : int = texture.frameCount / framesPerSecond;
    12. var time : float = Mathf.Repeat (Time.time, playLength) / playLength;
    13.  
    14. // Update Frame
    15. var frame : int = time * texture.frameCount;
    16. texture.frame = Mathf.Clamp (frame, 0, texture.frameCount -1);
    17.  
    18. }
    19.  
    20. }
    21.  
    22. function Reset () {
    23. if (renderer) {
    24. texture = renderer.sharedMaterial.mainTexture;
    25. }
    26. }
    27.  
    28.  
    29. // Getter  Setter For Animate
    30. function Animate ( val : boolean ) : void {
    31. animate = val;
    32. }
    33. function Animate () : boolean {
    34. return ( animate );
    35. }
     
  10. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    Possibly not, but you asked for an example and I referenced one. :)

    Your question seems to indicate that you're not familiar with the basics behind using Unity. I say that because those who use Unity should know that public variables, like FileTexture, appear in the inspector when you have that object selected (attach script to game object, select game object, see variables in the inspector). When you do that you just drag the texture from your Project view on to the variable in the inspector and you're done.

    You can read up on the Unity interface here:

    Learning the Interface
     
  11. didier

    didier

    Joined:
    Jun 6, 2009
    Posts:
    24
    I guess you're right.
    I'll go back to the basis
    and I should be able to make it work.

    Thanks!
     
  12. RHD

    RHD

    Joined:
    Mar 30, 2009
    Posts:
    713
    Hi Didier,

    I just went through this too and got it going in the end. The thread here might help you:

    http://forum.unity3d.com/viewtopic.php?t=25350&highlight=

    There's a tutorial by one of the Unity guys somewhere about creating flame and smoke particle effects that shows you how to set up the image file correctly.

    Good luck.
     
  13. hai_ok

    hai_ok

    Joined:
    Jun 20, 2007
    Posts:
    193
    First I should tell you how awesome this plugin is. Thank you so Much for making this great contribution to our collective toolset!

    I would like to trigger several different videos using different keys on the keyboard. And I only want them to play on key press instead of as soon as the scene loads.

    Any way to make this a static function I can call from Javascript and tell it which one to play?

    Thanks!
     
  14. fhmiv

    fhmiv

    Joined:
    Jan 31, 2007
    Posts:
    38
    Thanks for the compliments. I'm a bit surprised this plug-in still works, especially on Windows, since Unity has switched the default Windows renderer from OpenGL to D3D. If you're content to run only on the Mac, or to force the Windows version to use OpenGL instead of D3D, you might be able to do what you want.

    Shortly after posting the original examples, I made a slight modification that handled multiple movies, and it might still work. You're welcome to give it a try if you like.

    However if it were me, I'd look to trying to use the built-in video playback methods that were added since I wrote this.

    Good luck either way!
     
  15. hai_ok

    hai_ok

    Joined:
    Jun 20, 2007
    Posts:
    193
    Well your contribution is still amazing. Thanks for pointing that out. So glad to have that working. You rock!
     
  16. azuretttc

    azuretttc

    Joined:
    May 8, 2009
    Posts:
    75
    This does not seems work in unity3.0, I always receive the -50 error and the output of the texture is a mess. Does it because tex.GetInstanceID not return the correct opengl value?

    Do I need to set the mode to opengl in editor to make it work?
     
  17. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,425
    Check in the source code of TexturePlayback.cs, it seemed the author left some hardcoded file paths in there. I went in and put an absolute path "c:\myfile.mov" and that got rid of the -50 error.

    I've tried using

    Code (csharp):
    1. updateTextureID = m_Texture.GetInstanceID();   
    and

    Code (csharp):
    1. updateTextureID = m_Texture.GetNativeTextureID();  
    The movie plays, yet I only hear sound and the texture is blank :(
     
  18. masood-t

    masood-t

    Joined:
    Nov 25, 2012
    Posts:
    13
    HI
    base on the wiki project i try to make a dll that render quicktime to a texture.
    in the main project gworldPixBase send to glTexImage2D but now i nedd something like this:gworldPixBase.r or .g or .b
    anyone know how to convert it?