search

Home  >  Q&A  >  body text

How to get duration of video in php and javascript?

I want to get the duration of the video when the user uploads the video. I don't want to put the video tag in html. I want to get video duration code in php and javascript or jquery. Thanks

P粉604669414P粉604669414329 days ago410

reply all(1)I'll reply

  • P粉245003607

    P粉2450036072024-01-30 00:29:06

    In HTML5 you can simply get the duration of a video using the duration function in JavaScript. For example:

    document.getElementById("video").duration();

    Please use the following command to check if it has been loaded: (otherwise an error will occur)

    document.getElementById("video").currentTime > 0;

    reply
    0
  • Cancelreply