如何在PHP和JavaScript中获得视频持续时间?
我想在用户上传视频时获取视频的持续时间。 我不想将视频标签放入HTML。 我希望在PHP和JavaScript或JQuery中获得视频持续时间代码。 谢谢
I want to get the duration of the video while user uploading the video.
I dont want to put the video tag in html.
I want the getting video duration code in both php and javascript or jquery.
thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
在HTML5中,您只需在JavaScript中使用持续时间功能即可获得视频的持续时间。例如:
请检查是否已经使用以下内容已加载:(否则您会遇到错误)
In HTML5 you can simply get a video's duration in Javascript with the duration function. For example:
Do check if it has loaded already by using the following: (else you get an error)