从摄像机获取视频并使用 MPMoviePlayerController IPhone SDK 显示
有没有人尝试过从相机中拍摄视频,然后使用提供的视频播放器来播放它? 当您以纵向模式拍摄视频时,有时会播放电影(当播放器将其置于横向模式时),而当将其置于纵向模式时,您无法观看电影,您听到的只是声音,有时在横向模式下是闪烁和无法正常播放,有人遇到过这种情况并找到解决方法吗? 我播放视频的代码如下所示:
- (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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您没有使用正确的 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];