uni-app中使用createInnerAudioContext在Hbuilder X中播放音频没有声音
uni-app中使用createInnerAudioContext在Hbuilder X中播放音频没有声音
代码示例
console.log('开始播放1');
const innerAudioContext = uni.createInnerAudioContext();
innerAudioContext.autoplay = true;
innerAudioContext.src = "/static/touch_start.mp3";
innerAudioContext.onPlay(() => {
console.log('开始播放2');
});
innerAudioContext.onError((res) => {
console.log(res.errMsg);
console.log(res.errCode);
});
以上代码在Hbuilder X 4.24 中执行,只有客户端选择“PC模式”才能正常播放声音,选择其他手机型号均无法播放。编译到在微信开发者工具中也可以播放。
附件
更多关于uni-app中使用createInnerAudioContext在Hbuilder X中播放音频没有声音的实战教程也可以访问 https://www.itying.com/category-93-b0.html
1 回复