From 6bd98d015f2603dd4c4c939909cda990e5bed5ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <34163393+amtins@users.noreply.github.com> Date: Mon, 3 Apr 2023 18:38:48 +0200 Subject: [PATCH] feat: add an option to support forced subtitles (#1329) Co-authored-by: Adam Waldron --- README.md | 9 +++++ index.html | 5 +++ scripts/index.js | 9 +++-- src/media-groups.js | 2 +- src/videojs-http-streaming.js | 2 + test/media-groups.test.js | 4 +- test/playlist-controller.test.js | 69 ++++++++++++++++++++++++++++++++ 7 files changed, 95 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d8185e328..40a2ead35 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ Video.js Compatibility: 7.x, 8.x - [liveRangeSafeTimeDelta](#liverangesafetimedelta) - [useNetworkInformationApi](#usenetworkinformationapi) - [useDtsForTimestampOffset](#usedtsfortimestampoffset) + - [useForcedSubtitles](#useforcedsubtitles) - [captionServices](#captionservices) - [Format](#format) - [Example](#example) @@ -461,6 +462,14 @@ This option defaults to `false`. * Default: `false` * Use [Decode Timestamp](https://www.w3.org/TR/media-source/#decode-timestamp) instead of [Presentation Timestamp](https://www.w3.org/TR/media-source/#presentation-timestamp) for [timestampOffset](https://www.w3.org/TR/media-source/#dom-sourcebuffer-timestampoffset) calculation. This option was introduced to align with DTS-based browsers. This option affects only transmuxed data (eg: transport stream). For more info please check the following [issue](https://github.com/videojs/http-streaming/issues/1247). +##### useForcedSubtitles +* Type: `boolean` +* Default: `false` +* can be used as a source option +* can be used as an initialization option + +If true, this option allows the player to display forced subtitles. When available, forced subtitles allow to translate foreign language dialogues or images containing foreign language characters. + ##### captionServices * Type: `object` * Default: undefined diff --git a/index.html b/index.html index 3849c4023..04eae9142 100644 --- a/index.html +++ b/index.html @@ -171,6 +171,11 @@ +
+ + +
+