Search Unity

[ OSX Video Texture Pro ] - Improved QTKit/Quicktime video player for MacOSX

Discussion in 'Assets and Asset Store' started by brianchasalow, Jan 3, 2012.

  1. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    Tom: i should probably add that at some point. right now, it supports:
    if([path hasPrefix:mad:"http://"] || [path hasPrefix:mad:"rtsp://"] || [path hasPrefix:mad:"assets-library://"])

    Synapz: alpha is supported on OSX desktop if you somewhere via code write VTP.useFastPathTextureCopying = false;
    no idea re: vuforia.

    I'm aware of the issues with both Syphon and VTP2 with the oculus plugin. I haven't gotten around to fixing either of them. ( I also don't own an oculus rift currently for testing, which makes it more difficult )
     
    TomHaygarth likes this.
  2. invadererik

    invadererik

    Joined:
    Oct 31, 2010
    Posts:
    148
    Is there any way to play video files on iOS that are NOT in the streaming assets path ?
    I've tried all sorts of paths, but couldn't get any of them to play.
     
  3. TomHaygarth

    TomHaygarth

    Joined:
    Oct 16, 2014
    Posts:
    2
    Brian: Ah okay, I suspected as much. My temporary solution for now was to enable filesharing with the app and use the FileManager to get a list of videos in the apps documents folder.

    Invadererik: Like Brian mentioned above you can use the assets library address prefix, so you can use something like a UIImagePickerController to get the user to select a video from their photo gallery, which is the simplest solution but it doesn't include video from iTunes and the UIImagePickerController will always open in portrait.

    I'm currently using a mixture of the ALAssetsLibrary and FileManager to get a list of all videos available to the app and letting the user select from one of them.
     
  4. invadererik

    invadererik

    Joined:
    Oct 31, 2010
    Posts:
    148
    Thanks for the reply TomHaygarth! I'll look into doing something like that.

    Although, Would be nice if VTP supported the file:// prefix since you can do that directly in unity with out having to mess around with iOS native.
     
  5. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    invadererik: it basically supports the file:// prefix, but currently you'd have to strip the file:// before you pass the url, if i remember correctly. Maybe I can poke at making that easier, if it doesn't work right currently...

    Code (csharp):
    1.  
    2.  
    3.        if([path hasPrefix:@"http://"] || [path hasPrefix:@"rtsp://"] || [path hasPrefix:@"assets-library://"])
    4.  
    5.         {
    6.  
    7.             pathURL =  [NSURL URLWithString:path];
    8.  
    9.         }
    10.  
    11.         else
    12.  
    13.         {
    14.  
    15.             path = [path stringByStandardizingPath];
    16.  
    17.             pathURL = [NSURL fileURLWithPath:path];
    18.  
    19.         }
    20.  
    21.  
     
  6. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    Can you email me a sample project which utilizes the ipod-library:// prefix? I want to test here but don't want to write a bunch of testbed code.
     
  7. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    @lobsterhill @TomHaygarth

    edit:submitted new version to asset store...expect it soon.
     
    Last edited: Nov 27, 2014
  8. Sahkan

    Sahkan

    Joined:
    Mar 3, 2013
    Posts:
    204
    Hey! I'm trying to play ogv file on that plugin and the screen goes black.
    The goal is to run the same video on ipad and on pc so i won't have to hold two copies of it in different formats.
    Is ogv even supported ?
     
  9. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    I would use m4v if I was you. Good compression, imports into Unity fast and works on all platforms.
     
  10. Sahkan

    Sahkan

    Joined:
    Mar 3, 2013
    Posts:
    204
    The thing is that i need it to be ogv so i can use the same assetbundle for ipad and pc, pc will accept only ogv.
     
  11. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    I assume thats because of the default MovieTexture you are using?

    VTP will play any native files that the OS supports, I believe, but we only use MP4 and M4V formats on iOS and OSX. Sorry I cant be of more help, hopefully Brian can help out.
     
  12. Sahkan

    Sahkan

    Joined:
    Mar 3, 2013
    Posts:
    204
    I've checked and IOS can play this format, i've played it via chrome over there.
    In PC i use the default movieTexture ( which is the only option for PC and it accept only ogv ).
    I hope brian can add the support for it, i wonder when he will be able to reply on this thread because i need it really soon :\
     
  13. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Support for PC wont come from this package im afraid. Its an OSX/iOS only pack. You will need to find another player for Windows on the asset store, I believe there are a couple.
     
  14. Sahkan

    Sahkan

    Joined:
    Mar 3, 2013
    Posts:
    204
    I don't have a problem to use the native movieTexture for PC, all i need is for this plugin to be able to run ogv, and then i will use the same file as source for both systems.
     
  15. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    If it doesn't playback ogv, I unfortunately can't magically add support for it. This an AVFoundation-based player and does not use or support 3rd party decoding mechanisms. I would recommend using h264 as it supports hardware-based decoding on iOS, which is what makes it so efficient.
     
  16. borr

    borr

    Joined:
    Jan 22, 2014
    Posts:
    10
  17. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    1: yes, that's a super clever trick to get alpha on ios, I recommend it heartily.
    2: I think it already has a 64 bit slice in it. Once unity supports 64 bit, I intend on supporting it officially as well.
     
  18. borr

    borr

    Joined:
    Jan 22, 2014
    Posts:
    10
    Can you help me with shader for this?
    thanks.
     
  19. matiasjaure

    matiasjaure

    Joined:
    May 27, 2011
    Posts:
    39
    I am having a problem trying to build the .ipa from xCode, it works fine running into device, but it fails when code signing.
    It seems to be an issue that happens with OSX 10.10, the error is " unsealed contents present in the bundle root" I looked for some fix but couldn't find any, at least one that I can do. In stackoverflow they suggest to change the bundle structure, but I'm not sure it is something I can do: http://stackoverflow.com/questions/25950544/codesign-what-are-unsealed-contents
     
    Last edited: Dec 18, 2014
  20. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    Thanks matias- will look into it this weekend.
    Brian
     
  21. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    matias and anyone else having trouble building to device : i do believe it's been fixed...i submitted an update to the asset store, but if you need it to build before VTP 2.2.0 is published on the store, overwrite your Assets/Plugins/iOS/libVTPAVFMobile.a with this one: http://www.chasalow.com/libVTPAVFMobile.a
     
  22. Gunhi

    Gunhi

    Joined:
    Apr 18, 2012
    Posts:
    300
    is anyone would make it work on Adnroid? that gonna be really awesome!!!
     
  23. cleoag

    cleoag

    Joined:
    Apr 20, 2013
    Posts:
    12
    can you please add support https:// ?
     
  24. BeyondReality

    BeyondReality

    Joined:
    Mar 25, 2013
    Posts:
    7
    Hi Brian,

    great plugin! Been a real life saver for me.
    I just ran into a problem which I hope you can help me with.

    I have a couple of simple videos which all work nicely, but on iOS their color seems off, all the yellow tints are greenish.
    While in the OSX editor they seem just fine.

    Any idea?
     
  25. dm_bond

    dm_bond

    Joined:
    Sep 19, 2011
    Posts:
    62
    I confirm color issue on iOS for 2.2.3 and confirm 64 bit support.
     
  26. tmori

    tmori

    Joined:
    Feb 25, 2013
    Posts:
    2
    there is a color issue.
    color of movie is so weird.
    I coudn't see blue channel of movie.
    only red and green. how can I fix this?
    I'm using unity 4.6.1p3 , ios8 iphone6 and ipad mini retina
    thank you
     
  27. tmori

    tmori

    Joined:
    Feb 25, 2013
    Posts:
    2
    same issue!!
     
  28. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    i think y'all are probably using the old backing type. the new backingTypes use no-texture-copy texture updating which should make your game more efficient.

    for now, until i officially deprecate the old types and handle it in code in an update, do this.
    I would recommend using IOSONLY_FASTPATH_RGBA, and set it either from script like so:
    VideoTexture vt = GetComponent<VideoTexture>();
    vt.backingType = VideoTextureBackingType.IOSONLY_FASTPATH_RGBA;

    or simply select the gameObject in the project hierarchy, and set its backingType from the Debug Menu. See enclosed screenshot.
     

    Attached Files:

  29. aheidorn

    aheidorn

    Joined:
    Jan 17, 2013
    Posts:
    13
    I can confirm that setting the backingType to IOSONLY_FASTPATH_RGBA fixes the color issue, but leaves a coding task to flip the video on iOS (but not on OSX/Editor). Is there an easier way to get this to work like it used to (works 'the same' in Editor and iOS device)?
     
  30. dm_bond

    dm_bond

    Joined:
    Sep 19, 2011
    Posts:
    62
    I add to the vertex part of my simple vertex fragment shader this code
    Code (CSharp):
    1. #ifdef SHADER_API_MOBILE
    2. v.texcoord.y = 1.0 - v.texcoord.y;
    3. #endif
    and it's works 'the same'.
     
    aheidorn likes this.
  31. BrodyB

    BrodyB

    Joined:
    Dec 17, 2014
    Posts:
    10
    Hi Brian,

    First off, this plug-in is a life-saver, so thank you so much for making this and putting it out for free!

    Right now, I'm having the same issue SeTHBeaRzz reported back in October, where the Unity Editor crashes every time I stop editor game playback. I'm using Unity 4.6.1 and VTP 2.2.3.

    In my scene, I have a bunch of different planes with the Video Texture component on them, all with one video in their queue and set to PLAY_VIDEO_AND_STOP. When I activate one of the planes, I enable the object, tell it vt.load() and vt.IsPaused = false. I'm not sure if this way of using the plugin is what's causing the crash, but it happens 100% of the time I deactivate the Play button in editor.

    Thanks for any help!
     
  32. mm_adam

    mm_adam

    Joined:
    Dec 2, 2014
    Posts:
    3
    Hi Brian,

    I am getting this error:
    DllNotFoundException: VTPAVF
    VideoTexture.destroyVideoObject () (at Assets/Plugins/VTP/Scripts/VideoTexture.cs:727)
    VideoTexture.OnDestroy () (at Assets/Plugins/VTP/Scripts/VideoTexture.cs:720)

    I am using unity pro 4.6.1
     
  33. mm_adam

    mm_adam

    Joined:
    Dec 2, 2014
    Posts:
    3
    ERROR in Video Texture Pro 2.0. Could not find plugin: System.DllNotFoundException: VTPAVF
    at (wrapper managed-to-native) VTP:getCurrentPlatformEnum ()
    at VTP.get_IsVTPSupported () [0x00010] in C:\work\AR\projects\videos\VTP2.1.6beta\VTP\Assets\Plugins\VTP\Scripts\VTP.cs:113
    UnityEngine.Debug:LogError(Object)
    VTP:get_IsVTPSupported() (at Assets/Plugins/VTP/Scripts/VTP.cs:139)
    VTP:checkIfVTPSupported() (at Assets/Plugins/VTP/Scripts/VTP.cs:99)
    VTP:init() (at Assets/Plugins/VTP/Scripts/VTP.cs:155)
    VideoTexture:Awake() (at Assets/Plugins/VTP/Scripts/VideoTexture.cs:513)
     
  34. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    you're doing something wrong, if it can't find your plugin. Is this in the editor? is your platform set to iOS or OSX?
     
  35. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    BrodyB: wait for the next plugin on the asset store. alternatively, add the VideoInstance = createVideoTexture(); from Start() to Awake(), and it might solve some of your issues.
     
  36. mr-sambarlow

    mr-sambarlow

    Joined:
    Nov 11, 2014
    Posts:
    36
    Is it possible to use this script on a part of the new 4.6+ GUI? I'm using RawImage on PC with the standard video player, would love to be able to do something similar using VTP.
     
  37. BrodyB

    BrodyB

    Joined:
    Dec 17, 2014
    Posts:
    10
    Thanks for the response, Brian. Sorry for the late response.

    I moved the line VideoInstance = createVideoTexture() from Start into the end of the Awake function in VideoTexture.cs like you said, and BOOM! Editor's not crashing every time I stop game playback anymore. Thanks for the tip!
     
  38. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    Sure, assign the .RenderTex or the .NativeTexture (depending on which backingType you're using) to the rawImage.texture after VideoTextureLoaded() gets fired.
     
    mr-sambarlow likes this.
  39. SwabbyNat74

    SwabbyNat74

    Joined:
    Oct 27, 2014
    Posts:
    17
    I'm having an issue with an app that i'm using VTP heavily in right now.

    I'm using Parse.com to access ~500 mp4's (H264 codec) that stream into the app. The videos stream in perfectly, and everything seems to work just fine. However, on device there seems to be an issue with the video itself sometimes just abruptly stopping, without any external input. The app works great 95% of the time, until one of these videos suddenly stops. The odd part as well, is when i refresh that same video, it often works just fine, and continues to loop.

    I've turned Debugging on so i can watch for any errant signals that may be causing this, but so far, nothing comes up.

    I would love some help, if i can get this fixed, i may need to strip out VTP for something else, which i really don't want to do.
     
  40. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
  41. SuperTalesNat

    SuperTalesNat

    Joined:
    Mar 20, 2013
    Posts:
    18
    This typically only happens after the video has played through at least once. Wouldn't the buffer also catch up eventually and start playing again? These videos just stop, and never start again. Does streaming video content ever get saved to disk?

    -Nathaniel
     
  42. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    @SuperTalesNat: hmmm. what is the loopType set to? and no, streaming content doesn't technically get saved anywhere besides memory.
     
  43. SuperTalesNat

    SuperTalesNat

    Joined:
    Mar 20, 2013
    Posts:
    18
    They're currently set to PLAY_VIDEO_AND_STOP, but i've also tried playing it with LOOP_VIDEO. Both have the same issue, where the video will sometimes, randomly stop at some point while playing it (and not at the start/end handles).

    So when streaming it, its constantly streaming that data, and not caching locally to make for quicker/smoother playback once its fully loaded??
     
  44. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    Not sure what it's doing behind the scenes, whether caching after downloaded or otherwise. I'm literally just passing the http URL on to the AVFoundation decoder. If it's not likely to keep up, that bool should tell you. I don't expose that bool yet. So, yeah.
     
  45. SuperTalesNat

    SuperTalesNat

    Joined:
    Mar 20, 2013
    Posts:
    18
    How would i get at that bool, through some Obj-C call?

    I'm going to try one last thing, which is running in update to make sure the video hasn't stop, and if it has, restart it from that frame. Just need to see if when it freezes its sending a stop play msg to VTP or not.
     
  46. niall1111

    niall1111

    Joined:
    Nov 29, 2013
    Posts:
    14
    So I have implemented this on iOS, using IOSONLY_FASTPATH_RGBA backing type, and rotating my transform so the video isn't playing upside down. My issue is that the video is... backwards. most obviously when the video displays text, the text is all backwards, like you used to see on youtube videos trying to avoid the copyright hounds. Has anyone else experienced this? It plays properly in editor, only on iOS does the video appear backwards. Rotation can't have any effect on this, as far as I can tell?
     
  47. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    use something like:
    i.uv.x = 1.0 - i.uv.x;
    in a vertex shader
     
  48. niall1111

    niall1111

    Joined:
    Nov 29, 2013
    Posts:
    14
    Ahhh, I saw that mentioned elsewhere in this thread, but couldn't figure out how to implement it for the life of me... The default Unlit/Transparent shader doesn't look like something I could add that line to... Does anyone have a vertex shader specifically made for VTP on iOS? Maybe it could be included in the plugin?
     
  49. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    Didn't I include Unlit-Flipped.shader in the Resources folder?
     
  50. niall1111

    niall1111

    Joined:
    Nov 29, 2013
    Posts:
    14
    It doesn't appear to be included. I just checked for your latest on the asset store as well. I found an Unlit-YUVBiplanarFlipped shader, but there's no RGB equivalent. :( googling for unlit-flipped shaders isn't returning anything other than a shader that is named unlit-flipped but is decidedly NOT flipped. Thanks for the help though, i'll keep trying to track something down!