Improve font size calculation for vertical video#69
Improve font size calculation for vertical video#69Frenzie wants to merge 1 commit intovideojs:mainfrom
Conversation
Otherwise subtitles on vertical videos become comically large.
|
Technically the current behaviour is correct according to the VTT Tracks spec... but since it looks like the spec will eventually change to the behaviour in this PR, this doesn't seem unreasonable. w3c/webvtt/issues/522 |
|
I didn't realize that, but it definitely feels quite incorrect for vertical video to put it mildly. It's also not how the native players on e.g. iOS Safari, desktop Safari, Firefox or Chrome behave, as can be easily ascertained by taking the referenced testcase on https://jernoble.github.io/samples/bin/WebVTT/resize-aspect.html and removing the 5vh styling.[1] It's also not what VLC and mpv do. Here's the related WebKit fix, which somewhat to my surprise dates back only to 2023: https://commits.webkit.org/271536@main Which is to say, I can look into making it optional if you prefer, but in that case I'd advocate for making the per-spec behavior opt-in since it evidently never considered the use case of vertical video. I find it hard to imagine anyone would ever want it. [1] If you remove these parts from the source, horizontal and vertical video captions will display the same size in all browsers. body.cqmin ::cue {
font: 5cqmin/1 sans-serif !important;
}
body.cqh ::cue {
font: 5cqh/1 sans-serif !important;
}
|

Otherwise subtitles on vertical videos become comically large.
Before / after:

Behavior on horizontal videos is unchanged.