how to playing audio in background mode when If i click on iphone button to “minimize” the app?

岁酱吖の 提交于 2020-01-03 15:23:08

问题


I'm work on new iphone audio application.

When i open the app, the Audio was loaded and started. If i click on iphone button to "minimize" the app, the sound was stopped. I need the sound still playing in background mode.

How i do this?

Thank you


回答1:


To play in the background, add an Array entry named "UIBackgroundModes" your .plist file, and add "audio" as array member.

.plist entry:

UIBackgroundModes Array
Item0 String audio



回答2:


Try to look at AVAudioSession also.

    AVAudioSession *session = [AVAudioSession sharedInstance];
    [session setCategory:AVAudioSessionCategoryPlayback error:nil];
    [session setActive:YES error:nil];

That should help.



来源:https://stackoverflow.com/questions/6785925/how-to-playing-audio-in-background-mode-when-if-i-click-on-iphone-button-to-min

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