Skip navigation
Currently Being Moderated

Cannot select videos in iOS CameraRoll.browseForImage()

Dec 19, 2012 10:47 AM

Tags: #video #flex-mobile #as3 #flex #mobile #ios #flex-4.6 #air3 #actionscript_3.0 #cameraroll #flash_builder_4.7

Well, obviously, because it's browseFor-Image-, however I -have- to have this functionality for our software and I don't see -any way whatsoever- in the documentation, via CameraRoll or otherwise to open the CameraRoll and filter for Videos.

 

I can use the camera to take videos.  I can use the camera to take pictures.  I can use the CameraRoll to browse photos already on the device and select one, but I cannot see a way to locate, display, and allow the user to select (and perhaps preview) a video for my software to use.

 

The ironic thing is that if I use the iOS Camera app and take video (which appears as an entity in the CameraRoll in the 'Photos' app), it uses the first frame of that for the folder preview... i.e., if I browseForImage() from Flex/AIR, when it opens the CameraRoll browser, the top "Folder" in the photo browser (named "Camera Roll") shows as it's icon a thumbnail taken from the first frame of the video I just took using the Camera App.  However, if I enter that folder to see the contents, it shows only photos and not the video from which it displayed the thumbnail.

 

Any help greatly appreciated.

 
Replies 1 2 Previous Next
  • Currently Being Moderated
    Jan 8, 2013 9:25 PM   in reply to Bramblethorne

    I really need this feature also. I opened a bug at bugbase.adobe.com #3308407 a while back (Air 3.3). You can go there and vote for it.

     
    |
    Mark as:
  • Andreas Bueler
    3 posts
    Jul 17, 2009
    Currently Being Moderated
    Jan 15, 2013 1:57 AM   in reply to Bramblethorne

    We also really need this feature. Does anybody know an ANE that provides this missing functionality?

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 21, 2013 3:52 PM   in reply to Bramblethorne

    I ran across this post while searching for this functinaliy. Since it seemed like AIR didn't support it I ended up putting together an extension. This should give you access to videos in the camera roll. https://bitbucket.org/lostirc/videoroll

     

    It's still a work in progress so please let me know if you find any bugs or have any feature requests.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 25, 2013 5:48 AM   in reply to Bramblethorne

    Thanks for trying this out. I do have a build not on the repo yet that lets you grab screenshots from any time in the video. Ill be getting that up soon.

     

    Thanks for catching the spelling errors, ill fix that later tonight as well.

     

    As for the air issue. Is your app descriptor XML targeting air 3.4?

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 25, 2013 5:57 AM   in reply to Bramblethorne

    I don't use flash builder but it seems like it might be trying to build this extension for those targets. On the screen with the red x is it possible to remove this extension from that build target? Is your project set up for android as well as desktop?

     

    If possible can you post your app.xml? I will take a look tonight

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 25, 2013 6:21 AM   in reply to Bramblethorne

    With the errors your posted I wouldn't think it's related to your device. The error is being thrown before it even makes it on.

     

    This extension should work on all devices running iOS 4 or later (though this is untested, I've only tested on an iPhone 4S running the current OS)

     

    I would check through your build settings and make sure you're not compiling the extension for other platforms

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 25, 2013 11:13 AM   in reply to Bramblethorne

    Try using the returnBytes implementation for now. There could be something wrong with the standard call. 

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 25, 2013 5:12 PM   in reply to Bramblethorne

    I just updated the repo with a new build that supports creating thumbnails from any time durring the video. Next step will be returning miltiple images from an array of times, hope to have that working by the end of the week.

     

    I also tested openVideoRoll and it seems to be working for me. I'm running this on an iPhone 4S running iOS 6.1.2. If you're still having issues after this update feel free to let me know.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 28, 2013 1:02 AM   in reply to frank_aq

    Hi, i have another problem with my own ANE i'm currently developing. The goal is to get all photos in CameraRoll and return them in an array (BitmapData or ByteArray, what's best ?) back

    to AIR.

    So far i can determine the photo thumbnails and fill them into an array of UIImage's.

    But how do i get this array now back to my AIR app ? Until now i have only found examples where the as3 code passes a container (ByteArray or BitmapData) to the C code where the result is filled into it.

     

    Can someone explain me please what i need to do that the array of thumbs can be returned altogether to the as3 part without passing any container from as3 ?

    It must be something similar as in method GetBitmapFromVideoAtTime.

     

    Thank you!

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 28, 2013 10:18 AM   in reply to Bramblethorne

    Yeah sure, no problem.

    If i make any progress i will post it here or i create an open GitHub repository for the ANE.

    And for large CameraRoll's i had the idea to enable a paging mechanism with a total number of returned thumbnails per context request and an offset.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 28, 2013 11:57 AM   in reply to Bramblethorne

    Hi Bramblethorne

     

    Thanks for helping me test this out, I'm bummed its not working for you. I'm not why the size of your camera roll would cause this issue but it's something worth looking into. If you have access to Xcode would you mind sending me over your crash log? If you need help finding it ping me and I'll help you out.

     

    Valley,

    You should be able to use code from my extension for getting bitmap data back from iOS. You don't actually return a bitmapdata object from c, you pass one in from as and acquire it on the native side. Feel free to take a look at my code and grab whatever you need.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 28, 2013 1:33 PM   in reply to frank_aq

    Thanks to both of you for your answers!

     

    @Bramblethorne: I'm talking about the iOS CameraRoll, where CameraRoll.browserForImage() is way too bad for me because i only get one photo per selection.

     

    @Frank: That's funny, i found your extension just today and tried it, but my app crashed in method uiImageToBitmapDataWithRef(), probably because of wrong code on my side.

    I need the functionality that your getBitmapFromVideoAtTimes() would perform in a similar way, unfortunately this part is missing in your extension yet. And i need it for the photos from CameraRoll,

    and that's an async procedure, which makes it a little bit more difficult. Therefore the array of BitmapData possibly can only be passed to C after the retrieval of CameraRoll's photos has been finished and as3 has been notified about that.

    What works so far in my ANE is this:

    • After the notification from C code that the photo thumbnails have been loaded and stored as UIImage objects in an array i iterate in as3 over the number of found photos, create in every step a BitmapData object with the dimensions of the thumbnails and pass it to another C method where the image at the passed index is retrieved and drawn to the passed BitmapData
    • This method is called n times (length of the array with found thumbnails)
    • With 83 photos in CameraRoll this takes around 5 seconds on my iPhone 4, therefore not very performant

     

    I will try next

    • If working with ByteArrays instead of BitmapData gives me better performance
    • If i will not be successful when passing 1x the array with n BitmapData (or ByteArray) objects from as3 to C where the complete array of photo thumbs will be processed in one step and written into the passed array objects
    • Working with paging mechanism (i.e. let's say you have 1'000 photos in you CameraRoll) to avoid memory problems

     

    If you have some insights (above all the 2nd step in my ToDo list) i would be very interested in it


    Thank you so far!

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 28, 2013 1:38 PM   in reply to valley t

    Hey valley,

     

    The crash in uiImageToBitmapDataWithRef seems like you don't have a cashed ui image on the native side

     

    When you made a call to openVideoRollReturnBytes did you pass in true for the last param?

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 28, 2013 2:00 PM   in reply to frank_aq

    Hi Frank,

     

    actually i only took your method uiImageToBitmapDataWithRef() for a test, nothing else. Therefore i also could not set any caching related properties nor use the functionality behind it.

    In the ContextInitializer of the C part i init now

     

    thumbs = [[NSMutableArray alloc] init];

     

    and this array is still there and filled when the requests from as3 are performed after the notification that the retrieval of the photo thumbs has been finished.

     

    I'm curious how ByteArray's will perform.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 1, 2013 10:01 AM   in reply to Bramblethorne

    Thanks. What iOS device are you trying this on? Ill see if I can harvest

    some older devices and debug this over the weekend.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 1, 2013 11:36 AM   in reply to Bramblethorne

    I was able to grab an iPad 2. Ill see what I can find.

     
    |
    Mark as:
  • DaveCates
    63 posts
    Sep 4, 2009
    Currently Being Moderated
    Mar 7, 2013 5:23 AM   in reply to Bramblethorne

    what about publishing/saving videos to the camera roll? any ideas on that?

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 7, 2013 6:24 AM   in reply to DaveCates

    Yeah that seems like a good idea. Any way you can supply me with a mobile

    project that uses the air video apis to record and save?

     
    |
    Mark as:
  • DaveCates
    63 posts
    Sep 4, 2009
    Currently Being Moderated
    Mar 7, 2013 6:41 AM   in reply to frank_aq

    Air video APIs to record and save?

     

    You need to do that yourself as we have

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 7, 2013 6:43 AM   in reply to DaveCates

    I think the AIR camera API will allow you to capture video from the device

    camera. Are you using an extension that does this though the native camera

    screen?

     
    |
    Mark as:
  • DaveCates
    63 posts
    Sep 4, 2009
    Currently Being Moderated
    Mar 7, 2013 6:46 AM   in reply to frank_aq

    We grab each frame from the camera using the Air Camera API then we're using our custom video ANE to encode to MP4.

     

    We now need to save this to the camera roll just like the OS does.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 7, 2013 7:16 AM   in reply to DaveCates

    Ah I see. I think in that case you just need to move it to a directory. It

    seems like you should be able to do it in the extension that creates your

    mp4

     
    |
    Mark as:
  • DaveCates
    63 posts
    Sep 4, 2009
    Currently Being Moderated
    Mar 7, 2013 8:12 AM   in reply to Bramblethorne

    We use an ANE for encoding because we're creating an AR app which uses animations and camera capture combined

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 25, 2013 8:03 PM   in reply to Bramblethorne

    I know it's been a little while, work has been a bit crazy.

     

    I just got around to finshing up support for generating multiple video thumbnails by passing in an array of requested times.

     

    New ANE is on the repo along with some instructions,

    https://bitbucket.org/lostirc/videoroll

     
    |
    Mark as:
1 2 Previous Next

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points