问题描述
如何关闭&打开MPMoviePlayerController的音频.我尝试过useApplicationAudioSession此属性,即使它不起作用.你能帮我吗?
How to turn off & turn on audio of MPMoviePlayerController. I tried useApplicationAudioSession this property even though it is not working. Can you please help me?
推荐答案
答案永远不会太晚吧?我也在寻找一种方法来做,花了我一段时间才找到正确的链接.
Never too late to answer right? Was looking for a way to do it as well and it took me a while to find the right links.
首先请注意,useApplicationAudioSession
现在已被弃用(iOS 6)
First please note useApplicationAudioSession
is now (iOS 6) deprecated
设置环境音频会话将防止在其他应用程序中停止audo
Setting the ambient audio session will prevent stopping audo in other apps
在您的代码中的某处设置:[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];
Set this somewhere in your code:[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];
在我的情况下,将类别设置为AVAudioSessionCategoryAmbient
就可以了!
In my case setting the category to AVAudioSessionCategoryAmbient
did the trick!
这篇关于如何在MPMoviePlayerController iPhone中关闭音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!