在上传之前获取视频尺寸,客户端 [英] getting video dimensions before upload, client-side

查看:146
本文介绍了在上传之前获取视频尺寸,客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个视频上传表单。用户点击浏览并选择一个文件。如何在用户选择文件的时刻获取视频尺寸(在文件甚至上传到服务器之前)。它显然必须是客户端,也许JavaScript / jQuery或Flash / Flex(喜欢js / jQuery的,但是),但他们中的任何一个可以这样做吗?

I have an upload form for an video. The user clicks browse and selects a file. How can I get the video dimensions the moment the user selects the file (before the file is even uploaded to the server). It obviously has to be something client-side with maybe javascript/jquery or flash/flex (prefer js//jquery though), but can either of them do this?

推荐答案

理论上你应该可以使用FileReader API - https ://developer.mozilla.org/en/DOM/FileReader

In theory you should be able to use the FileReader API - https://developer.mozilla.org/en/DOM/FileReader

一旦文件被读取,您就可以解析出标题。据我所知,没有人做过这样的JavaScript。

Once the file has been read, you can parse out the headers. As far as I know, nobody has ever done this in javascript.

这篇关于在上传之前获取视频尺寸,客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆