Commit Graph

332 Commits

Author SHA1 Message Date
David HM Morgan 18695c6c23 feat: Text font scaling customisation ability (#8215)
With reference to #8025, this is a partial proposal to see if this style
of extensible customisation could be favourable to the shaka-player
community:

Proposal for some accessibility options whereby an App builder can
customise subtitle/caption size, with the potential of an App offering
accessibility options for text size.

This style could be used for other text styling attributes in a similar
way, but this is just the first step.

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2025-03-06 13:44:49 +01:00
Álvaro Velad Galván f3108330c6 perf: Only set the timers on UITextDisplayer when there are cues (#8114) 2025-02-19 13:34:21 +01:00
Juliane Holzt 2562384055 fix(TTML): Correctly handle multiple samples in a segment (#8088)
Fixes https://github.com/shaka-project/shaka-player/issues/8087

Implements handling of multiple samples in a MP4/ISOBMFF/DASH TTML
segment/fragment. Such segments are allowed by ISO14496-12 and
ISO23000-19. gpac creates such segments. The prior code just treated the
full MDAT as one TTML XML document and tried to parse it in whole
without accounting for sample(s). A testcase is included which was
created by taking the testdata from ttml-segment.mp4 and splitting the
subtitles into two independent TTML-XML documents, which then were put
as individual samples.

The testdata for the prior existing multiple MDAT testcase was invalid.
It was created by taking the same ttml-segment.mp4 as a source and just
duplicating the MDAT box, but without then also fixing the TRUN box. The
duplicated data was thus not referenced. The test case still worked,
because the prior code did not look at the TRUN box and the sample
specification at all and just handled any full MDAT box = 1 sample. The
testdata was replaced with a new file, which is basically the same as
for the multiple samples case, but with the two samples split into two
MDAT boxes.
2025-02-17 12:39:10 +01:00
Wojciech Tyczyński 24283e6c4d fix(Subtitles): Prevent rounding errors when filtering duplicated cues (#8018)
Related to #6773
2025-02-05 14:01:28 +01:00
Álvaro Velad Galván 3be3b142ea fix: Fix displaying subtitles in UITextDisplayer at high playback rates (#7991) 2025-01-30 13:37:04 +01:00
Álvaro Velad Galván 5c100f9847 chore: Stop using "Object" in TTML annotations (#7950)
Related to #1672
2025-01-27 10:35:19 +01:00
Álvaro Velad Galván c54b2dee19 chore: Stop using "Object" in plugins annotations (#7933)
Related to https://github.com/shaka-project/shaka-player/issues/1672
2025-01-24 08:29:51 +01:00
Álvaro Velad Galván 9e71a011f2 fix: Only create TextTrack of SimpleTextDisplayer when necessary (#7913)
Fixes https://github.com/shaka-project/shaka-player/issues/7912
2025-01-21 11:09:26 +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
Wojciech Tyczyński 82f7eafdc5 build: Add new JSDoc rules to ESLint (#7897)
Adds a replacement for removed JSDoc checks from ESLint v9.
Additionally fixes lots of issues found in the JSDoc, such as:
- missing `@param`/`@return` annotations
- bad formatting
- params order
- param name in the same line as type definition (tried to disable it,
but it was causing other issues and we didn't have lots of places with
such formatting)

Minor fixes in code found by Closure Compiler after fixing JSDoc are
also included.
2025-01-17 09:28:19 +01:00
Álvaro Velad Galván fd78ec41f5 fix: Remove useless deprecation in UITextDisplayer and add some guards in SimpleTextDisplayer (#7805)
Fixes https://github.com/shaka-project/shaka-player/issues/7803
2024-12-24 13:02:34 +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 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 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