How To Switch music from my app to the ipod

大憨熊 提交于 2019-12-31 04:16:48

问题


i am using MusicPlayerController object in my app to play music. i know that its possible to keep playing my app music when it's terminate on the iphone ipod app.

how can i do it?


回答1:


There are a few things involved.

You have to choose between two music players, the application music player and the iPod music player:

+ (MPMusicPlayerController *)applicationMusicPlayer;
+ (MPMusicPlayerController *)iPodMusicPlayer;

If you choose the iPodMusicPlayer, music will continue to play in the background and the user can stop it using the iPod (or Music) app.

If you choose the applicationMusicPlayer, by default the music will stop when you get sent to the background. If you want to continue playing, you'll have to set UIBackgroundMode in your Info.plist file to tell the system you should continue to run.

See: App States and Multitasking and Info.plist keys



来源:https://stackoverflow.com/questions/7993236/how-to-switch-music-from-my-app-to-the-ipod

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!