89 Commits

Author SHA1 Message Date
Fredrik Höglin c2ad355e28 fix: avoid pts rollover correction for fmp4/cmaf streams (#10021)
For HLS CMAF streams with WebVTT subtitles with large timestamps, the
rollover wrapping prevents the cues from being shown at the correct
time.

By adding a check to only do the wrapping for MPEG-TS streams this
problem is eliminated.

fixes #10020
2026-04-22 16:12:34 +02:00
Ivan 503234e9c6 perf(VTT): reduce GC pressure in VTT text parser (#9869)
This PR:

 - replaces `splice` with an index variable to avoid array shifts on every cue parse
 - replaces `slice(1).join('\n')` with a manual loop to eliminate two intermediate allocations per cue
 - hoists inline regex literals to static class constants, fixing unreliable literal caching in older Chromium version (helps TV devices and Xbox)
2026-03-20 15:11:10 -07:00
Álvaro Velad Galván 8e0e0d85c1 feat!: Remove setSequenceMode from TextParser plugins (#9326) 2025-10-31 16:14:52 +01:00
Álvaro Velad Galván 72955e0cf0 fix(WebVTT): Fix times when using HLS without X-TIMESTAMP-MAP (#9313) 2025-10-30 10:33:31 +01:00
Wojciech Tyczyński 51ff82f204 build: Migrate to stylistic eslint plugin (#8298)
Fixes #8278
Migrates deprecated rules from `eslint-config-google` and our rules as
well to stylistic.
Additionally removes broken `eslint-disable` python check and replaces
with eslint `reportUnusedDisableDirectives` option.
2025-03-19 16:18:30 +01:00
Wojciech Tyczyński 6e55a3b21b build: Forbid using dot in generic types (#7904)
Fixes #2643

Happy reviewing!
2025-01-20 09:39:51 +01:00
Álvaro Velad Galván 7afe08e490 fix(HLS): Fix subtitle timing when no discontinuity but there is X-TIMESTAMP-MAP (#7681)
Fixes https://github.com/shaka-project/shaka-player/issues/7673
2024-11-27 14:14:22 +01:00
Álvaro Velad Galván 9e2b15ead4 fix(HLS): Fix subtitle timing (#7625)
Simplifies subtitle management for sequence mode and segments mode 
Runs subtitle tests in segments mode as well (Tizen 3.0)

Fixes: https://github.com/shaka-project/shaka-player/issues/7447
2024-11-19 18:36:49 +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 c59922bae5 feat(Ads): Add basic VAST support without IMA (#7052)
This only includes playback, no tracking is sent.
2024-07-17 11:00:43 +02:00
Wojciech Tyczyński eeadace2be feat: Add public method for parsing cue payload (#6992)
Close #4439 
Needed for #6985
2024-07-05 16:21:15 +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
Dave Nicholas 7116a34ec2 feat!: Remove DOM Parser (#6063)
## Background: 
The native DOM Parser can perform poorly on some older devices, this
approach is faster on newer devices but is considerably better on older
devices.
This PR replaces the usage of the DOM Parser for DASH, MSS, VTT and
TTML.

The draw back of this approach that it does not include any validation
at the cost of better performance.
2024-01-22 08:39:06 +01:00
Álvaro Velad Galván 9462e1252d perf(WebVTT): Improve parsing time for unstyled payloads (#6066)
Related to https://github.com/shaka-project/shaka-player/issues/6065
2024-01-10 10:29:19 +01:00
Álvaro Velad Galván ea7d83ed87 fix(WebVTT): Fix wrong writing-mode in nested cues (#5807)
Fixes https://github.com/shaka-project/shaka-player/issues/4765
2023-10-25 10:06:50 +02: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 bd636d4edf fix(HLS): Show WebVTT subtitles with X-TIMESTAMP-MAP in segments mode (#5643) 2023-09-12 14:27:18 +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
Álvaro Velad Galván 62156bae02 feat: Use shaka.text.Cue everywhere instead of shaka.extern.Cue (#5529)
Closes https://github.com/shaka-project/shaka-player/issues/2818
2023-08-25 10:51:28 +02:00
Álvaro Velad Galván a8f7c41b07 feat(WebVTT): Add support to auto position (#5532) 2023-08-25 06:52:07 +02:00
Álvaro Velad Galván 963cf614d9 feat(SRT): Support stylized payload in SRT format (#5500)
Info about the format in https://docs.fileformat.com/video/srt/
2023-08-21 14:21:49 +02:00
Álvaro Velad Galván ac6a92a28d fix(WebVTT): Fix text-shadow in WebVTT not working (#5499)
Fixes https://github.com/shaka-project/shaka-player/issues/5020
2023-08-18 14:26:53 +02:00
Álvaro Velad Galván 5691d5e459 fix(WebVTT): Add support to middle position (#5366)
This setting is used in https://devstreaming-cdn.apple.com/videos/streaming/examples/adv_dv_atmos/main.m3u8 (Apple HLS example)
2023-06-28 12:39:23 -07: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
Joey Parrish 128562d93e fix(VTT): Fix combining style selectors (#4934)
When multiple style blocks exist for the same selector, they should be
combined. For example,

  ::cue(b) { background: white; }
  ::cue(b) { color: blue; }

should set both the background and foreground of bold tags.
2023-01-25 15:04:10 -08: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
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
theodab a4e926772e fix(text): Fix webvtt offset in sequence mode (#3955)
When running in sequence mode, we ignore the normal timestamps
of video and audio segments. This lead to problems in some Apple-
encoded webvtt content, which used the X-TIMESTAMP-MAP tag to account
for the timestamp offsets in their video. Thus, those subtitles would
end up 10 seconds offset.

This changes the webvtt parser to ignore the X-TIMESTAMP-MAP when in
sequence mode.

Issue #2337
2022-02-16 11:38:20 -08:00
Chuong 3670996269 style: Fix misspelling default (#3602) 2021-08-27 09:27:03 -07:00
bcupac 65e9d8ff85 fix: Display captions with forward slashes (#3556)
Closes #3555 .
2021-08-15 22:30:22 -07:00
Joey Parrish 38ce45dce5 cleanup: Fix nullability declarations
Cleanup imported from an internal Google migration process, courtesy
of Laura Harker.

Change-Id: I11de518eafe6008938589e5250bdcaf8151267e9
2021-06-22 21:03:20 +00: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
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