米琪卡哇伊
视频和音频原理一样,这里以音频为例。其实这个问题你需要和后台协商的, 假设后台有一个接受文件流的接口,那么代码类似这样:navigator.getUserMedia( // constraints
{ //video: true,
audio: true
}, // successCallback
function (localMediaStream) {
fetch(url, { method: 'POST', body: localMediaStream
})
}, // errorCallback
function (err) { console.log("The following error occured: " + err);
});
} else {
alert("getUserMedia not supported by your web browser or Operating system version");
}