如何创建视频文件的blob

Min*_*ain 7 javascript blob node.js

我想为初学者创建一个本地视频文件文件的Blob:///home/user/NodeJS/Projects/project1/routes/../videosTrans/Node.js教程 - 介绍Node2的Node.js. js.mp4

我无法理解Blob的确切格式.我希望创建它以将其作为createObjectURL()函数的输入.以下不起作用:

 var URL = this.window.URL || this.window.webkitURL;
       var file = new Blob(["file:///home/sanika/NodeJS/Projects/project1/routes/../videosTrans/Node.js tutorial for beginners - an introduction to Node.js with Express2.js.mp4"], "type" : "video\/mp4");
       var value = URL.createObjectURL(file);
Run Code Online (Sandbox Code Playgroud)

小智 5

请使用 blob 的第二个参数作为对象。所以你的代码应该是:

var URL = this.window.URL || this.window.webkitURL;
var file = new Blob(
    ["file:///home/sanika/NodeJS/Projects/project1/routes/../videosTrans/Node.js tutorial for beginners - an introduction to Node.js with Express2.js.mp4"],
    {"type" : "video\/mp4"});
var value = URL.createObjectURL(file);
Run Code Online (Sandbox Code Playgroud)