Commit Graph

70 Commits

Author SHA1 Message Date
Álvaro Velad Galván 8e0e0d85c1 feat!: Remove setSequenceMode from TextParser plugins (#9326) 2025-10-31 16:14:52 +01:00
Wojciech Tyczyński 51765e9693 build: Change spellchecking tool and fix spelling mistakes (#7765)
Fixes #7693
2024-12-20 12:27:05 +01:00
Álvaro Velad Galván 0708379bad fix(WebVTT): Re-add rollover logic (#7104)
Fixes: https://github.com/shaka-project/shaka-player/issues/6448

Revert https://github.com/shaka-project/shaka-player/commit/9ab54d1485564065e02136b538b080186a0161e9
2024-07-26 04:16:50 -07:00
Álvaro Velad Galván 25427c764e fix(WebVTT): Fix multiline colored VTT subtitles (#6394)
Fixes https://github.com/shaka-project/shaka-player/issues/6374
2024-04-04 10:54:09 +02:00
Álvaro Velad Galván 286126edf1 fix(WebVTT): Remove rollover logic because we always transmux TS (#6397)
Fixes https://github.com/shaka-project/shaka-player/issues/6320
2024-04-04 10:24:37 +02:00
Joey Parrish 4ae15c2c6f refactor: Move sequence mode VTT offset calculations (#6332)
This moves VTT sequence mode offset calculations into a method.

It also makes all X-TIMESTAMP-MAP usage dependent on HLS specifically,
rather than sequence mode, simplifying the conditions. Sequence mode is
typically only used with HLS, and X-TIMESTAMP-MAP is explicitly only for
HLS. So excluding X-TIMESTAMP-MAP for DASH makes sense, instead of
conflating HLS and sequence mode.

This required updating some tests to explicitly set both the manifest
type and sequence mode flag.

This does *not* change the offset calculations themselves. Changes will
be made in follow-up PRs.

Issue #6320
2024-03-06 16:36:43 -08:00
Wojciech Tyczyński d0e64d7379 fix(VTT): fix setting textShadow when multiple CSS classes provided (#6287) 2024-02-26 08:16:05 +01:00
Dave Nicholas 335eab08ba feat(WebVTT): Handle badly formed VTT (#6147)
Handle remove chevrons that appear as part of the inner text of the
element to avoid parse failure.
2024-01-26 13:01:51 +01:00
Dave Nicholas ee600c4fd5 feat(WebVTT): Remove un-needed VTT payload normalisation (#6145)
The tXml parser gracefully handles this now, so it is no longer needed.
2024-01-23 16:53:50 +01:00
Álvaro Velad Galván f55c6ab997 refactor(WebVTT): Refactor how nestedCues are handled in WebVTT (#5663)
This change makes WebVTT more similar to how nestedcues are managed in
TTML.
2023-09-15 14:32:10 +02:00
Álvaro Velad Galván 6975be92d4 revert: "fix(WebVTT): Fix wrong writing-mode in nested cues (#5641)" (#5662)
This reverts commit 56a4cea578.

Fixes https://github.com/shaka-project/shaka-player/issues/5661
2023-09-15 13:08:07 +02:00
Álvaro Velad Galván 76ffd38c1d feat(WebVTT): Add support to ruby, rt, rp html tags (#5642)
Related to https://github.com/shaka-project/shaka-player/issues/2853
2023-09-12 14:27:07 +02:00
Álvaro Velad Galván a2f253f8d6 feat(WebVTT): Add support to text-combine-upright (#5633)
Related to https://github.com/shaka-project/shaka-player/issues/2853
2023-09-12 12:47:46 +02:00
Álvaro Velad Galván 56a4cea578 fix(WebVTT): Fix wrong writing-mode in nested cues (#5641)
Fixes https://github.com/shaka-project/shaka-player/issues/4765
2023-09-12 12:19:04 +02:00
Tom Bloom 9b1c614815 feat: Allow VTT files with erroneous linebreaks (#2394)
Bad linebreaks will now cause cues to be skipped (with a warning),
rather than throwing an error.

Closes #2358
Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2023-02-09 11:07:23 -08:00
Álvaro Velad Galván d4fc54f8dc fix(WebVTT): Tags in the WebVTT subtitle are not parsed (#4960)
Fixes https://github.com/shaka-project/shaka-player/issues/4956
2023-02-03 11:11:23 +01:00
Albin Larsson ed7a736ca2 feat(webvtt): webvtt colors output (#4954)
Adds color support for SimpleTextDisplayer and WebVttGenerator (only one
place to fix both now thanks to #4941).

It's limited to the [8 colors
classes](https://w3c.github.io/webvtt/#default-text-color) supported by
the WebVTT specification, and also works with their 3 or 6-digit hex
variants (if the stream has TTML subtitles).

It does not support rgb, rgba or any colors other than these 8.

Fixes #4545

---------

Co-authored-by: Alvaro Velad Galvan <ladvan91@hotmail.com>
2023-02-03 09:34:16 +01:00
Álvaro Velad Galván 68968c17d8 fix(WebVTT): Fix voices with styles and support to multiple styles (#4922) 2023-01-24 19:53:48 +01:00
Álvaro Velad Galván 726ef425b0 fix(WebVTT): Add support to &nbsp;, &lrm; and &rlm; (#4920) 2023-01-20 23:41:51 +01:00
Joey Parrish da84a2c86b fix: Fix WebVTT parser failure on REGION blocks (#4915)
We do not yet support VTT region settings, but we should still not fail
when a region block appears in a VTT file.

Related to work on PR #4767
2023-01-19 11:53:22 -08:00
Álvaro Velad Galván a5f8b4361e feat(WebVTT): Add support to voice tag styles (#4845)
closes https://github.com/shaka-project/shaka-player/issues/4844
fixes https://github.com/shaka-project/shaka-player/issues/4843
fixes https://github.com/shaka-project/shaka-player/issues/4479
2023-01-19 11:35:21 +01:00
Álvaro Velad Galván 2b8b38788a feat: Support HTML-escaped cues in VTT (#4660)
Co-authored-by: Joey Parrish <joeyparrish@users.noreply.github.com>
2022-11-09 16:02:46 -08:00
Joey Parrish 3b9af2efa6 fix: Fix HLS live stream subtitle offsets (#4586)
Subtitle timing and offsets were not calculated correctly for HLS live
streams. This issue appears to have affected all v4.x releases up to
v4.0.5, v4.1.5, and v4.2.2.
2022-10-17 19:27:55 -07:00
Álvaro Velad Galván 60af516520 feat(webvtt): add support for karaoke style text in WebVTT (#4274)
Closes https://github.com/shaka-project/shaka-player/issues/4264
Closes https://github.com/shaka-project/shaka-player/issues/3893
2022-06-07 11:12:33 +02:00
Álvaro Velad Galván 62bda2cd36 feat: Add support to text-shadow in VTT parser (#4257) 2022-05-27 07:52:55 +02:00
Joey Parrish 58182605a7 fix: Fix VTT cue timing in HLS (#4217)
Since the transition to sequence mode for HLS in v4.0.0, VTT cue
timings were broken.  This is mainly because VTT cue timing in HLS is
meant to be based on an offset from the media timestamps, and we
generally don't know those now that we use sequence mode.

To fix it, this change uses MediaSource segment mode for the very
first video segment as a way to extract the timestamp, then clears the
buffer, switches to sequence mode, and appends it again.  This lets us
get the timing data we need, while avoiding major drawbacks of the
previous HLS implementation:
 - We don't need to fetch segments upfront (which is high latency)
 - We don't need to fetch segments twice (once for timestamps, and
   once again to buffer)
 - We don't need to maintain parsers (which were complex and limited
   the formats we could support)

Closes #4191
2022-05-11 15:26:02 -07:00
Joey Parrish fbbd63d96b test: Late load tests, fix Chromecast test flake (#4115)
This change fixes tests on Chromecast by loading tests later in the process.  Test scripts are now dynamically inserted by boot.js, rather than loaded by Karma.  The bootstrapping code then awaits the completion of that before starting the Karma frameworks (Jasmine) to run the tests.

This also removes the use of goog.provide/goog.require in tests and test utils.  We don't need to load test utils or library sources dynamically in each test, and this gives us more explicit control over script loading and ordering.

Closes #4094
2022-04-11 15:47:48 -07:00
Philippe f382cc702b feat: add option for segment-relative VTT timings (#4083)
This PR fixes #3242 where for some live streams using segmented VTT, text timings are relative to segment start instead of being absolute.

The PR introduces a new setting: `manifest.segmentRelativeVttTiming: boolean` allowing such alternative timing offset calculation.

The setting is off by default, preserving the current player behaviour.

Co-authored-by: Joey Parrish <joeyparrish@users.noreply.github.com>
2022-04-01 09:39:11 -07:00
bcupac 65e9d8ff85 fix: Display captions with forward slashes (#3556)
Closes #3555 .
2021-08-15 22:30:22 -07:00
Percy Tse d882d282f9 Support WebVTT default text color and default text background color (#3182)
Closes #3182
2021-03-11 08:52:40 -08:00
Álvaro Velad Galván 6db55e0141 feat: Add support for WebVTT style blocks (#3071) 2021-02-18 16:01:36 -08:00
Joey Parrish 7544670ee5 chore: Upgrade eslint
The new eslint found many style errors which have now been corrected.

It also complains a lot about atomic update issues that do not seem to
exist, so that rule has been disabled.

This upgrade will allow us to adopt eslint's "id-denylist" instead of
the older "id-blacklist" rule, the name of which violates new Google
guidelines about respectful language.

Bug: 178203011

Change-Id: Ia65581b96e4dd1331f720fa396183dca020b9caf
2021-02-01 23:36:12 +00:00
michellezhuo 7e4280fab4 fix: TTML clean up
1. Add support for multiple layers of nested cues.
2. Add support for anonymous span.

Closes #2623
Closes #2761

Change-Id: I10a253b1a965606fc2db49c3168e92bcf4a95fa1
2020-11-04 00:37:04 +00:00
Álvaro Velad Galván 96f36278c4 Be more permissive in vtt files (#2941)
Resolves #2720
2020-10-26 10:05:46 -07:00
michellezhuo 341b92ad04 build: add goog.require for compiler upgrade (Part1)
This change includes files under test/cea and test/text folders.

Change-Id: I1db1ccb6daeea77058cb56f1f5fc80992596600c
2020-10-07 19:20:29 +00:00
Joey Parrish 4bf22e2359 fix(VTT): Fix timing of VTT in HLS without map header
When there is no X-TIMESTAMP-MAP header, the HLS spec states that the
client should map 0 to 0, effectively.  That means we were wrong to
offset the cues by the segment time.

Since DASH IOP states that segmented text should be packaged in MP4,
this should not affect compliant DASH content.

Closes #2714

Change-Id: Iddb00f2fd1afeb4f0f2c99f92f65e5db0e3a84f1
2020-08-12 14:10:11 -07:00
Álvaro Velad Galván f42ccd2867 feat(VTT): Adds VTT tag rendering for <b>, <i> and <u> (#2776)
Closes #2348
2020-08-11 11:58:21 -07:00
Joey Parrish 7e6a0f38ff fix: Correct license headers in misc. files
This corrects/normalizes license headers in misc. files, such as
config files, docs, build tools, tests, and externs.  This does not
affect the compiled output, and is only done for consistency.

Issue #2638

Change-Id: I9d8da2de55243b08d7df2b743aac73c6f15e858a
2020-06-09 16:13:56 -07:00
Joey Parrish 64896d70b0 Use shorter license header
This reflects changes in Google's policy on JavaScript license
headers, which should be smaller to avoid increasing the size of the
binary unnecessarily.

This also updates the company name from "Google, Inc" to "Google LLC".

Change-Id: I3f8b9ed3700b6351f43173d50c94d35c333e82b4
2019-11-22 18:18:36 +00:00
michellezhuo 1ada5e7574 [Hls] Move MPEG TS Timestamp rollover to Vtt Text Parser
Change-Id: Id840f8201d9d31f00fa38c88f632ff9e515e07a6
2019-10-08 23:39:52 +00:00
michellezhuo 9d66e3bb09 [Hls] Avoid duplicate calls to get segment start time for VOD
For VOD, the first segment of every Media Playlist in every Variant
Stream must start at the same media timestamp. Thus, we can get the
start time once and store the value, and all the streams can use the
value directly. For live, we assume for the same.
This change reduces calling getStartTime_() from 15 times to once for
Angel One, and also fixes the text segment timestamp issue.
Also removed associated methods that no longer needed.

Closes #1558
Closes #1563

Change-Id: I0e95ab93ea2b13758128f11019b262bc53dbcd38
2019-09-30 15:43:57 -07:00
Jacob Trimble bf5547b78c Refactor ArrayBuffer usage in tests.
Change-Id: I27e898a7d3c2d706e265abfc4b9bde88b67f3256
2019-08-21 20:44:36 +00:00
Theodore Abshire 3a67802ce2 Fix parseFirstCue test on some platforms.
It turns out that, on some browsers, incomplete XML does not properly
parse. This means the parseFirstCue tests did not work on those platforms.
This modifies those tests on platforms that do not support partial XML;
when no support is detected, it instead tries to get the first cue
from a non-partial segment.
This also modifies the HLS parser to only load partial text segments if
the text parser supports it; otherwise, the hls parser will load full
captions in order to extract start times.

b/137945635
Issue #2037

Change-Id: I58112864a818baf155b365a65fba1c8a56eb9520
2019-07-24 11:23:03 -07:00
Theodore Abshire 1e12873fb7 Only parse first cue when getting text start time.
Previously, when the text engine tried to load the start time of
a segment, it would parse every cue in that segment, then check the
time of the first cue. This was judged to not be a significant
performance issue, as parsing cues is a fast operation. However, it
did have an unintended side-effect: in some situations, this method
was being passed partial segments; notably, the HLS parser would load
the first 2048kb of the stream's texts to extract timing data.
If the caption parsers tried to actually parse an incomplete caption,
they would error.
This gives the text parsers "parseFirstCue" methods, and uses those
methods when it only needs the first cue anyway.

Fixes #2037

Change-Id: I2a1fb2f1a96d98967f0c6e6a5c277914a28b42ad
2019-07-17 21:27:32 +00:00
Jacob Trimble 5c35108cb8 Avoid integer for loops.
Issue #1518

Change-Id: I3ba3cb6a439264e823022b2a64e7cdbd265494c7
2019-07-09 17:11:49 +00:00
Jacob Trimble 010a60b8f1 Use objectContaining in text tests.
Instead of checking each property separately, just use
jasmine.objectContaining.  This also adds a utility for matching a
number that is close to an expected value.  This is required when
matching objects with toEqual().

Change-Id: I4de49cfaf254e0752beffc97c578a77f9ec8ee95
2019-06-26 18:54:13 +00:00
Jacob Trimble e2ba179201 Favor using toHaveBeenCalledTimes.
This gives better error messages than using toBe() or toEqual() with
the number of calls.

Change-Id: Ice353f1ebcc715da69416da2d983e919597f82d1
2019-06-26 18:52:36 +00:00
Theodore Abshire b805d15444 Convert externs to ES6.
Issue #1157

Change-Id: Ib8ddecc7106fea8c24c10cfac406c4709a3f275b
2019-06-10 17:52:08 +00:00
Jacob Trimble a69047ba0d Convert text tests to ES6.
Issue #1157

Change-Id: I839d4ab38324a2247bb3c788837a16652d401595
2019-05-21 22:56:34 +00:00
Jacob Trimble a3be4d837d Don't create spies in beforeAll.
Creating them in beforeAll will usually cause test contamination, so
they should be created in beforeEach instead so they are reset for
each test.

Change-Id: I51f11de85555cbf5b8c18969eabeecbe8617b8f3
2019-05-16 22:45:52 +00:00