Commit 22aae6c5 authored by liujiaxin's avatar liujiaxin

qqqq

parent 88ae8435
......@@ -31,8 +31,7 @@
"rxjs": "~6.5.4",
"spark-md5": "^3.0.0",
"tslib": "^1.10.0",
"zone.js": "~0.10.2",
"node-sass": "4.0.0"
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.900.3",
......
......@@ -797,13 +797,22 @@ export class PlayComponent implements OnInit, OnDestroy {
}
url2Blob (url) {
return new Promise(resolve => {
return new Promise((resolve, reject) => {
console.log(' in url2Blob ..')
console.log(' in url2Blob ..');
console.log('url: ', url);
var xhr = new XMLHttpRequest();
xhr.open('get', url, true);
xhr.responseType = 'arraybuffer';
// const xhr = new XMLHttpRequest();
fetch(url)
// Retrieve its body as ReadableStream
.then(response => {
console.log(' in url2Blob load end..');
console.log(response.arrayBuffer);
resolve(response.arrayBuffer);
});
// xhr.open('get', url, true);
// xhr.responseType = 'arraybuffer';
// xhr.onload = () => {
// console.log(' in url2Blob load end..')
......@@ -814,6 +823,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// }
// };
/*
xhr.onreadystatechange = () => {
if (xhr.readyState !== 4) {
return;
......@@ -824,18 +834,20 @@ export class PlayComponent implements OnInit, OnDestroy {
if ((status >= 200 && status < 300) || status === 304) {
console.log('request success');
console.log(xhr.response);
console.log(xhr.response);
resolve(xhr.response);
} else {
console.log('request error');
console.log('xhr.response: ', xhr.response);
console.log('xhr.response1: ', xhr.response);
console.log('xhr.response2: ', xhr.responseText);
reject(xhr);
}
};
xhr.responseType = 'arraybuffer';
xhr.open('get', url, true);
xhr.send();
*/
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment