3

There is a way to get the video duration, without to have the video tag in the html ?

E.g:

var Video = $('<video></video>')
                            .append("<source src=video.mp4 type=video/mp4; codecs="+'"avc1.42E01E, mp4a.40.2"'+ "/>")
                            .append("<source src=video.webm type=video/webm; codecs="+'"vp8, vorbis"'+ "/>");

I want to get the duration from "Video", is it possible?

Xepe
  • 235
  • 5
  • 13

2 Answers2

1

Here is a link to a good page on the video tag.

Philip Tinney
  • 1,986
  • 17
  • 19
0

Try this

var vidElement = document.createElement('video');
$(vidElement).append("<source src=video.mp4 type=video/mp4; codecs="+'"avc1.42E01E, mp4a.40.2"'+ "/>").append("<source src=video.webm type=video/webm; codecs="+'"vp8, vorbis"'+ "/>");

console.log(vidElement.duration);

So in that way you dont have the html in your page just in memory if that is what you want

eli.rodriguez
  • 480
  • 2
  • 9
  • 22