JavaScript object, parsed from a JSON string returned by the server
“text”
DOMString
“moz-blob”
Used by Firefox to allow retrieving partial Blob data from progress events. This lets your progress event handler start processing data while it’s still being received.
“moz-chunked-text”
Similar to “text”, but is streaming. This means that the value in response is only available during dispatch of the “progress” event and only contains the data received since the last “progress” event. When response is accessed during a “progress” event it contains a string with the data. Otherwise it returns null.This mode currently only works in Firefox.
“moz-chunked-arraybuffer”
Similar to “arraybuffer”, but is streaming. This means that the value in response is only available during dispatch of the “progress” event and only contains the data received since the last “progress” event.When response is accessed during a “progress” event it contains a string with the data. Otherwise it returns null.This mode currently only works in Firefox.
“ms-stream”
Indicates that the response is part of a streaming download. It is supported only for download requests. This mode is available only in Internet Explorer.
window.URL = window.URL || window.webkitURL; var assetURL = '../yingyong_720p.mp4'; var assetURL_2 = '../yingyong_720p_2.mp4'; var assetURL2 = '../frag_bunny.mp4'; var assetURL3 = '../teacher.mp4'; var assetURLnew = '../HTML5_history.mp4'; var xhr = new XMLHttpRequest; xhr.open('get', assetURLnew, true);
xhr.responseType = 'blob';
xhr.onload = function(){ console.log(this); if(this.status == 200 && this.readyState == 4){ var blob = this.response; console.log(blob); var reader = new FileReader(); reader.readAsArrayBuffer(blob); // reader.readAsBinaryString(blob); // reader.readAsDataURL(blob); // reader.readAsText(blob); reader.addEventListener("loadend", function() { // reader.result 包含转化为类型数组的blob console.log(reader); var arrayBuffer = reader.result; var dataView = new DataView(arrayBuffer); // 字符串的编码方法是确定的 console.log(dataView); // 回归到了二进制语言,解析计算机语言 1 和 0 。只要你肯花功夫,我觉得你会成功的。 // var abc16str = String.fromCharCode.apply(null, new Uint16Array(dataView)); }); video.onload = function(e){ window.URL.revokeObjectURL(video.src); } video.src =window.URL.createObjectURL(blob); } } xhr.send();