Commit Graph

192 Commits

Author SHA1 Message Date
David HM Morgan 3783ffd44b fix(TTML): Fix timing parsing when using 1dp (#6830)
Fixes #6829
2024-06-14 12:30:01 -07:00
MichaelSweden d564be8e89 fix: Make UITextDisplayer constructor backward compatible (#6532)
Keep constructor backward compatible with earlier that had two
arguments, i.e. make the new third optional for existing applications.

Fixes https://github.com/shaka-project/shaka-player/issues/6531

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2024-05-06 10:11:20 +02:00
Álvaro Velad Galván de2a2d885f feat: Add TextDisplayer config (#6477) 2024-04-24 18:15:44 +02: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 bcedec3a0a fix(TTML): Fix trim surrounding spaces with xml:space="default" (#6395)
Fixes https://github.com/shaka-project/shaka-player/issues/4974
2024-04-04 10:45:57 +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
theodab 03633e47bb feat(text): Add time context to modifyCueCallback (#6252) 2024-02-20 00:37:33 -08: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
theodab bd944d15db feat(text): Add MediaSource.modifyCueCallback (#6167)
This callback gives developers a chance to modify cues after they are
parsed but before they are appended.
2024-01-25 23:36:48 -08: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 2862228716 fix(TTML): Clip to video when extent is not present (#6086)
Fixes https://github.com/shaka-project/shaka-player/issues/4793
2024-01-11 18:24:05 +01:00
Antonio Díaz Correa 42c235d123 fix: avoid uiTextDisplayer.destroy crashing if called more than once (#6022) 2024-01-08 09:40:12 +01:00
Álvaro Velad Galván 68903e130e fix: Fix color detection in text utils (#5970) 2023-12-02 08:43:14 +01:00
Álvaro Velad Galván d224933e34 chore: Remove unnecessary hints for the compiler and add missing requires (#5969) 2023-12-02 08:42:59 +01:00
Álvaro Velad Galván fa93d5353a fix(TTML): Fix support of urls in smpte:backgroundImage (#5851)
Fixes https://github.com/shaka-project/shaka-player/issues/5049
2023-11-06 11:26:56 +01:00
theodab 4425dca283 chore: Remove state engine (#5752)
The state engine mechanism, designed for the player class, was
over-engineered. The structure of the class makes debugging player
errors unnecessarily annoying, by obfuscating the code-path the error
followed, and in general
has created a significant amount of technical debt.
This changes the player to use an async-await setup for the top-level
operations, laying things out much more cleanly
and linearly.

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2023-10-30 23:59:08 -07: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 73a3bd931e feat(TTML): Add support to tts:textCombine (#5644)
Related to https://github.com/shaka-project/shaka-player/issues/2853
2023-09-13 09:05:51 +02:00
Álvaro Velad Galván 9fd220e73f feat(TTML): Add support to tts:ruby (#5645)
Related to https://github.com/shaka-project/shaka-player/issues/2853
2023-09-12 20:56:46 +02:00
Álvaro Velad Galván 3a4f10878a fix(TTML): Fix wrong writing-mode in nested cues (#5646) 2023-09-12 17:53:12 +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 eed393f1bf fix(WebVTT): Fix support for line:0 vertical alignment (#5632)
Related to https://github.com/shaka-project/shaka-player/issues/4446
2023-09-12 14:26:55 +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 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
Wojciech Tyczyński 7bda65dcc7 feat: Convert CEA parsers to plugins (#5195)
Fixes #5178 

Changes included:
- converted CEA parsers to externs
- added API to register/unregister CEA parsers
- TextEngine now checks is CEA decoder registered
- excluded CEA plugin from core build
- added lcevc plugin to core build

Bundle size results (all in KB, compared to
bf4b4a54cc):


  | core | complete - ui | complete - ui - cea
-- | -- | -- | --
before | 246 | 473 | 473
after | 231 | 474 | 459
2023-04-28 17:23:01 -07:00
Sacha Elkaim 6fd44c4910 fix: Handle empty media segments for Mp4VttParser (#5131)
Fixes #4429
2023-04-04 02:12:21 -07:00
Álvaro Velad Galván 2d0469fb4a fix(VTT): Fix spacing between text lines (#4961)
Fixes https://github.com/shaka-project/shaka-player/issues/4958

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Joey Parrish <joeyparrish@google.com>
2023-02-10 14:08:42 -08: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
Joey Parrish f45631834d fix(WebVTT): Fix horizontal positioning with cue box size (#4949)
When the VTT size setting is used, the horizontal positioning was wrong
in both native and UI display.

The native display is wrong on Chrome and Edge because of a layout bug
in Chrome, where the shadow DOM for the cue box has conflicting
(redundant) styles. For example, these VTT settings:

`line: 85% position: 50% size: 63%`

result in these styles in the shadow DOM:

`top: 85%; left: 18.5%; transform: translate(-18.5%, -85%)`.

The `translate` style is what breaks the positioning. Unfortunately,
there is no way to fix that in JavaScript.

The UI display, however, was buggy for different reasons and is fixable.
The styles `left: 0; top: 0;` were applied by default, and then `top:
85%;` and `width: 63%;` were set based on the cue settings. The default
of `left: 0` was what broke the positioning. Removing this leaves `left`
set implicitly to `auto`, which is correct.

No other test cases were broken (or fixed) by this change.

This also adds a filter parameter to the lab workflow to run a subset of
tests for quicker results. This is useful for updating screenshots.

Closes b/259121343
2023-01-30 16:01:25 -08:00
Joey Parrish 7c4ed53410 test: End-to-end WebVTT layout tests (#4935)
Many of these are rendered incorrectly in some way.

This PR contains only the tests, but not the screenshots, to make the
tests easier to review. The screenshots will appear in a separate PR.

Related to work on PR #4767
2023-01-26 14:09:16 -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
Joey Parrish dd860fab9f chore: Organize screenshots by suite (#4908)
There is currently only one suite, but that is about to change. This
renames all screenshots to include the name of the suite, and updates
the review page with a temporary hard-coded suite name.

Related to work on PR #4767
2023-01-17 15:47:40 -08:00
Joey Parrish dcc94b163f chore: Rename layout tests (#4907)
Also fixes a compiler error that comes up for some reason when renaming
the other tests. The compiler will accept an assignment to nestedCues,
but not pushing to it. I was unable to fix the missing type information
for this.

Related to work on PR #4767
2023-01-17 15:31:39 -08:00
David HM Morgan 5681efe95c fix: Treat regions uniquely (#4841)
Captions split over stream segment boundaries are repeated over more
than one segment.
Regions in which they sit maybe described the same but allocated
different ids and vice versa.
Proposal to treat internal region ids uniqely by encoding the dimensions
in the id.

fixes #4839
2022-12-15 19:23:41 +01:00
Joey Parrish bd75032d63 fix(TTML): Fix duplicate cues overlapping segment boundaries (#4798)
Closes #4631
2022-12-08 09:05:08 +01:00
David HM Morgan 4081434eba fix: Fix subtitles not added to DOM region (#4733)
Reinstate previously removed region elements when next caption finds it
is not there: Detect the absence and ensure `updateDOM` is true so its
reinstated and the next caption can be shown.

Closes #4680

Co-authored-by: Joey Parrish <joeyparrish@users.noreply.github.com>
2022-12-07 14:23:12 -08: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
Joey Parrish 32b0a90a8c fix(ttml): Default TTML background color to transparent if unspecified (#4496)
Closes #4468
2022-09-27 19:51:46 -07:00