Note that there are some explanatory texts on larger screens.

plurals
  1. POPlayback of a video stored on Camera Roll?
    text
    copied!<p>I'm having trouble trying to playback a video stored on an iOS device's camera roll. </p> <p>This is an <strong>Adobe AIR</strong> app, using two air native extensions (<strong>ANE</strong>):</p> <ul> <li>one extension for picking media (images and videos from the gallery)</li> <li>another extension for playback with <code>MPMoviePlayerController</code>.</li> </ul> <p>Here is the error code caught in the <code>MPMoviePlayerPlaybackDidFinishNotification</code>:</p> <pre><code>Error: Error Domain=MediaPlayerErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x8a0a20 {NSLocalizedDescription=The operation could not be completed} </code></pre> <p>Here is the code for the media picker ANE:</p> <pre><code>- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { if (self.popover) { [self.popover dismissPopoverAnimated:YES]; self.popover = nil; } else { [picker dismissModalViewControllerAnimated:YES]; picker = nil; } NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType]; // Handle a movie if (CFStringCompare((CFStringRef) mediaType, kUTTypeMovie, 0) == kCFCompareEqualTo) { self.videoPath = [[info objectForKey:UIImagePickerControllerMediaURL] path]; } } // This function is called by the native extension to retrieve the path of the video. DEFINE_ANE_FUNCTION(getVideoPath) { NSLog(@"Entering getVideoPath"); FREObject retValue = NULL; NSString *videoPath = [[AirImagePicker sharedInstance] videoPath]; FRENewObjectFromUTF8(strlen([videoPath UTF8String])+1, (const uint8_t *)[videoPath UTF8String], &amp;retValue); NSLog(@"Exiting getVideoPath"); return retValue; } </code></pre> <p>And here is the code for the playback ANE:</p> <pre><code>DEFINE_ANE_FUNCTION(loadVideo) { uint32_t stringLength; NSString *path = nil; const uint8_t *urlString; if (FREGetObjectAsUTF8(argv[0], &amp;stringLength, &amp;urlString) == FRE_OK) { path = [NSString stringWithUTF8String:(const char *)urlString]; } if (path) { [[[AirVideo sharedInstance] player] setContentURL:[NSURL fileURLWithPath:path]]; [[[AirVideo sharedInstance] player] play]; } return NULL; } DEFINE_ANE_FUNCTION(showPlayer) { UIView *rootView = [[[[UIApplication sharedApplication] keyWindow] rootViewController] view]; [rootView addSubview:[[[AirVideo sharedInstance] player] view]]; return nil; } - (MPMoviePlayerController *)player { if (!_player) { // Initializer movie player _player = [[MPMoviePlayerController alloc] init]; // Register for notifications [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerLoadStateDidChange:) name:MPMoviePlayerLoadStateDidChangeNotification object:_player]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerPlaybackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:_player]; } return _player; } </code></pre> <p>A trace for the video path shows this:</p> <pre><code>/private/var/mobile/Applications/5912AED1-S1DE-25EF-A8B-EF7AD21E3R65/tmp//trim.‌​uUcGJU.MOV </code></pre> <p>Any help will be much appreciated.</p>
 

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