This repository was archived by the owner on Sep 28, 2025. It is now read-only.
Open
Conversation
Most of the subtitle handling in hlsjs-playback was inherited from the HTML5Video playback, which is fundamentally incompatible with the way hls.js wants to do things. This commit uses hls.js Subtitle Tracks Control API and related events to solve every issue I could find. This commit also adds better handling of `forced`,`default`,`autoselect` attributes than hls.js provides natively.
thiagopnts
added a commit
that referenced
this pull request
Oct 19, 2022
Bumped from 0.14.17 to 1.2.4. Didn't test extensively, but playback seems fine, only noticed an issue with captions, which seems to be related to #18 Bumping as a major to avoid this version being picked up by the other packages, since most I saw are pulling minors
thiagopnts
added a commit
that referenced
this pull request
Oct 19, 2022
Bumped from 0.14.17 to 1.2.4. Didn't test extensively, but playback seems fine, only noticed an issue with captions, which seems to be related to #18 Bumping as a major to avoid this version being picked up by the other packages, since most I saw are pulling minors lint
|
What has happened to this PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Most of the subtitle handling was being inherited from HTML5Video playback which is fundamentally incompatible with the way hls.js wants to do things. It caused many issues. This pull request fixes all the issues I found.
clappr/clappr#2003
Changes
Overrode several properties from the HTML5Video playback with hlsjs-specific implementations. The fixes are rather extensive; like I said, the existing subtitle implementation was fundamentally incompatible with hls.js. All issues I reported here are resolved by this pull request.
DEFAULT=YESattribute was added to one of the subtitle tracks in the HLS manifest. The problem was, hlsjs-playback was not listening to the right hls.js events, and therefore was unaware that subtitles were available unless hls.js automatically activated a subtitle track.cc-buttonGUI state and actual hls.js subtitle controller state. (see related PR in clappr-plugins)EXT-X-MEDIAtag attributesDEFAULT,AUTOSELECT, andFORCED. hls.js had some primitive handling ofDEFAULTbut this implementation is better, and effectively overrides hls.js default behavior.attributesfield to text tracks exposed via the playback'sclosedCaptionsTracksproperty.{ autoselect: true, default: true, forced: false }How to test
I've created a sample HLS video which can be used to test HLS playback with two subtitle languages.
TestPattern-min.zip
When extracted into the clappr repo's
publicfolder, it can be loaded on the test page (npm run start) by entering the relative URL toindex.m3u8.Prior to the changes in this pull request, there are many issues with the subtitle handling as described in the issue I posted last week. After applying this pull request, the issues are resolved and subtitles work as intended.