Search Unity

play video in canvas on ios

Discussion in 'iOS and tvOS' started by BillyMFT, Aug 19, 2016.

  1. BillyMFT

    BillyMFT

    Joined:
    Mar 14, 2013
    Posts:
    178
    Hi all,

    Been searching for hours and can't find a good solution to this. I have gameplay videos being recorded and saved to the Documents directory on the device. There is a screen where the player can review the videos and choose one to share. Previously I was recording the screen and saving arrays of images, so it was easy enough to play them by by creating a sprite of each frame and inserting it into a UI image object, but with my new approach the videos are saved as mov files and I can't work out how to display them in the canvas.

    There are numerous movietexture unity plugins for iOS but I'm assuming these won't work with a canvas element.

    Do I need to call a native function to convert the video into jpg frames, load all these, turn them into sprites and insert them into the UI image object as I was before? I feel like this will take a while each time and won't be a good user experience.

    Any pointers would be appreciated.

    Thanks
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,448
    With this plugin can show video in gameobjects, works with UI RawImage too
    https://www.assetstore.unity3d.com/en/#!/content/10032

    I've only used in with android, not sure if it plays .MOV files,
    and pretty sure you cannot play it directly from documents folder,
    so needs some solution there to get the video into app first..
     
  3. BillyMFT

    BillyMFT

    Joined:
    Mar 14, 2013
    Posts:
    178
    Thanks for the reply. The RawImage support sounds promising. The asset description states

    "It also supports StreamingAssets, external storage, and streaming services. "

    So I would assume that includes the documents directory. Will email the author.

    Thanks again
     
  4. BillyMFT

    BillyMFT

    Joined:
    Mar 14, 2013
    Posts:
    178
    I can confirm that this plugin does exactly what I needed. Thanks!