使用uni.createInnerAudioContext()播放base64音频无法正常播放
- Dominant language
- JavaScript
- Stars
- 41.6k
- Forks
- 3.7k
- Avg merge
- 7h 6m
- Merged PRs (30d)
- 6
Description
**问题描述**
使用uni.createInnerAudioContext()
在src中设置base64,如:data:audio/mp3;base64, *
提示MediaError,-99
是createInnerAudioContext无法播放base64吗?但是在audio组织中用base64可以正常播放;
**复现步骤**
[复现问题的步骤]
[或者可以直接贴源代码]
`speak(text) {
store.dispatch("GET_TTS_WS_BASE64", text).then(base64=>{
if(this.innerAudioContext){
this.innerAudioContext.stop()
this.innerAudioContext = null
}
this.innerAudioContext = uni.createInnerAudioContext()
this.innerAudioContext.src = base64
const that = this
this.innerAudioContext.onCanplay(()=>{
console.log('onCanplay');
that.innerAudioContext.play()
that.innerAudioContext.onEnded(()=>{
console.log('onEnded');
})
})
this.innerAudioContext.onError((res) => {
console.log('onError',res.errMsg);
console.log('onError2',res.errCode);
})
})
}`
**预期结果**
Android手机正常播放音频;
**实际结果**
[这里请贴上你的报错截图或文字]
innerAudioContext.onError中报错:MediaError,-99
**系统信息:**
- 发行平台: 5+ App
- 操作系统 [Android 10.0]
- HBuilderX版本 [ HBuilderX 版本号3.99]
- uni-app版本 [2]
- 设备信息 [霍尼韦尔EDA51K]
**补充信息**
[可选]
是不是对base64长度有要求?
Contributor guide
Assessment
This issue has not been assessed yet.