Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

UIImagePickerController does not show movies from albums

WizfingerWizfinger Posts: 19Registered Users *
edited April 2010 in iPhone SDK Development
I am trying to use UIImagePickerController to have the user pick a MOVIE from the device, and make sure they do not pick an image file.

I cannot, however, seem to be able to access movie files that are inside the user's albums.

Using iTunes, I have put a compatible movie file on both the camera roll (if present) as well as in one of the albums on the following devices. Apple's own Photos application will easily show and play these movies on all devices.

However, I fail to comprehend the UIImagePickerController. The return values of availableMediaTypesForSourceType is even different on different devices:

iPhone (1G)
Never returns a kUTTypeMovie for none of the sourcetypes even if there is a video in one of the photo albums.

iPod touch (late 2009)
Never returns a kUTTypeMovie for none of the sourcetypes even if there is a video in one of the photo albums.

iPhone 3GS
Returns kUTTypeMovie in all of the sourcetypes, which is nice. Except when I set mediaTypes to kUTTypeMovie only (so no images), suddenly only the camera roll is available for picking and the albums are no longer shown even if there is a movie in them.

The question is: how can I make the user pick a movie file from BOTH the camera roll (if available) and the photo albums (if there is a movie in it)?

The way it is now this only works on the iPhone 3GS and even then I cannot leave out the images from the picker and display movies only.
Post edited by Wizfinger on

Replies

  • jamisonjamison Posts: 47Registered Users
    edited February 2010
    I have the same problem.

    On the native OS (iPhone 2G) I have users who can and access videos they have loaded onto the device - however UIImagePickerController does not pick them up. It only shows pictures.

    It all works fine on 3GS.

    Wizfinger wrote: »
    I am trying to use UIImagePickerController to have the user pick a MOVIE from the device, and make sure they do not pick an image file.

    I cannot, however, seem to be able to access movie files that are inside the user's albums.

    Using iTunes, I have put a compatible movie file on both the camera roll (if present) as well as in one of the albums on the following devices. Apple's own Photos application will easily show and play these movies on all devices.

    However, I fail to comprehend the UIImagePickerController. The return values of availableMediaTypesForSourceType is even different on different devices:

    iPhone (1G)
    Never returns a kUTTypeMovie for none of the sourcetypes even if there is a video in one of the photo albums.

    iPod touch (late 2009)
    Never returns a kUTTypeMovie for none of the sourcetypes even if there is a video in one of the photo albums.

    iPhone 3GS
    Returns kUTTypeMovie in all of the sourcetypes, which is nice. Except when I set mediaTypes to kUTTypeMovie only (so no images), suddenly only the camera roll is available for picking and the albums are no longer shown even if there is a movie in them.

    The question is: how can I make the user pick a movie file from BOTH the camera roll (if available) and the photo albums (if there is a movie in it)?

    The way it is now this only works on the iPhone 3GS and even then I cannot leave out the images from the picker and display movies only.
  • WizfingerWizfinger Posts: 19Registered Users *
    edited February 2010
    Hi,

    I have submitted a bug to Apple and they replied the following:
    I just heard back from the UIKit engineering team and you can't use the UIImagePickerController to pick video files from the user's photo library on a 3G iPhone or iPod Touch because they do not have a hardware h.264 encoder.

    Any video file that the user picks via UIImagePickerController is automatically re-encoded according to UIImagePickerController's videoQuality property. However, only on devices that physically have a hardware h264 encoder can we re-encode videos, so on devices that do not have a h.264 encoder, we cannot allow the user to pick videos via UIImagePickerController. Finally, iPhone 3GS is the only device that has a h.264 encoder.

    This said, there is a bug in selecting videos on the iPhone 3GS if you set the sourceType to UIImagePickerControllerSourceTypePhotoLibrary and set the mediaTypes to only contain kUTTypeMovie, it only show movies that are in the Camera Roll and not the movies that were synced to the device from iPhoto.
  • jamisonjamison Posts: 47Registered Users
    edited February 2010
    That's a really odd reply from Apple.

    My reasoning behind thinking this is that if you use an app like Qik (for example) on 2G/3G and export your videos then the native iPhone app 'Photos' will happily show and play the videos in the camera album - just like on the 3GS.

    So it may sound a bit cynical, but I'm not so sure Apple are quite right on that one! I think its more a bug in the SDK.

    If they can show and play videos in the Photos app then there are no short comings in the hardware, only the implementation of UIImagePickerController.

    In fact, I'd be tempted to reply with proof that it is a bug, because it must be!
    Wizfinger wrote: »
    Hi,

    I have submitted a bug to Apple and they replied the following:
  • jamisonjamison Posts: 47Registered Users
    edited February 2010
    I have submitted another bug report to apple, perhaps from a different angle to yours.
    16-Feb-2010 10:01 AM Jamison Charlesworth:
    Summary

    The iPhone 2G and 3G models do not have a camera or hardware encoding to record videos natively. However they can select movies from the 'Photos' app and also play them just like the 3GS model.

    If you use an app like 'Qik' to write a movie to the photo album, then the native 'Photos' app can happily list it alongside photos and play it.

    It is also possible to write movies to the album folder in 2g/3g (and of course 3GS) via UISaveVideoAtPathToSavedPhotoAlbums();

    Steps to reproduce

    On a 2G or 3G, create a movie via Qik app, export to the photos album.
    Exit Qik app, go to the native iPhone 'Photos' application.
    View and play saved videos.

    this proves that the photos app, can and does see kuTTypeMovie in the album.

    Then, in Xcode have an application do the following on 2G/3G.

    NSArray *sourceTypes;

    sourceTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypePhotoLibrary];

    for( NSString *type in sourceTypes )
    {
    NSLog( @"Source type [%@]" );
    }

    Then repeat for the other non camera source type UIImagePickerControllerSourceTypeSavedPhotosAlbum.

    (Do not do SourceTypeCamera as obviously this should never return kuTTypeMovie on 2G or 3G because hardware does not support it).

    Expected results
    For the 2 non camera source types, you would expect to see both kuTTypeMovie and kuTTypeImage - especially since the native photos.app can do this.

    Actual results
    You'll see that kuTTypeMovie is missing for the two album type of sources, this is a bug. If the photos app can see and play them; then the SDK should.

    Regression
    Occurs always on 2G/3G hardware 3.0 OS+.

    Notes
    It causes confusion for users of 2G/3G when videos can be displayed and played by photos.app, but not by 3rd party apps. It makes the iPhone look inconsistent and the 3rd party app poor.

    There is no hardware constraint to prevent the app seeing the movies, so kuTTypeMovie should be returned. Just as it appears to be for photos.app.

    It should not of course be retured for a source type of UIImagePickerControllerSourceTypeCamera because the hardware does not support this.
  • slugoliciousslugolicious Posts: 8New Users
    edited March 2010
    Apparently misery loves company. I ran into this same issue today (as well as the crashing you posted about on the Feb 14th).

    I want to display the library to allow users to choose videos, even if their device doesn't support *recording* videos. Setting mediaTypes to kUTTypeMovie crashes on devices that don't have a video recorder (ie, non-3GS phones). However, it works ok on the iPhone simulator.

    When asking the simulator for availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera, it returns a NIL array, as expected because the simulator doesn't have a camera.

    If I set mediaTypes to kUTTypeMovie and sourceType to UIImagePickerControllerSourceTypePhotoLibrary on the simulator, it happily displays a dialog that says I don't have any videos, as shown in the attached screen shot. (Interesting that the title of the window says "Saved Photos" but under the image it says "No Videos".)

    The screen shot is exactly what I want to get on the non-video-recording devices.
    Screen shot 2010-03-08 at 3.44.43 PM.jpg
    1 x 1 - 7K
  • slugoliciousslugolicious Posts: 8New Users
    edited March 2010
    Not only does UIImagePickerController not show movies, it crashes as noted in jamison's posting on Feb 14th.

    I want to display the library to allow users to choose videos, even if their device doesn't support *recording* videos. Setting mediaTypes to kUTTypeMovie crashes on devices that don't have a video recorder (ie, non-3GS phones). However, it works on the iPhone simulator.

    When asking the simulator for availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera, it returns a NIL array, as expected because the simulator doesn't have a camera.

    If I set mediaTypes to kUTTypeMovie and sourceType to UIImagePickerControllerSourceTypePhotoLibrary on the simulator, it happily displays a dialog that says I don't have any videos, as shown in the attached screen shot. (Interesting that the title of the window says "Saved Photos" but under the image it says "No Videos".)

    If I do the same thing on a real device, it crashes.

    The screen shot is exactly what I want to get on the non-video-recording devices.
    Screen shot 2010-03-08 at 3.44.43 PM.jpg
    1 x 1 - 7K
  • guytz72guytz72 Posts: 1New Users
    edited April 2010
    Not only does UIImagePickerController not show movies, it crashes as noted in jamison's posting on Feb 14th.

    I want to display the library to allow users to choose videos, even if their device doesn't support *recording* videos. Setting mediaTypes to kUTTypeMovie crashes on devices that don't have a video recorder (ie, non-3GS phones). However, it works on the iPhone simulator.

    When asking the simulator for availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera, it returns a NIL array, as expected because the simulator doesn't have a camera.

    If I set mediaTypes to kUTTypeMovie and sourceType to UIImagePickerControllerSourceTypePhotoLibrary on the simulator, it happily displays a dialog that says I don't have any videos, as shown in the attached screen shot. (Interesting that the title of the window says "Saved Photos" but under the image it says "No Videos".)

    If I do the same thing on a real device, it crashes.

    The screen shot is exactly what I want to get on the non-video-recording devices.

    Have any of you guys had any luck with workarounds for picking a video from the camera roll on a 2G/3G phone?

    I have an app where this is a requirement, it works fine on a 3GS as stated but not on a 2G/3G.
Sign In or Register to comment.