开发者

How to tell if already has audio focus?

开发者 https://www.devze.com 2023-03-31 10:23 出处:网络
I have an audio playback Android App which politely does a requestAudioFocus() when it starts playing, and abandonAudioFocus() when it stops.Sometimes the user will want to playback a different file i

I have an audio playback Android App which politely does a requestAudioFocus() when it starts playing, and abandonAudioFocus() when it stops. Sometimes the user will want to playback a different file in my app, I'd like to be able to check if I already have the audiofocus so that I don't do a request from myself. Looking at documentation for AudioManager I'm not seeing a way to do this -- seems like a rather blatant omission. Does anybody know if there is a way to d开发者_开发知识库etermine if a service already has the audio focus before calling request?

0

精彩评论

暂无评论...
验证码 换一张
取 消