Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TTML: set default font size for ttml subtitles on parent element #1191

Merged
merged 1 commit into from
Dec 15, 2022

Conversation

peaBerberian
Copy link
Collaborator

@peaBerberian peaBerberian commented Dec 9, 2022

After investigating a weird subtitles cropping issue on some set-top boxes, we found out that the space between subtitle lines were in some situations not proportional to the choosen font's size of those same elements, leading after resizing elements to the impression that a line break was being "too large".

For example, reducing a text track element enough may lead to space between lines being too large. In the end, that space (though we're only talking in our case to 2 or 3 pixel higher than it should be) may lead to subtitles being cropped.

Reasons behind this non-proportionality seems linked to a browser's default rendering rules on which I'm not well versed. However a simple fix that seems logical - which is setting the default font-size to the parent elements of those subtitles (which should not break anything) - seems to fix the issue.

I'm not sure why this fixes things, as in my comprehension it shouldn't change anything, yet it does not seem to change in any way cases that were previously working and this new CSS logic theoretically still appears sound to me.

After investigating a weird subtitles cropping issue on some set-top
boxes, we found out that the space between subtitle lines were in some
situations not proportional to the choosen font's size of those same
elements, leading after resizing elements to the impression that a line
break was being "too large".

For example, reducing a media element enough may lead to space between
lines being too large. In the end, that space (though we're only talking
in our case to 2 or 3 pixel higher than it should be) may lead to
subtitles being cropped.

Reasons behind this non-proportionality seems linked to a browser's
default rendering rules on which I'm not well versed. However a simple
fix that seems logical - which is setting the default font-size to the
parent elements of those subtitles (which should not break anything) -
seems to fix the issue.

I'm not sure why this fixes things, as in my comprehension it shouldn't
change anything, yet it does not seem to change in any way cases that
were previously working and this new CSS logic theoretically still
appears sound to me.
@peaBerberian peaBerberian added bug This is an RxPlayer issue (unexpected result when comparing to the API) Subtitles Relative to subtitles TTML Relative to text tracks in the TTML format labels Dec 9, 2022
@peaBerberian peaBerberian added this to the 3.30.0 milestone Dec 9, 2022
@peaBerberian peaBerberian merged commit 343ce52 into master Dec 15, 2022
@peaBerberian peaBerberian mentioned this pull request Feb 21, 2023
@peaBerberian peaBerberian mentioned this pull request Jun 13, 2023
@peaBerberian peaBerberian deleted the fix/keep-consistent-ttml-height branch July 6, 2023 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This is an RxPlayer issue (unexpected result when comparing to the API) Subtitles Relative to subtitles TTML Relative to text tracks in the TTML format
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant