Iphone sdk支持通过网络播放mp3文件 [英] Iphone sdk support for playing mp3 files over the network
问题描述
我正在编写一个应用程序来联系桌面上运行的Web服务器来访问和播放mp3文件。
这是我到目前为止所尝试的:
我使用MPMusicPlayerController(并尝试过UIWebview)来处理音频文件,并在逐步下载文件后自动播放。在逐步下载文件后,没有办法处理跳过的歌曲和播放对于蜂窝网络来说不是一个好的解决方案。
I am writing an application to contact a webserver running on a desktop to access and play mp3 files. Here is what I tried so far: I have used MPMusicPlayerController (and tried UIWebview) to handle the audio file and it automatically plays after progressively downloading the file. There is no way to handle skipping songs and playing after progressive download of a file is not a good solution for cellular network.
理想情况下,我希望有以下功能
1.客户端请求使用特定比特率创建流(以处理不同的网络条件)
2.客户端应该能够跳过歌曲
Ideally, I would like to have the following function 1. Client requests a stream to be created using a specific bitrate (to handle different network condition) 2. Client should be able to skip songs
有人能指出我正确的方向吗? m3u8文件可以支持这些功能吗?
Can anyone point me in the right direction? Can m3u8 files support these functions?
感谢您提前获得任何帮助。
Thanks for any help in advance.
推荐答案
看看AVPlayer,它可以通过网络连接流式传输MP3。
Take a look at AVPlayer, it can stream MP3's over the network connection.
AVPlayer *player = [[AVPlayer playerWithURL:[NSURL URLWithString:@"http://www.mp3.com/mp3file.mp3"]] retain];
[player play];
这篇关于Iphone sdk支持通过网络播放mp3文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!