-
Notifications
You must be signed in to change notification settings - Fork 425
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
feat: Add an option to support forced subtitles #1329
Conversation
💖 Thanks for opening this pull request! 💖 Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
Thanks for the PR. This seems reasonable to me. Thoughts @videojs/collaborators? |
Codecov Report
@@ Coverage Diff @@
## main #1329 +/- ##
=======================================
Coverage 85.37% 85.37%
=======================================
Files 40 40
Lines 9953 9954 +1
Branches 2307 2308 +1
=======================================
+ Hits 8497 8498 +1
Misses 1456 1456
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
2540b44
to
91fa308
Compare
lovely, please merge ! |
Would we want the forced tracks to show up in the menu and be user-selectable, or just programatically selectable as Safari? Safari uses a |
In my opinion forced captions must be displayed without any user decision. Safari's programmatic approach is better. |
@mister-ben, @privaloops, thanks for the feedback. My initial thought was to opt for the simplest approach based on what different players in the market are doing. See: The idea of using a The proposed amendment would be as follows However, the use of Finally, I can also make a PR in the |
Hey! We've detected some video files in a comment on this issue. If you'd like to permanently archive these videos and tie them to this project, a maintainer of the project can reply to this issue with the following commands:
|
Hi @mister-ben, @gkatsev, is there anything I can do to help this PR be merged? |
91fa308
to
2540b44
Compare
2540b44
to
3204add
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay on your PR @amtins! It looks reasonable to me, but I'm not a playback expert.
Maybe I could get @adrums86 or @dzianis-dashkevich to have a look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My apologies for coming in late with this review. I had previously looked over this PR and simply forgot the final step, my approval 😁 ! Nice work, your contribution is greatly appreciated.
Updating the branch as it would be great to get this merged before the next release. |
Congrats on merging your first pull request! 🎉🎉🎉 |
Description
Proposal to introduce a new
useForcedSubtitles
option to access forced subtitles when available.Current State
Currently, VHS ignores forced subtitle tracks. This behavior makes it impossible to access such subtitles, when available, from
player.textTracks
.As a result, content with occasional foreign language dialogue cannot be translated, forcing the user to enable subtitles for the entire playback time.
Safari
Referring to the question asked in the Apple Developer Forums. Forced subtitles, if available, should be displayed automatically either according to the system language or the selected audio language. This seems to be confirmed by the Advice about subtitles section.
However, it seems that Safari does not implement this behavior, as confirmed by an Apple Media Engineer in point 2 of the response.
Finally, although Safari does not appear to implement this behavior correctly, forced subtitles are available via
document.querySelector('video').textTracks
, allowing them to be enabled programmatically.Http Streaming
The
media-groups.js
file mentions the implementation choice with reference to point 5.8 of the Apple's HLS Authoring Specification. However, this choice affects point 5.9 of the specification, especially when the content contains multiple audio and occasional translations are not burned into the video.Specific Changes proposed
videojs-http-streaming.js
by adding theuseForcedSubtitles
option which is false by default, which can be used as a initialization or source option.media-groups.js
file to support theuseForcedSubtitles
option.README.md
file documenting the new option.useForcedSubtitles
option.master-playlist-controller.test.js
file to ensure that forced subtitles are loaded.media-groups.test.js
file so that it does not have an undefined value.Use of the new option
src
Requirements Checklist