Skip to content

Commit 9696b40

Browse files
authored
Add settings parameter streaming.text.extendSegmentedCues (Dash-Industry-Forum#4112)
* fix: extend last cue endTime in case of same cue but segmented over consecutive segments or chunks * fix: extend last cue endTime in case of same cue but segmented over consecutive segments or chunks * fix unit tests * fix: extend last cue endTime in case of same cue but segmented over consecutive segments or chunks * remove console.log * Add setting parameters streaming.text.extendSegmentedCues to enable/disable patching of segmented cues * Fix extendSegmentedCues jsdoc
1 parent 461ece4 commit 9696b40

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ declare namespace dashjs {
228228
},
229229
text?: {
230230
defaultEnabled?: boolean,
231+
extendSegmentedCues?: boolean,
231232
webvtt?: {
232233
customRenderingEnabled?: number
233234
}

src/core/Settings.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ import Events from './events/Events';
139139
* },
140140
* text: {
141141
* defaultEnabled: true,
142+
* extendSegmentedCues: true,
142143
* webvtt: {
143144
* customRenderingEnabled: false
144145
* }
@@ -452,6 +453,8 @@ import Events from './events/Events';
452453
* @typedef {Object} Text
453454
* @property {number} [defaultEnabled=true]
454455
* Enable/disable subtitle rendering by default.
456+
* @property {boolean} [extendSegmentedCues=true]
457+
* Enable/disable patching of segmented cues in order to merge as a single cue by extending cue end time.
455458
* @property {object} [webvtt={customRenderingEnabled=false}]
456459
* Enables the custom rendering for WebVTT captions. For details refer to the "Subtitles and Captions" sample section of dash.js.
457460
* Custom WebVTT rendering requires the external library vtt.js that can be found in the contrib folder.
@@ -865,6 +868,7 @@ function Settings() {
865868
},
866869
text: {
867870
defaultEnabled: true,
871+
extendSegmentedCues: true,
868872
webvtt: {
869873
customRenderingEnabled: false
870874
}

src/streaming/text/TextTracks.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,9 @@ function TextTracks(config) {
421421
}
422422

423423
function _extendLastCue(cue, track) {
424+
if (!settings.get().streaming.text.extendSegmentedCues) {
425+
return false;
426+
}
424427
if (!track.cues || track.cues.length === 0) {
425428
return false;
426429
}

0 commit comments

Comments
 (0)