从摄像机获取视频并使用 MPMoviePlayerController IPhone SDK 显示

发布于 2024-08-02 01:36:44 字数 570 浏览 6 评论 0原文

有没有人尝试过从相机中拍摄视频,然后使用提供的视频播放器来播放它? 当您以纵向模式拍摄视频时,有时会播放电影(当播放器将其置于横向模式时),而当将其置于纵向模式时,您无法观看电影,您听到的只是声音,有时在横向模式下是闪烁和无法正常播放,有人遇到过这种情况并找到解决方法吗? 我播放视频的代码如下所示:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    NSURL *urls=[info objectForKey:@"UIImagePickerControllerMediaURL"] ;
    moviePlayer = 
    [[MPMoviePlayerController alloc] initWithContentURL:[info urls]];

    if (moviePlayer)
    {

        [moviePlayer play];
    }
}

我检查了文档上的设置,似乎没有什么可以解决这个问题...谢谢

Has anyone tried taking a video from the camera and then using the video player provided to play it? When you take the video in portrait mode, sometimes the movie will play (when the player puts it in landscape mode) and when it puts it in portrait mode you cannot view the movie all you hear is sound,sometimes in landscape mode is flickers and does not play right, has anyone encountered this and found a way to fix it? My code to play the video looks like this:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    NSURL *urls=[info objectForKey:@"UIImagePickerControllerMediaURL"] ;
    moviePlayer = 
    [[MPMoviePlayerController alloc] initWithContentURL:[info urls]];

    if (moviePlayer)
    {

        [moviePlayer play];
    }
}

I checked settings on the docs nothing seems like it would fix this...Thanks

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

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

发布评论

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

评论(1

送舟行 2024-08-09 01:36:44

我认为您没有使用正确的 NSURL 对象

NSURL *urls=[info objectForKey:@"UIImagePickerControllerMediaURL"] ;
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[info urls]];

它应该是

moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL: urls];

I think you are not using the proper NSURL object

NSURL *urls=[info objectForKey:@"UIImagePickerControllerMediaURL"] ;
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[info urls]];

It should be

moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL: urls];

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