Vue/js How long video is used to get videos

Source: Internet
Author: User

The project encountered the upload video function, need to have a preview and get the video length function, because before using upload (if necessary can refer to my previous article), here do not repeat, directly used to upload video, but before uploading and the successful upload after the hook, not get the length:

No time how to do it, can only use the native JS to obtain:

After the upload is successful, bind the successful path to video

Use JS to get duration and assign time parameters

Then you will find that the value you get is Nan

Video has not been loaded, can not be obtained synchronously, use the timer to solve

OK, now you can get it.

I hope this article is helpful to you!

Vue/js How long video is used to get videos

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.