Does AVPlayer stop the user's music?

被刻印的时光 ゝ 提交于 2019-12-13 04:13:07

问题


I want to know -- what happens to a user's music when an AVPlayer starts to play? Does nothing happen, does it stop, or does the action cancel itself? If so, how would I check and see if the user is playing music?

Apple's Documentation for this confused me.


回答1:


Alright, looking up the info for this, it seems that AVAudioPlayer objects only interrupts the user's audio if the app's AVAudioSession's category is set to Solo Ambient, the default.

I saw this answer: App with AVPlayer plays mp4 interrupt iPod music after launched

I also saw this table in the Apple Developer documentation that explains whether or not different categories interrupt the user's music, with examples of different scenarios, including one for a game: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/Sound.html#//apple_ref/doc/uid/TP40006556-CH44-SW1

In order to not interrupt the user's music, I need to set this to Ambient.



来源:https://stackoverflow.com/questions/29858173/does-avplayer-stop-the-users-music

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