MPMoviePlayerViewController 在模拟器上只播放音频而不播放视频?

发布于 2024-09-26 03:41:23 字数 762 浏览 0 评论 0原文

我正在使用以下代码从 url 播放视频,但是当视频加载时,仅播放音频,并且模拟器上不显示视频。现在我无法在 iphone 4.0 设备上测试它。 .模拟器有问题还是 MPMoviePlayerViewController 方法不正确?

NSString *videoFilepath = @"http://www.migital.com/Hemant/1.3gp";
NSURL *videoURL = [NSURL URLWithString:videoFilepath ];

MPMoviePlayerViewController *movie = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];


[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(playbackFinishedCallback:)
                                             name:MPMoviePlayerPlaybackDidFinishNotification
                                           object:movie];

[self presentMoviePlayerViewControllerAnimated:movie];

i am using the following code to play a video from a url but when the video loads only audio is played and no video is shown on simulator..right now i cant test it on iphone 4.0 device...is there a problem with the simulator or is MPMoviePlayerViewController is not the right way??

NSString *videoFilepath = @"http://www.migital.com/Hemant/1.3gp";
NSURL *videoURL = [NSURL URLWithString:videoFilepath ];

MPMoviePlayerViewController *movie = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];


[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(playbackFinishedCallback:)
                                             name:MPMoviePlayerPlaybackDidFinishNotification
                                           object:movie];

[self presentMoviePlayerViewControllerAnimated:movie];

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

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

发布评论

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

评论(1

只怪假的太真实 2024-10-03 03:41:23

试试这个

NSString *videoFilepath = @"http://www.migital.com/Hemant/1.3gp";
NSURL *videoURL = [NSURL URLWithString:videoFilepath ];

MPMoviePlayerViewController *movie = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];


[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(playbackFinishedCallback:)
                                             name:MPMoviePlayerPlaybackDidFinishNotification
                                           object:[movie moviePlayer]];

[self presentMoviePlayerViewControllerAnimated:movie];
movie.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
[movie.moviePlayer play];

try this

NSString *videoFilepath = @"http://www.migital.com/Hemant/1.3gp";
NSURL *videoURL = [NSURL URLWithString:videoFilepath ];

MPMoviePlayerViewController *movie = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];


[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(playbackFinishedCallback:)
                                             name:MPMoviePlayerPlaybackDidFinishNotification
                                           object:[movie moviePlayer]];

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