Skip to content

Commit

Permalink
feat: add flag to turn off 708 captions (#1047)
Browse files Browse the repository at this point in the history
Add parse708captions as a VHS option to turn off 708 captions.
  • Loading branch information
gkatsev committed Jan 20, 2021
1 parent b072c93 commit ab5b4dc
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Video.js Compatibility: 6.0, 7.0
- [withCredentials](#withcredentials)
- [handleManifestRedirects](#handlemanifestredirects)
- [useCueTags](#usecuetags)
- [parse708captions](#parse708captions)
- [overrideNative](#overridenative)
- [blacklistDuration](#blacklistduration)
- [bandwidth](#bandwidth)
Expand Down Expand Up @@ -318,6 +319,13 @@ cuesTrack.addEventListener('cuechange', function() {
});
```

##### parse708captions
* Type: `boolean`
* Default: `true`
* can be used as an initialization option

When set to `false`, 708 captions in the stream are not parsed and will not show up in text track lists or the captions menu.

##### overrideNative
* Type: `boolean`
* can be used as an initialization option
Expand Down
9 changes: 6 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"global": "^4.4.0",
"m3u8-parser": "4.5.2",
"mpd-parser": "0.15.2",
"mux.js": "5.8.0",
"mux.js": "5.9.1",
"video.js": "^6 || ^7"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions src/master-playlist-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ export class MasterPlaylistController extends videojs.EventTarget {

const segmentLoaderSettings = {
vhs: this.vhs_,
parse708captions: options.parse708captions,
mediaSource: this.mediaSource,
currentTime: this.tech_.currentTime.bind(this.tech_),
seekable: () => this.seekable(),
Expand Down
2 changes: 2 additions & 0 deletions src/segment-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ export default class SegmentLoader extends videojs.EventTarget {
this.handlePartialData_ = settings.handlePartialData;
this.timelineChangeController_ = settings.timelineChangeController;
this.shouldSaveSegmentTimingInfo_ = true;
this.parse708captions_ = settings.parse708captions;

// private instance variables
this.checkBufferTimeout_ = null;
Expand Down Expand Up @@ -595,6 +596,7 @@ export default class SegmentLoader extends videojs.EventTarget {
transmuxer.postMessage({
action: 'init',
options: {
parse708captions: this.parse708captions_,
remux: false,
alignGopsAtEnd: this.safeAppend_,
keepOriginalTimestamps: true,
Expand Down

0 comments on commit ab5b4dc

Please sign in to comment.