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

Discovery regarding YouTube subtitles on mobile #101

Open
pegiardinetti opened this issue Sep 13, 2024 · 0 comments
Open

Discovery regarding YouTube subtitles on mobile #101

pegiardinetti opened this issue Sep 13, 2024 · 0 comments

Comments

@pegiardinetti
Copy link

pegiardinetti commented Sep 13, 2024

It appears that YouTube handles subtitles quite differently on mobile than it does on browser. This is a very nice thing I found out regarding those differences.

Apparently, if you write the supported SAMI tags in a .ytt caption file using < and > they will be parsed both on mobile and browser. You will notice that, on browser, YouTube will add newlines around those tags, effectively making their use impossible.

However, if you add an empty <s> tag at the beginning of the line, it will cause the SAMI tags to be ignored on browser. From there, they can simply be hidden on browser by abusing the ruby text feature.

Therefore, the following captions will display "bold" as bold on browser only:

<?xml version="1.0" encoding="utf-8"?>
<timedtext format="3">
<head>
<pen id="1" b="1" />
</head><body>

<p t="1000" d="5000">It was very <s p="1">bold</s> of you.</p>
</body>

while the following captions will display "bold" as bold on both browser and mobile:

<?xml version="1.0" encoding="utf-8"?>
<timedtext format="3">
<head>
<pen id="1" b="1" />
<pen id="2" rb="1" />
<pen id="3" rb="2" />
<pen id="4" rb="4" />
</head><body>

<p t="1000" d="5000"><s p="1"></s>It was very <s p="2">&#x200d;</s><s p="3">&lt;b&gt;</s><s p="4"></s><s p="3"></s><s p="1">bold</s><s p="2">&#x200d;</s><s p="3">lt;/b&gt;</s><s p="4"></s><s p="3"></s> of you.</p>
</body>

This can be useful for displaying bold and underlined on mobile, which is not currently supported through .ytt subtitles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant