gpt4 book ai didi

ios - 仅在单击 'Save' 按钮时保存录制的视频

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:15:27 24 4
gpt4 key购买 nike

<分区>

我可以使用以下代码在我的应用程序上录制视频和执行播放:

- (IBAction)recordVideo:(id)sender {

if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];

[self presentViewController:picker animated:YES completion:NULL];
}
}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

self.videoURL = info[UIImagePickerControllerMediaURL];
[picker dismissViewControllerAnimated:YES completion:NULL];

self.videoController = [[MPMoviePlayerController alloc] init];

[self.videoController setContentURL:self.videoURL];
[self.videoController.view setFrame:CGRectMake (0, 40, 320, 385)];
[self.view addSubview:self.videoController.view];

[self.videoController play];
}

我还知道可以使用以下方式在播放时保存视频:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
if ([mediaType isEqualToString:@"public.movie"]){
// Saving the video / // Get the new unique filename
NSString *sourcePath = [[info objectForKey:@"UIImagePickerControllerMediaURL"]relativePath];
UISaveVideoAtPathToSavedPhotosAlbum(sourcePath,nil,nil,nil);
}

但是如何使用不同的按钮操作保存视频(例如:“保存视频”)?

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com