Is it possible to detect the aspect ratio of an HTML5 video element?
I know the video will just shrink to fit in the <video>
element's dimensions, but I want to detect the aspect ratio of the source video.
That way you could remove any black bars.
Sorry I don't see this answered anywhere else.
Best Answer
Pasting from another StackOverflow answer: https://stackoverflow.com/a/4129189/1353189
Source (HTML5 spec): http://www.w3.org/TR/html5/video.html#video
You can then calculate the aspect ratio by dividing the width by the height.