发布网友 发布时间:2022-04-24 05:50
共3个回答
热心网友 时间:2022-04-22 17:19
----------------------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赋值------------------------------
热心网友 时间:2022-04-22 18:37
//<audio>标签;
热心网友 时间:2022-04-22 20:12
使用audio 标签 就可以了