AVAudioPlayer:音量按钮可在某些设备上使用,而不能在其他设备上使用 [英] AVAudioPlayer: volume buttons work on some devices and not others

查看:58
本文介绍了AVAudioPlayer:音量按钮可在某些设备上使用,而不能在其他设备上使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用AVAudioPlayer播放某些嵌入式MP3文件的应用.音量按钮在我主要用于测试的3GS上可靠地工作-它们在4.1下工作,并且在升级到4.3.1后现在可以工作.在我老板的运行4.2.1的iPhone 4上,它们似乎根本无法在我们的应用程序中工作.在作为我的次要测试机器的iPod Touch(也运行4.2.1)上,我能够使它们工作一次,但无法重现我的操作方式.

I have an app that uses AVAudioPlayer to play some embedded MP3 files. The volume buttons work reliably on the 3GS I mostly use for testing -- they worked under 4.1 and work now after upgrading to 4.3.1. On my boss's iPhone 4 running 4.2.1, they don't seem to work in our app at at all; and on the iPod Touch (also running 4.2.1) that's my secondary test machine, I've been able to get them to work once but can't reproduce how I did it.

我尝试了一次发现的黑客,在应用程序启动时创建了一个虚拟AVAudioPlayer,但将其保持为prepareToPlay状态,发现我可以使用初始屏幕上的音量按钮,但是一旦我播放了真实的音频他们停止工作了.

I tried a hack I found, creating a dummy AVAudioPlayer at application startup but leaving it in prepareToPlay state, and found I was able to use the volume buttons on my initial screen, but once I was playing real audio they stopped working.

有人碰到这个吗?有什么想法为什么可以在某些手机上使用而不是在其他手机上使用?

Anyone run into this? Any ideas why it works on some phones and not others?

更新:我将Touch更新为4.3.1,问题消失了.因此,我认为它可能是4.2.1中的错误,但是我仍然想知道是否有人看到过它,并且/或者可以将我指向错误报告.

Update: I updated the Touch to 4.3.1 and the problem went away. I assume therefore it's probably a bug in 4.2.1, but I'd still like to know if anyone's seen it and/or can point me to a bug report.

推荐答案

我遇到了同样的问题.我发现YouTube应用正在AVAudioPlayer上设置默认音量.是在iPhone 4.3.3上发现的,所以我不确定您是否还可以.

I had same problem. I found that the YouTube App was setting the default volume on the AVAudioPlayer. Found this with iPhone 4.3.3 so I am not sure if you are out of the woods yet.

这篇关于AVAudioPlayer:音量按钮可在某些设备上使用,而不能在其他设备上使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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