【问题标题】:How to play a playlist with music files in application?如何在应用程序中播放带有音乐文件的播放列表?
【发布时间】:2011-08-28 09:19:07
【问题描述】:

如何在应用程序而不是 ipod 库中播放带有音乐文件的播放列表?我想使用 MPMusicPlayerController 但它只能播放库中的音乐,除了 AVAudioPlayer 有什么建议吗?有谁知道如何更改下面显示的图标?像音乐下载器或潘多拉?感谢您的任何建议。

【问题讨论】:

  • AVQueuePlayer 可能对您有所帮助。
  • 此外,每当您在应用程序中播放音频时,那里的图标都会变为您应用程序的图标。它只是一种“活动应用程序”图标。要使用那里的控件来控制应用的音频,请查看this answer。

标签: iphone ios ipod


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多