Note that there are some explanatory texts on larger screens.

plurals
  1. POMPMoviePlayerController dismisses my UIImagePickerController
    primarykey
    data
    text
    <p>I have an iPhone app where I load an <code>UIImagePickerController</code> onto a <code>UIViewController</code>. I then have a custom view on top of the camera. Now when the user takes a photo it is loaded onto a <code>UIImageView</code> which presents it to the user asking if you want to use that photo or take another (removing the image from the <code>UIImageView</code>). This works perfectly.</p> <p>Now If the user has just recorded a video I wanted to take a snapshot preview somewhere in the video and present it as a static image in the same <code>UIImageView</code>. I do this with the following code:</p> <pre><code>MPMoviePlayerController *videoPlayer = [[MPMoviePlayerController alloc] init]; videoPlayer.shouldAutoplay = NO; [videoPlayer setContentURL:[info valueForKey:UIImagePickerControllerMediaURL]]; UIImage *videoScreenShot = [videoPlayer thumbnailImageAtTime:(videoPlayer.duration/2.0) timeOption:MPMovieTimeOptionNearestKeyFrame]; photoPreview.image = videoScreenShot; [videoPlayer release] </code></pre> <p>This works as intended. The problem is if I want to take another video. When I call:</p> <p><code>[videoPlayer setContentURL:[info valueForKey:UIImagePickerControllerMediaURL]];</code></p> <p>The camera shutter closes and the camera is seemingly dismissed. Trying to take a picture or recording video gives me:</p> <pre><code>UIImagePickerController: ignoring request to take picture; camera is not yet ready. UIImagePickerController: ignoring request to start video capture; camera is not yet ready. </code></pre> <p>I've tried calling the following after, which has no effect:</p> <pre><code>myImagePicker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType: UIImagePickerControllerSourceTypeCamera]; [myImagePicker setSourceType:UIImagePickerControllerSourceTypeCamera]; </code></pre> <p>I tried adding the <code>UIImagePickerController</code> to the <code>UIIViewController</code> again, which caused some fantastic freeze-ups.</p> <p>Finally I tried commenting out the <code>UIViewController's</code> <code>[super didReceivedMemoryWarning]</code> line of <code>didReceivedMemoryWarning</code>. Which also had no effect.</p> <p>I'm guessing <code>MPMoviePlayerController</code> takes over something <code>UIImagePicker</code> also needs. How do I give it back?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload