我使用 MPMoviePlayerController 播放音频流。 我的代码遵循以下示例:
一切正常,但在播放流时没有“完成” 按钮关闭播放器。
我首先使用普通的 .mp3 文件对其进行了测试。与文件唯一
我发现的可能性是跳到最后,
所以播放器得到 MPMoviePlayerPlaybackDidFinishNotification
通知
(但这不会无休止地工作,因为没有时间表
跳到最后)。
我尝试了各种样式,例如 [mp setControlStyle:MPMovieControlStyleFullscreen];
但没有成功。
在文档中 MPMoviePlayerController Class站立:
This class plays any movie or audio file supported in iOS. This includes both streamed content and fixed-length files
是否有可能在播放某些音频时显示该按钮 内容,或者有没有其他解决方案?
我试着给你看截图,但“新用户最多只能发布两个超链接”。
最佳答案
我自己找到了解决方案。
使用 MPMoviePlayerViewController
类代替 MPMoviePlayerController
解决了问题:
NSString *path = @"http://yourstreamingurl.com/stream.m3u";
MPMoviePlayerViewController* mpviewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:path]];
mpviewController.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming;
[self presentModalViewController:mpviewController animated:YES];
[[mpviewController moviePlayer] play];
关于ios - MPMoviePlayerController 音频显示 "Done"按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5031853/