API-Examples
API-Examples copied to clipboard
Failed to execute 'decodeAudioData' on 'BaseAudioContext': parameter 1 is not of type 'ArrayBuffer'.
Mac os 12.3 Vue 3.2 Chrome 105.0 agora-rtc-sdk-ng 4.14.0
When I try to use the web side createBufferSourceAudioTrack mixing, console always appear this error
AgoraRTC_N-production.js:30 Uncaught (in promise) TypeError: Failed to execute 'decodeAudioData' on 'BaseAudioContext': parameter 1 is not of type 'ArrayBuffer'.
at AgoraRTC_N-production.js:30:277666
at new Promise (<anonymous>)
at new t3 (AgoraRTC_N-production.js:5:26929)
at AgoraRTC_N-production.js:30:277649
at A2 (AgoraRTC_N-production.js:30:277753)
at async Object.createBufferSourceAudioTrack (AgoraRTC_N-production.js:30:293507)
at async Proxy.playAudioFile (detail.vue:655:28)
Here is my code:
async function playAudioFile(tempIndex: number) {
audioTempRep.value = await reqGetAudioTemp();
const list = audioTempRep.value.data;
const playLink = list[tempIndex].ossLink;
const audioFileTrack = await AgoraRTC.createBufferSourceAudioTrack({
source: playLink.toString(),
});
console.log('success oss link');
// 开始处理来自音频文件的音频数据
rtc.audioFileTrack.startProcessAudioBuffer();
await rtc.client.publish([rtc.localAudioTrack, audioFileTrack]);
}
i think you can't just use a file link as a source of buffersourceaudio track. apparently you will need a array buffer source here.