AVAudioPlayer: volume buttons work on some devices and not others

久未见 提交于 2019-12-10 19:11:07

问题


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.

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?


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.


回答1:


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.



来源:https://stackoverflow.com/questions/5588344/avaudioplayer-volume-buttons-work-on-some-devices-and-not-others

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