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

Detect forced subtitles on Safari in directfile (and label) #1239

Merged
merged 1 commit into from Apr 11, 2023

Conversation

peaBerberian
Copy link
Collaborator

This update only concerns directfile contents, especially when playing HLS contents on safari.


As of now, no real standard exists to indicate through an HTML Text Track object whether that track represents "forced" subtitles.

There's been some proposal since 2013
(https://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-April/039374.html) to add the possibility to set the kind attribute of a TextTrack to "forced" but nothing has yet materialized in what is now the WHATWG HTML standard.

There's some very interesting discussion more "recently" in a whatwg Github issue here: whatwg/html#4472 (note: I'm more aligned with Nigel Megitt opinions on those things) but again it did not really materialize into something yet.

Yet Webkit, and by extension Safari, decided to add support (maybe in 2013? https://bugs.webkit.org/show_bug.cgi?id=114460) relying on the @kind to "forced" proposal.

Because it exists and it's better than nothing, I decided to add support for directfile contents (as other types of content don't need this, we already know whether a forced track is forced thanks to the Manifest) to Safari's way of doing it, considering it shouldn't break anything else.

I also saw that the label of a TextTrack was not actually translated to its resulting "label" property through the getAvailableTextTracks and getTextTrack API. I fixed that.

@peaBerberian peaBerberian added this to the 3.30.1 milestone Apr 4, 2023
This update only concerns directfile contents, especially when playing
HLS contents on safari.

---

As of now, no real standard exists to indicate through an HTML Text
Track object whether that track represents "forced" subtitles.

There's been some proposal since 2013
(https://lists.whatwg.org/pipermail/whatwg-whatwg.org/2013-April/039374.html)
to add the possibility to set the `kind` attribute of a `TextTrack` to
`"forced"` but nothing has yet materialized in what is now the WHATWG HTML
standard.

There's some very interesting discussion more "recently" in a whatwg
Github issue here: whatwg/html#4472 (note: I'm
more aligned with Nigel Megitt opinions on those things) but again it
did not really materialize into something yet.

Yet Webkit, and by extension Safari, decided to add support (maybe in
2013? https://bugs.webkit.org/show_bug.cgi?id=114460) relying on the
`@kind` to `"forced"` proposal.

Because it exists and it's better than nothing, I decided to add support
for directfile contents (as other types of content don't need this, we
already know whether a forced track is forced thanks to the Manifest) to
Safari's way of doing it, considering it shouldn't break anything else.

I also saw that the `label` of a `TextTrack` was not actually translated
to its resulting "label" property through the `getAvailableTextTracks`
and `getTextTrack` API. I fixed that.
forced? : boolean | undefined;
label? : string | undefined;
forced : boolean | undefined;
label : string | undefined;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing this just makes it more easy to catch issues (? meaning the absence of a field, whereas | undefined meaning that it has to be set explicitely to undefined)

@peaBerberian peaBerberian merged commit f81f052 into master Apr 11, 2023
4 checks passed
@peaBerberian peaBerberian mentioned this pull request Jun 13, 2023
@peaBerberian peaBerberian modified the milestones: 3.30.1, 3.31.0 Jun 13, 2023
@peaBerberian peaBerberian deleted the misc/forced-safari branch July 6, 2023 12:02
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

Successfully merging this pull request may close these issues.

None yet

1 participant