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

feat: add flag to turn off 708 captions #1047

Merged
merged 5 commits into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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