ios - MPMoviePlayerController 音频显示 "Done"按钮

标签 ios button mpmovieplayercontroller audio-streaming

我使用 MPMoviePlayerController 播放音频流。 我的代码遵循以下示例:

http://iosdevelopertips.com/video/getting-mpmovieplayercontroller-to-cooperate-with-ios4-3-2-ipad-and-earlier-versions-of-iphone-sdk.html

一切正常,但在播放流时没有“完成” 按钮关闭播放器。

我首先使用普通的 .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/

相关文章:

ios - 如何在 iOS 中单击注销按钮时移动到根 ViewController?

ios - Swift 3/SpriteKit - 用手指绘制独立的形状

java - 自定义按钮总是太大

ios - YouTube : This video contains content from vevo?

iphone - 视频播放如何缩放使整个视频画面显示在屏幕上

ios - MPMoviePlayerController 起始图像

ios - 没有 'decodeIfPresent' 候选产生预期的上下文结果类型 '[ModelMemberSubCategory]!'

objective-c - iOS (iPad) CoreGraphics & Foundation 内存问题

button - 瓦丁 : Upload button listener

html - 如何对齐包含在 div 中央和底部的按钮?