-2

Hello I have problem in my code to getting duration of all videos. error showing me undefined below my code please help me anyone for that.

    $("video").each(function(){
var duration = $(this).attr('duration');
alert(duration);
});

It's giving me undefined alert please tell me where I doing wrong I want all videos duration before playing video.

JimHawkins
  • 4,843
  • 8
  • 35
  • 55
  • 2
    [This](https://stackoverflow.com/q/6380956/5051731) might help. Since we cannot see actual code, its hard to find the root cause. – YetAnotherBot Mar 03 '19 at 14:10

1 Answers1

0

You can try duration property of HTML5 video,

MDN refernece https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/duration#Syntax

Kunal Virk
  • 132
  • 5