----------------------1、转换音频流--------------------------
loadAudioInfo=(audioId)=>{
let _this = this
const url = api.getAudioPath(audioId)
const request = new window.XMLHttpRequest()
request.open('GET', url, true)
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
request.setRequestHeader("APPID", "huizhan");
request.setRequestHeader("X-Account-Info", JSON.stringify( {userId: Application.userInfo.userId} ));
request.responseType = 'arraybuffer'
request.onreadystatechange = function (res) {
if (request.readyState == 4 && request.status == 200) {
_this.setState({
conferenceAudioWav: 'data:audio/wav;base64,' + Buffer.from(request.response).toString('base64'),
})
}
}
request.onerror = (err) => {
}
request.send();
}
-----------------------------2、正常使用audio标签 src赋值------------------------------
//
使用audio 标签 就可以了