video文件转blob

//创建 XMLHttpRequest 对象 
 var xhr = new XMLHttpRequest(); 
 //配置请求方式、请求地址以及是否同步 
 xhr.open('GET', './play', true); 
 //设置请求结果类型为 
blob xhr.responseType = 'blob'; //请求成功回调函数 xhr.onload = function(e) { if (this.status == 200) { //请求成功 //获取 blob 对象 var blob = this.response; //获取 blob 对象地址,并把值赋给容器 $("#sound").attr("src", URL.createObjectURL(blob));}}; xhr.send();
posted @ 2019-11-21 16:22  以身为驴  阅读(2458)  评论(0编辑  收藏  举报