使用 Dropzone.js 获取视频文件的持续时间
Get the duration of video file with Dropzone.js
我正在使用 Dropzone.js 上传内容。
我已经搜索了几个小时来寻找一种方法来获取视频文件的持续时间,就像这个库中可以访问的其他属性一样,比如“大小、宽度、高度和名称”,但是我没有找到任何东西。
有人可以帮我吗?
您需要使用外部库,一些 extension/application 在您的服务器上。例如 ffprobe。 javascript.
无法检查视频时长
如果您只使用标准 html5 格式,例如 mp4,您可以使用回调:
Dropzone.options.filedrop = {
init: function () {
this.on("complete", function (file) {
if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) {
console.log(file); // here you can check where is filename etc.
$('<video>').attr('src', value); // create video tag, and check it
}
});
}
};
我正在使用 Dropzone.js 上传内容。
我已经搜索了几个小时来寻找一种方法来获取视频文件的持续时间,就像这个库中可以访问的其他属性一样,比如“大小、宽度、高度和名称”,但是我没有找到任何东西。
有人可以帮我吗?
您需要使用外部库,一些 extension/application 在您的服务器上。例如 ffprobe。 javascript.
无法检查视频时长如果您只使用标准 html5 格式,例如 mp4,您可以使用回调:
Dropzone.options.filedrop = {
init: function () {
this.on("complete", function (file) {
if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) {
console.log(file); // here you can check where is filename etc.
$('<video>').attr('src', value); // create video tag, and check it
}
});
}
};