Commit Graph

319 Commits

Author SHA1 Message Date
Á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 f41c65d830 fix: Allow the user to disable subtitles while paused (#7578)
Fixes https://github.com/shaka-project/shaka-player/issues/7576
2024-11-13 17:55:44 +01:00
Álvaro Velad Galván bd2c9a7f4b fix: Prefer SimpleTextDisplayer on iOS (#7569)
Fixes https://github.com/shaka-project/shaka-player/issues/7568
2024-11-13 17:54:38 +01:00
Álvaro Velad Galván 781a27df80 fix(WebVTT): Fix display italic subtitles with end align (#7559)
Fixes https://github.com/shaka-project/shaka-player/issues/7553
2024-11-07 19:35:33 +01:00
Álvaro Velad Galván 7ceffc0db7 perf: Only use tXml parent when necessary (#7304)
Issue https://github.com/shaka-project/shaka-player/issues/6239
2024-09-13 13:49:39 +02:00
David HM Morgan fdf68d1994 fix(TTML): Fix absence of conversion of alpha (transparency) from 0-255 -> 0-1 (#7280)
Fixes #7279
2024-09-10 15:50:46 +02:00
PikachuEXE 76376e97f1 fix(WebVTT): Fix mapNativeCueToShakaCue in Chromium browsers (#7273)
Chromium browsers do not currently support the `lineAlign` or
`positionAlign` properties on the VTTCue class, just like the region
property. So this pull request adds an if before reading those
properties so that the position and line values are handled correctly in
UITextDisplayer (without this change the subtitles are always at the
bottom edge of the player and right aligned subtitles are displayed
off-screen).


https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/lineAlign#browser_compatibility

https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/positionAlign#browser_compatibility

Before fix
![Screenshot 2024-09-09 at 08 42
04](https://github.com/user-attachments/assets/b19f223f-0e6e-4678-a1b1-36a759ec9691)
After fix

![image](https://github.com/user-attachments/assets/79854c9d-838b-4b20-9370-4a81407d82fd)

Steps to reproduce:
- Get local demo running (`python build/all.py --debug`?)
- Visit custom content, add
https://d2zihajmogu5jn.cloudfront.net/elephantsdream/ed_hd.mp4 (with
whatever name)
- Add track below
- Start playing custom video, switch Captions to the new text track


**JS to add text track**
```js
await document.getElementById('video').ui.getControls().getPlayer().addTextTrackAsync('data:text/vtt;charset=utf-8,WEBVTT%0AKind%3A%20subtitles%0ALanguage%3A%20en%0A%0A00%3A00%3A00.000%20--%3E%2000%3A01%3A00.000%20align%3Astart%20position%3A0%25%20line%3A0%25%0ATop%2FLeft%0A%0A00%3A00%3A00.000%20--%3E%2000%3A01%3A00.000%20line%3A0%25%0ATop%2FCentre%0A%0A00%3A00%3A00.000%20--%3E%2000%3A01%3A00.000%20align%3Aend%20position%3A100%25%20line%3A0%25%0ATop%2FRight%0A%0A00%3A00%3A00.000%20--%3E%2000%3A01%3A00.000%20align%3Astart%20position%3A0%25%20line%3A48%25%0AMiddle%2FLeft%0A%0A00%3A00%3A00.000%20--%3E%2000%3A01%3A00.000%20line%3A48%25%0AMiddle%2FCentre%0A%0A00%3A00%3A00.000%20--%3E%2000%3A01%3A00.000%20align%3Aend%20position%3A100%25%20line%3A48%25%0AMiddle%2FRight%0A%0A00%3A00%3A00.000%20--%3E%2000%3A01%3A00.000%20align%3Astart%20position%3A0%25%0ABottom%2FLeft%0A%0A00%3A00%3A00.000%20--%3E%2000%3A01%3A00.000%0ABottom%2FCentre%0A%0A00%3A00%3A00.000%20--%3E%2000%3A01%3A00.000%20align%3Aend%20position%3A100%25%0ABottom%2FRight%0A%0A', 'en', 'subtitles', 'text/vtt')
```
2024-09-09 08:56:08 +02:00
Álvaro Velad Galván 3590aeea3d feat(UI): Use the lang= attribute to help screen-readers recognize localized labels (#7267)
Close https://github.com/shaka-project/shaka-player/issues/1860
2024-09-09 08:53:13 +02:00
Álvaro Velad Galván 257de7fed3 fix(TTML): Fix subtitles not rendered due to complaint about xml:id (#7270)
Fixes https://github.com/shaka-project/shaka-player/issues/7269
2024-09-06 17:26:14 +02:00
Álvaro Velad Galván 3d0b817588 fix: Fix rendering of image subs when using SimpleTextDisplayer (#7258)
This change prevents cues from being created without payload, as is the
case with subtitles in image format.
2024-09-05 15:56:20 +02:00
Álvaro Velad Galván 3d3327785f fix(UI): Fix font-family override in UITextDisplayer (#7249)
Font settings were applied to ".shaka-video-container *", all
descendents of .shaka-video-container. This meant that the font setting
inheritance intended in our UI text displayer was broken, because those
descendents effectively had their own settings and didn't inherit them
from their parents in the subtitle DOM hierarchy. We fix this by
breaking down the CSS and applying those font settings directly to the
top level .shaka-video-container, to be inherited by any descendent
without their own setting.
2024-09-04 07:20:50 +02:00
Álvaro Velad Galván efac12984f fix: Fix horizontal alignment of WebVTT in UITextDisplayer (#7169)
Fixes https://github.com/shaka-project/shaka-player/issues/7116
2024-08-20 09:30:04 +02:00
Gary Katsevman ac9a6ca6d3 fix: properly map region height/width when applying anchors (#7105)
This is a follow-up for
https://github.com/shaka-project/shaka-player/pull/6986/files#r1667140796
2024-07-26 04:22:34 -07: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 22a7c497b0 fix(WebVTT): Fix rendering of WebVTT in UITextDisplayer (#7023)
Fix rendering of align:start and align:end in UITextDisplayer
Fix rendering of position in UITextDisplayer

Fixes https://github.com/shaka-project/shaka-player/issues/4486
2024-07-22 15:28:34 +02: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 4f9264637d chore: Add native cue to shaka cue mapping (#7038)
Needed for #6985
2024-07-15 10:14:35 +02:00
Álvaro Velad Galván 5cb4224c87 chore: Remove console.log (#7028) 2024-07-12 12:50:13 +02:00
Álvaro Velad Galván 516f9f6e97 chore: Move convertToTextTrackCue_ to shaka.text.Utils (#7021)
Also adds a id to all cues.
2024-07-12 07:19:20 +02:00
Álvaro Velad Galván ca7fd6ed6a fix: Offset text regions that are out of viewport (#6986)
Fixes https://github.com/shaka-project/shaka-player/issues/3732 (we
resolve it using offset operation instead of clipping)
2024-07-08 10:43:25 +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
Wojciech Tyczyński 24c73dfb83 chore: Move CueRegion to its own file (#6993) 2024-07-05 15:15:04 +02:00
Álvaro Velad Galván 3b6229616e feat(TTML): Add support for IMSC1 (CMAF) image subtitle (#6968) 2024-07-02 21:43:54 +02:00
Álvaro Velad Galván f56f7ba9ca fix(TTML): Fix font styles parsing (#6969)
Exclude default fontFamily (not supported in Chromium browsers)
Allow fontSize with 3 and 4 digits, for example 300% or 1000%
2024-07-02 20:51:50 +02:00
Álvaro Velad Galván e68fd55c44 fix(TTML): Show background color with image subtitles (#6967) 2024-07-02 20:51:19 +02:00
Álvaro Velad Galván fa9feb346f fix: Filter duplicate cues on text displayer append (#6949) 2024-07-01 20:29:01 +02:00
Álvaro Velad Galván 88431b6f3d fix(SSA): Support files with line breaks that are not necessary (#6947)
Related to https://github.com/shaka-project/shaka-player/issues/6943
2024-07-01 20:28:32 +02:00
Wojciech Tyczyński c6d834ed36 fix(SimpleTextDisplayer): Do not disable metadata & chapters tracks (#6948) 2024-07-01 12:31:21 +02:00
David HM Morgan 3783ffd44b fix(TTML): Fix timing parsing when using 1dp (#6830)
Fixes #6829
2024-06-14 12:30:01 -07:00
David HM Morgan 601098bad1 fix(TTML): Extended subtitle codec support (#6832)
> Quote from specs:
> Valid examples include:
> • "stpp.ttml.etd1" - TTML content suitable for presentation by an
EBU-TT-D renderer
> • "stpp.ttml.etd1|im1t" or "stpp.ttml.im1t|etd1" - TTML content
suitable for presentation by an EBU-TT-D or
IMSC1 renderer 

Fixes #6831
2024-06-14 16:41:37 +02: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 4302a6bf17 fix: Fix reusing region elements in UITextDisplayer (#6476)
Fixes https://github.com/shaka-project/shaka-player/issues/6341
2024-04-24 17:33:45 +02:00
Álvaro Velad Galván 84b2f8edfa chore: Remove useless loop in compiled mode (#6475) 2024-04-24 17:33:28 +02:00
Álvaro Velad Galván 2f653f132b fix: Don't update captions when video is paused (#6474)
This avoids wasting processing resources when it is not necessary
2024-04-24 17:22:14 +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
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 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
Á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
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 9f5e46190c fix(WebVTT): Fix support for line vertical alignment (#5945)
Fixes https://github.com/shaka-project/shaka-player/issues/4446
2023-12-04 09:11:08 +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