Skip to main content

How can I determine the width and height of a video without going through the DOM?

If I want to determine the width and height of an image, I can do the following:

let image = new Image();
image.src = ...the source ;
image.decode();

console.log( image.width, image.height );

There is no need to create a DOM element to render the image and then obtain the the dimensions.

Is it possible to do something similar with a video? If so, how?

Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW

Comments