InnerAudioContext.play() 在真机ios无法播放声音,devtool可以播放

小程序 文章 2020-09-03 10:41 651 0 全屏看文

AI助手支持GPT4.0

InnerAudioContext.play() 在真机ios无法播放声音,devtool可以播放InnerAudioContext.play() cannot play sound on real ios, devtool can play

InnerAudioContext.play() 在真机ios无法播放声音,devtool可以播放
框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 Bug InnerAudioContext.play() 微信iOS客户端 7.0.15 2.12.2

音频的地址

https://cos.ap-shanghai.myqcloud.com/6126-shanghai-007-shared-05-1256635546/219f-1400328244/4fb0-test1234/test1234-test1234-97538-tmp_9772e04de5d870a0559b27ee9291ce8e.m4a



Framework type problem type API / component name terminal type wechat version basic library version applet bug InnerAudioContext.play () address of wechat IOS client 7.0.15 2.12.2 audio https://cos.ap-shanghai.myqcloud.com/6126-shanghai-007-shared-05-1256635546/219f-1400328244/4fb0-test1234/test1234-test1234-97538-tmp_ 9772e04de5d870a0559b27ee9291ce8e.m4a

回答:

陈宇明:

使用下其他的播放API

LS-LA:

代码片段是:


clickTIMSoundElem: function(e, n, t) {

var o = this;

o.onPlaySoundURL.length ? (console.log("onPlaySoundURL非空"), o.onPlaySoundURL === t ? (console.log(

"onPlaySoundURL等于自己同一个生意"), a.paused ? (console.log(t, "自己暂停后,再播放"), a.play(), console.log(

"音频duration", a.duration)) : (a.pause(), o.onPlaySoundURL = "", console.log(t, "自己正在播放则 自己暂停同一个声音事件"),

console.log("音频duration", a.duration))) : (console.log("onPlaySoundURL新声音事件"), a.play(), console.log(t,

"播放新声音事件"), console.log("音频duration", a.duration))) : (console.log("onPlaySoundURL:初始值/重置后"), a.play(),

o.onPlaySoundURL = t, a.src = t, a.onPlay((function() {

console.log("首次,开始播放", t), console.log("音频duration", a.duration)

})), a.onPause((function() {

console.log(t, "onPause音频暂停事件事件"), o.onPlaySoundURL = ""

})), a.onEnded((function() {

console.log(t, "urlonEnded音频自然播放结束事件"), o.onPlaySoundURL = ""

})), a.onError((function(e) {

console.log(e.errMsg), console.log(e.errCode)

})))

},


因为想播放某一个声音的时候,停止其他(正在播放)声音,

如果那个声音是自己同一个element, 则暂停下来,

丶晓晓晓包:

最好贴上代码哦,如果有示例代码就最好了

仙ღ₅₂₀¹³¹⁴:

能写个可以复现问题的代码片段么

-EOF-

AI助手支持GPT4.0