PDA

View Full Version : allowsAirPlay crashing app




newtoiphonesdk
Jul 13, 2011, 11:35 PM
Ok, I figured out the problem, so stupid, wasn't putting setAllowsAirPlay.....aargh, so mad at myself. I do have another issue now. I wanted to add a feature to this app. On the app you can choose to Record a video to stream, or choose a video from the camera roll to stream. The feature I want to add is to have it save a recorded video to the camera roll, that way you don't lose those live candid moments once you quit the app. The issue I am running into, is that it is also saving a duplicate when the user chooses a video from the camera roll. How can I change my code so that it will only save when it is a recorded video? Here is my code for this segment:
-(IBAction) getVideolow:(id) sender {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.mediaTypes = [[[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil] autorelease];
picker.allowsEditing = YES;
picker.wantsFullScreenLayout = YES;
picker.videoQuality = UIImagePickerControllerQualityTypeLow;
[self presentModalViewController:picker animated:YES];
[picker release];
}

-(IBAction) getVideomedium:(id) sender {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerCameraCaptureModeVideo;
picker.mediaTypes = [[[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil] autorelease];
picker.allowsEditing = YES;
picker.wantsFullScreenLayout = YES;
picker.videoQuality = UIImagePickerControllerQualityTypeHigh;
[self presentModalViewController:picker animated:YES];
[picker release];
}

-(IBAction) getVideorecordlow:(id) sender {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerCameraCaptureModeVideo;
picker.mediaTypes = [[[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil] autorelease];
picker.allowsEditing = YES;
picker.wantsFullScreenLayout = YES;
picker.videoQuality = UIImagePickerControllerQualityTypeLow;
[self presentModalViewController:picker animated:YES];
[picker release];
}


-(IBAction) getVideo:(id) sender {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.mediaTypes = [[[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil] autorelease];
picker.allowsEditing = YES;
picker.wantsFullScreenLayout = YES;
picker.videoQuality = UIImagePickerControllerQualityTypeHigh;
[self presentModalViewController:picker animated:YES];
[picker release];
}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:NO];
NSLog(@"Picked a movie at URL %@", [info objectForKey:UIImagePickerControllerMediaURL]);
moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];
UISaveVideoAtPathToSavedPhotosAlbum(moviePath, self, @selector(video:didFinishSavingWithError:contextInfo:), nil);


[self playMovie];
//[[picker self] dismissModalViewControllerAnimated:NO];

[[ UIApplication sharedApplication ] setIdleTimerDisabled: YES];

}

- (void)video:(NSString *) moviePath didFinishSavingWithError: (NSError *) error contextInfo: (void *) contextInfo {
if(error)
NSLog(@"didFinishSavingWithError: %@", error);
}