如何在应用程序中播放带有音乐文件的播放列表?

时间:2011-08-28 09:19:07

标签: iphone ios ipod

如何在应用程序而不是ipod库中播放带有音乐文件的播放列表?我想使用MPMusicPlayerController,但它只能从库中播放音乐,除了AVAudioPlayer之外的任何建议?有没有人知道如何更改下面显示的图标?喜欢音乐下载还是潘多拉?我很感激任何建议。

http://cdn.iostips.net/pandora_music_controls.jpg

1 个答案:

答案 0 :(得分:2)

要更改上方的图标,您只需将远程控制事件的应用程序注册为 -

if([[UIApplication sharedApplication]  respondsToSelector:@selector(beginReceivingRemoteControlEvents)])
        [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];

并且处理这些事件在这里看(一个解决方案是子类UIWindow) -

iOS 4: Remote controls for background audio

如果你想从流媒体播放音乐那么你可以使用mattgallagher的音频流媒体类,这里是github repo的链接 -

https://github.com/mattgallagher/AudioStreamer/blob/df17f971a2f8d482346400c9bb30d1b5d819baba/Classes/iPhoneStreamingPlayerViewController.h