var audio = document.getElementById("currentAudio");
var params = JSON.stringify({ "SourceId": item.Id });
window.URL = window.URL || window.webkitURL;
this.currentTitle = item.SourceName;
var xhr = new XMLHttpRequest();
xhr.open('POST', '/xxxxx/xxxxxx', true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.responseType = "blob";
xhr.onload = function () {
if (this.status == 200) {
var blob = this.response;
audio.src = window.URL.createObjectURL(blob);
audio.play();
}
}
xhr.send(params);
不能。
AJAX 既不支持下载结束前就获取已下载的内容,也不支持流式操作。