音频中断事件的规则问题

小游戏 企业微信 微信支付 小程序 文章 2020-07-30 21:01 678 0 全屏看文

AI助手支持GPT4.0

音频中断事件的规则问题
问题类型 AppID
Bug wx2a7e3b589d3098f3

android系统,通过开发者工具-》真机调试,当播放音频时,闹钟发声并没有让在播放的音频中断,请问是否正常?相同背景下前后台切换,音频会正常触发暂停;若是语音电话发声,音频会暂停,但没有监听到onAudioInterruptionBegin。

想问一下,音频中断是否与调用onAudioInterruptionBegin相关,即没有调用的情况下,是否也会正常中断?

基础库版本 2.6.2


The problem type is appid bug wx2a7e3b589d3098f3 Android system. Through the developer tool - real machine debugging, when playing audio, the alarm clock does not interrupt the audio playing. Is it normal? Under the same background, when the front and background switch, the audio will normally trigger pause; if the voice phone sounds, the audio will pause, but onaudiointerruption begin is not monitored. I would like to ask whether the audio interrupt is related to the call of onaudiointerruptionbegin. In other words, if there is no call, will the audio interrupt be normal? Basic library version 2.6.2

回答:

Forever:

你的原话,若是语音电话发声,音频会暂停,但没有监听到onAudioInterruptionBegin。对于安卓系统是这样的,安卓系统无法监听到onAudioInterruptionBegin,但是发生语音电话发声的时候,这时小游戏已经进入后台,可以监听onShow方法进行兼容

Forever:可以参考官方的小游戏API调用示例(https://github.com/wechat-miniprogram/minigame-demo
张平:收到,明白了,感谢回复
张平:顺便反映一下ios上,正在播放音频时闹钟响起,播放语音会中断,但不产生任何事件(onAudioInterruptionBegin、audio 的onPause均不触发),请问这个是BUG么?ios:12.4.6
Forever:onShow有触发吗?
张平:没有触发。情况:wx小游戏页面时,页面上部提示闹钟声音,直接将闹钟提示向上滑动不进行页面切换,闹钟声音关闭且wx audio关闭,无任何事件产生
Forever:offAudioInterruptionEnd 那这个有回调吗? 那个中断结束事件?
张平:没有回调,没有触发
Forever:这就奇怪了,我测试offAudioInterruptionEnd这个API确实是由回调的

-EOF-

AI助手支持GPT4.0