我目前的代码:
Javascript
function pushFunc() {
mediaRecorder.requestData();
console.log(mediaRecorder.state);
mediaRecorder.ondataavailable = function (e) {
console.log("data size: ", e.data.size);
var encodeData = new Blob([e.data], { type: 'video/mp4' });
postBlobData(encodeData);
}
}
function postBlobData(blob) {
var formData = new FormData();
formData.append("blobContent", blob);
var request = new XMLHttpRequest();
request.open("POST", "/Device/Upload");
request.send(formData);
}
ASP.NET
**File: DeviceController.cs**
[HttpPost]
public string Upload(HttpPostedFileBase blobContent)
{
...
// return View();
}
Java脚本代码从Media记录器获取blob并尝试将其发布到Controller。
我是否应该以我应该的方式抓住并发布blob?
是否应该使用HttpPostedFileBase在服务器端接收发布请求?
Fiddler截屏#1
Fiddler截屏#2
Fiddler截屏#3