video文件转blob

//创建 XMLHttpRequest 对象 
 var xhr = new XMLHttpRequest(); 
 //配置请求方式、请求地址以及是否同步 
 xhr.open('POST', './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();

猜你喜欢

转载自www.cnblogs.com/yishenweilv/p/11906391.html
今日推荐