使用 UIImagePickerController 从 iPhone 复制视频?

发布于 2024-09-06 06:47:24 字数 119 浏览 2 评论 0原文

嘿,我知道当用户选择一个视频时,我确实会得到该视频的 URL...但是您能否指导我正确的实现,因为当我在模拟器中单击“选择”时,我的应用程序就会停留在那里,并且我无法导航离开从视频播放器页面.... 这方面有什么好的教程吗?

Hey, I know that when a user selects a Video I do get a URL for the video.... but can you direct me to a proper implementation because my App just sticks there when I click choose in the simulator and I cannot navigate away from the Video Player page....
Any good tutorial on this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡淡绿茶香 2024-09-13 06:47:24

选择视频后,执行流向以下函数:

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

{

.... code here .....

//get the videoURL
NSString* videoURL= [info objectForKey:UIImagePickerControllerMediaURL];

//IMPORTANT: remember to test that the video is compatible for saving to the photos album

UISaveVideoAtPathToSavedPhotosAlbum(videoURL, self, @selector(video:didFinishSavingWithError:contextInfo:), nil);

.... code here .....

}

具体查看“UISaveVideoAtPathToSavedPhotosAlbum”。这允许保存到相机胶卷。

Once you select the video - execution flows to the following function:

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

{

.... code here .....

//get the videoURL
NSString* videoURL= [info objectForKey:UIImagePickerControllerMediaURL];

//IMPORTANT: remember to test that the video is compatible for saving to the photos album

UISaveVideoAtPathToSavedPhotosAlbum(videoURL, self, @selector(video:didFinishSavingWithError:contextInfo:), nil);

.... code here .....

}

Take a look into 'UISaveVideoAtPathToSavedPhotosAlbum' specifically. This allows saving to the camera roll.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文