ios - 使用MPMoviePlayerController流音频

标签 ios audio stream

我正在尝试从以下站点播放音频流:http://www.radioteofilotoni.com.br/

我有:

MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://stream.jshost.com.br:1935/mobile/8056.stream/playlist.m3u8"]];
player.movieSourceType = MPMovieSourceTypeStreaming;
player.view.hidden = YES;
[self.view addSubview:player.view];
[player play];

什么都没玩,怎么了?我可以从Safari访问此m3u8链接并播放。

谢谢。

最佳答案

该URL不返回音频流,而是返回一个如下所示的文本文件:

#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=52855
http://stream.jshost.com.br:1935/mobile/8056.stream/playlist.m3u8?wowzasessionid=1884064341

加载该URL会提供更多非音频内容,您可以使用这些内容最终获得音频流URL。好像Mobile Safari解析文本文件以获取流URL。您也必须这样做,因为MPMoviePlayerController显然没有这样做。

关于ios - 使用MPMoviePlayerController流音频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16093869/

相关文章:

linux - 可安全中断的连续流压缩

ios - __block 没有 block 的存储类型?

iOS 8 : Background execution

android - Android,按下按钮时音乐播放滞后

ios - Swift:尝试播放音频文件时出现未知错误

c# - 设置任何应用程序的音量

iphone - iPhone SDK 4 内置应用程序中的 Google Analytics

jquery - 如何为图像创建 3D 效果?

node.js - 显示来自 readStream 的 Nodejs 图像,但连接仍处于打开状态一分钟左右

c++ - 从 Poco http 客户端获取对字符串的响应