video file transfer blob

// Create the XMLHttpRequest object 
 var xhr = new XMLHttpRequest(); 
 // configuration request mode, synchronous request address and whether 
 xhr.open('POST', './play', true); 
 // set the result of the request type is blob xhr.responseType = 'blob'; 
 // callback request succeeds 
 xhr.onload = function(e) {     
 if (this.status == 200) {
 // request was successful         
 // Get the blob         
 var blob = this.response;         
 // Get the blob object address, and assign a value to container         
 $("#sound").attr("src", URL.createObjectURL(blob));}}; 
 xhr.send();

Guess you like

Origin www.cnblogs.com/yishenweilv/p/11906391.html