cra*_*bus 4 button mpmovieplayercontroller audio-streaming ios
我使用MPMoviePlayerController播放音频流.我的代码遵循以下示例:
一切正常,但在播放流时,没有"完成"按钮关闭播放器.
我首先用普通的.mp3文件测试它.使用该文件我发现的唯一可能性是跳到最后,所以玩家获得MPMoviePlayerPlaybackDidFinishNotification
通知(但这不会在无休止的流上工作,因为没有时间轴跳到最后).
我试过各种风格,比如[mp setControlStyle:MPMovieControlStyleFullscreen];没有成功.
在MPMoviePlayerController类的文档中 :
此类播放iOS中支持的任何电影或音频文件.这包括流内容和固定长度文件
是否有可能在播放某些音频内容时显示该按钮,或者是否有其他解决方案?
我试图向您显示截图,但"新用户最多只能发布两个超链接".
cra*_*bus 13
我找到了自己的解决方案.
使用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];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7033 次 |
| 最近记录: |