html52.com
我爱小程序-开发者交流社区

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



网友回复

社区技术运营专员-Riven:

你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

陈宇明:

使用下其他的播放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, 则暂停下来如果那个声音是自己同一个element, 则暂停下来,,

丶晓晓晓包:

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

仙ღ₅₂₀¹³¹⁴:

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

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付