Skip to content

Commit

Permalink
Merge pull request video-dev#2550 from video-dev/feature/captions-608…
Browse files Browse the repository at this point in the history
…-channels-3-4

608/708 4 channel support
  • Loading branch information
robwalch authored Mar 17, 2020
2 parents 7a0d7e7 + d626d21 commit d47d184
Show file tree
Hide file tree
Showing 9 changed files with 488 additions and 283 deletions.
46 changes: 46 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@
- [`captionsTextTrack1LanguageCode`](#captionstexttrack1languagecode)
- [`captionsTextTrack2Label`](#captionstexttrack2label)
- [`captionsTextTrack2LanguageCode`](#captionstexttrack2languagecode)
- [`captionsTextTrack3Label`](#captionsTextTrack3Label)
- [`captionsTextTrack3LanguageCode`](#captionsTextTrack3LanguageCode)
- [`captionsTextTrack4Label`](#captionsTextTrack4Label)
- [`captionsTextTrack4LanguageCode`](#captionsTextTrack4LanguageCode)
- [`renderTextTracksNatively`](#renderTextTracksNatively)
- [`stretchShortVideoTrack`](#stretchshortvideotrack)
- [`maxAudioFramesDrift`](#maxaudioframesdrift)
- [`forceKeyFrameOnDiscontinuity`](#forcekeyframeondiscontinuity)
Expand Down Expand Up @@ -879,6 +884,47 @@ RFC 3066 language code for the text track generated for CEA-708 captions track 2

parameter should be a string

### `captionsTextTrack3Label`

(default: `Unknown CC`)

Label for the text track generated for CEA-708 captions track 3. This is how it will appear in the browser's native menu for subtitles and captions.

parameter should be a string

### `captionsTextTrack3LanguageCode`

(default: ``)

RFC 3066 language code for the text track generated for CEA-708 captions track 3.

parameter should be a string

### `captionsTextTrack4Label`

(default: `Unknown CC`)

Label for the text track generated for CEA-708 captions track 4. This is how it will appear in the browser's native menu for subtitles and captions.

parameter should be a string

### `captionsTextTrack4LanguageCode`

(default: ``)

RFC 3066 language code for the text track generated for CEA-708 captions track 4.

parameter should be a string

### `renderTextTracksNatively`

(default: `true`)

Whether or not render captions natively using the HTMLMediaElement's TextTracks. Disable native captions rendering
when you want to handle rending of track and track cues using `NON_NATIVE_TEXT_TRACKS_FOUND` and `CUES_PARSED` events.

parameter should be a boolean

### `stretchShortVideoTrack`

(default: `false`)
Expand Down
25 changes: 15 additions & 10 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,18 @@ type StreamControllerConfig = {
};

type TimelineControllerConfig = {
cueHandler: any, // TODO(typescript-cues): Type once file is done
cueHandler: Cues.CuesInterface,
enableCEA708Captions: boolean,
enableWebVTT: boolean,
captionsTextTrack1Label: string,
captionsTextTrack1LanguageCode: string,
captionsTextTrack2Label: string,
captionsTextTrack2LanguageCode: string,
captionsTextTrack3Label: string,
captionsTextTrack3LanguageCode: string,
captionsTextTrack4Label: string,
captionsTextTrack4LanguageCode: string,
renderTextTracksNatively: boolean,
};

type TSDemuxerConfig = {
Expand Down Expand Up @@ -158,7 +163,7 @@ export type HlsConfig =
MP4RemuxerConfig &
PlaylistLoaderConfig &
StreamControllerConfig &
Partial<TimelineControllerConfig> &
TimelineControllerConfig &
TSDemuxerConfig;

// If possible, keep hlsDefaultConfig shallow
Expand Down Expand Up @@ -247,18 +252,18 @@ export const hlsDefaultConfig: HlsConfig = {
};

function timelineConfig (): TimelineControllerConfig {
if (!__USE_SUBTITLES__) {
// intentionally doing this over returning Partial<TimelineControllerConfig> above
// this has the added nice property of still requiring the object below to completely define all props.
return {} as any;
}
return {
cueHandler: Cues, // used by timeline-controller
enableCEA708Captions: true, // used by timeline-controller
enableWebVTT: true, // used by timeline-controller
enableCEA708Captions: __USE_SUBTITLES__, // used by timeline-controller
enableWebVTT: __USE_SUBTITLES__, // used by timeline-controller
captionsTextTrack1Label: 'English', // used by timeline-controller
captionsTextTrack1LanguageCode: 'en', // used by timeline-controller
captionsTextTrack2Label: 'Spanish', // used by timeline-controller
captionsTextTrack2LanguageCode: 'es' // used by timeline-controller
captionsTextTrack2LanguageCode: 'es', // used by timeline-controller
captionsTextTrack3Label: 'Unknown CC', // used by timeline-controller
captionsTextTrack3LanguageCode: '', // used by timeline-controller
captionsTextTrack4Label: 'Unknown CC', // used by timeline-controller
captionsTextTrack4LanguageCode: '', // used by timeline-controller
renderTextTracksNatively: true
};
}
Loading

0 comments on commit d47d184

Please sign in to comment.