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

Add settings parameter streaming.text.extendSegmentedCues #4112

Merged
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ declare namespace dashjs {
},
text?: {
defaultEnabled?: boolean,
extendSegmentedCues?: boolean,
webvtt?: {
customRenderingEnabled?: number
}
Expand Down
4 changes: 4 additions & 0 deletions src/core/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ import Events from './events/Events';
* },
* text: {
* defaultEnabled: true,
* extendSegmentedCues: true,
* webvtt: {
* customRenderingEnabled: false
* }
Expand Down Expand Up @@ -452,6 +453,8 @@ import Events from './events/Events';
* @typedef {Object} Text
* @property {number} [defaultEnabled=true]
* Enable/disable subtitle rendering by default.
* @property {boolean} [extendSegmentedCues=true]
* Enable/disable patching of segmented cues in order to merge as a single cue by extending cue end time.
* @property {object} [webvtt={customRenderingEnabled=false}]
* Enables the custom rendering for WebVTT captions. For details refer to the "Subtitles and Captions" sample section of dash.js.
* Custom WebVTT rendering requires the external library vtt.js that can be found in the contrib folder.
Expand Down Expand Up @@ -865,6 +868,7 @@ function Settings() {
},
text: {
defaultEnabled: true,
extendSegmentedCues: true,
webvtt: {
customRenderingEnabled: false
}
Expand Down
3 changes: 3 additions & 0 deletions src/streaming/text/TextTracks.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@ function TextTracks(config) {
}

function _extendLastCue(cue, track) {
if (!settings.get().streaming.text.extendSegmentedCues) {
return false;
}
if (!track.cues || track.cues.length === 0) {
return false;
}
Expand Down