ios - AVPlayer 会停止用户的音乐吗?

标签 ios sprite-kit avplayer

我想知道 - 当 AVPlayer 开始播放时,用户的音乐会发生什么情况?什么都没发生,它停止了,还是这个 Action 取消了?如果是这样,我将如何检查用户是否正在播放音乐?

Apple 的文档让我很困惑。

最佳答案

好吧,为此查找信息,如果应用程序的 AVAudioSession 类别设置为 Solo,AVAudioPlayer 对象似乎只会中断用户的音频环境,默认值。

我看到了这个答案:App with AVPlayer plays mp4 interrupt iPod music after launched

我还在 Apple Developer 文档中看到了这张表,它解释了不同类别是否会打断用户的音乐,并提供了不同场景的示例,包括游戏场景:https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/Sound.html#//apple_ref/doc/uid/TP40006556-CH44-SW1

为了不打断用户的音乐,我需要将其设置为Ambient

关于ios - AVPlayer 会停止用户的音乐吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29858173/

相关文章:

objective-c - 在Sprite Kit iOS 10 Xcode 8中,还有比这更好的播放环境声音的方法吗?

ios - 未检测到 SpriteKit 碰撞

iphone - 应用程序进入后台时 AVPlayer 暂停和播放问题

ios - 如何在 UIView swift 中播放视频?

ios - 打开服务器后清除通知

ios - 以编程方式访问 iTunes 商店?

android - iOS 和 Android 设备之间的点对点通信

iphone - iOS 部署目标设置为 iOS 4.2。该应用程序可以在运行早期 iOS 版本的设备上运行吗?

ios - SpriteKit 和 UIScrollView 以及 HUD

ios - 使用 AVPlayer 播放流媒体视频