this.uniAudio = uni.createInnerAudioContext();
this.uniAudio.onCanplay(() => {
alert('11111')
this.canplay = true
});
this.uniAudio.onError(() => {
alert('22222')
});

山欲逢晚霞
- 发布:2024-07-30 09:41
- 更新:2024-07-30 10:51
- 阅读:497

你可以使用如下代码做个测试,如果不行你检查一下是否是你的音频有问题
const innerAudioContext = uni.createInnerAudioContext();
innerAudioContext.autoplay = true;
innerAudioContext.src = 'https://web-ext-storage.dcloud.net.cn/uni-app/ForElise.mp3';
innerAudioContext.onPlay(() => {
console.log('开始播放');
});
innerAudioContext.onError((res) => {
console.log(res.errMsg);
console.log(res.errCode);
});
山欲逢晚霞 (作者)
音频没有问题,在Android和ipad都试了可以播放,就是在iphone上不行
2024-07-30 11:02
DCloud_UNI_yuhe
回复 山欲逢晚霞: 那就是手机的问题吧
2024-07-30 11:04
山欲逢晚霞 (作者)
回复 DCloud_UNI_yuhe: 手机型号(iphone 13)或者是IOS版本(17.5.1)问题咩
2024-07-30 11:11