简体   繁体   English

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

[英]Taking video from video camera and displaying it with MPMoviePlayerController IPhone SDK

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 我检查了文档上的设置似乎没有什么能解决这个问题...谢谢

I think you are not using the proper NSURL object 我认为你没有使用正确的NSURL对象

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

It should be 它应该是

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM