Video.js: I need to get the letterbox or video aspect ratio

Created on 1 Oct 2019  路  5Comments  路  Source: videojs/video.js

Can you tell videoJS about the size of Video's letter box or aspect ratio of the playback file?

Each file has a different aspect ratio, so it's hard to overlay it with accurate information.
No matter how I find it, there is no way to know?

answered

All 5 comments

馃憢 Thanks for opening your first issue here! 馃憢

If you're reporting a 馃悶 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.

You can provide an aspectRatio option and call the method manually with a value like "16:9".
https://docs.videojs.com/tutorial-options.html#aspectratio and https://docs.videojs.com/player#aspectRatio for docs.
You can also figure out the aspect ratio of a playing video by getting the videoHeight() and videoWidth().

Hope this helps.

You can provide an aspectRatio option and call the method manually with a value like "16:9".
https://docs.videojs.com/tutorial-options.html#aspectratio and https://docs.videojs.com/player#aspectRatio for docs.
You can also figure out the aspect ratio of a playing video by getting the videoHeight() and videoWidth().

Hope this helps.

thank you.

As a result of testing, aspect ratio could be calculated using player.videoWidth () and player.videoHeight () at the start of video playback.

Yup, just be aware that the earliest those values will be accurate is in the loadedmetadata handler.

Sounds like this has been answered?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kitsunde picture kitsunde  路  4Comments

gfviegas picture gfviegas  路  3Comments

SolmazKh picture SolmazKh  路  4Comments

uikoo9 picture uikoo9  路  4Comments

shivamg705 picture shivamg705  路  4Comments