AVPlayer会停止用户的音乐吗? [英] Does AVPlayer stop the user's music?

查看:126
本文介绍了AVPlayer会停止用户的音乐吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道-当AVPlayer开始播放时,用户的音乐会怎样?什么都不会发生,会停止还是该动作会自行取消?如果是这样,我将如何检查并查看用户是否正在播放音乐?

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的文档对此感到困惑.

Apple's Documentation for this confused me.

推荐答案

好吧,查找相关信息,似乎AVAudioPlayer对象仅在应用程序的AVAudioSession类别设置为时才中断用户的音频. Solo Ambient,默认值.

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.

我看到了以下答案:启动后,带有AVPlayer的应用播放mp4中断iPod音乐

我还在Apple Developer文档中看到了该表,该表以不同场景的示例(包括一个游戏场景)说明了不同类别是否会打扰用户的音乐:

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

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

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

这篇关于AVPlayer会停止用户的音乐吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆