Commit Graph

101 Commits

Author SHA1 Message Date
gmamzn 548fe2953e fix(TTML): Update position alignment map (#9735)
Map 'start' to 'LEFT' and 'end' to 'RIGHT'
This mapping needs to be reversed for RTL languages.
2026-02-19 14:30:23 -08: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 43a45eab2b fix(HLS): Fix display stpp subtitles (#8995)
It also eliminates the use of private static

Fixes https://github.com/shaka-project/shaka-player/issues/8994
2025-08-20 11:30:48 +02: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
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 51765e9693 build: Change spellchecking tool and fix spelling mistakes (#7765)
Fixes #7693
2024-12-20 12:27:05 +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
Á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 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
David HM Morgan 3783ffd44b fix(TTML): Fix timing parsing when using 1dp (#6830)
Fixes #6829
2024-06-14 12:30:01 -07: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
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 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
Á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 db8987d6df fix(TTML): Add font-family mapping (#4801)
Closes https://github.com/shaka-project/shaka-player/issues/4749
2022-12-08 11:09:27 -08:00
Joey Parrish bd75032d63 fix(TTML): Fix duplicate cues overlapping segment boundaries (#4798)
Closes #4631
2022-12-08 09:05:08 +01:00
bjarkler a731eba804 fix: Make XML parsing secure (#4598)
Harden the XmlUtils.parseXmlString function against XML documents that embed elements from the HTML or SVG namespaces, which could trigger script execution and cause XSS vulnerabilities.

Also migrate direct users of the DOMParser.parseFromString function to XmlUtils, and add appropriate unit tests.
2022-10-24 05:34:02 -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
Álvaro Velad Galván f2f24d528f fix(ttml): Center subtitles by default (#4023)
Closes: https://github.com/shaka-project/shaka-player/issues/4015
2022-03-10 13:11:50 -08:00
Joey Parrish 1507b1e844 chore: Update URLs after moving projects (#4008) 2022-03-03 14:34:40 -08:00
Joey Parrish d99ab7959d build: Update eslint (#3977)
Also fixes linter errors found by the new versions
2022-02-18 08:26:43 -08: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
Theodore Abshire e9df8fb10c fix(text): Inherit alignment from regions.
The recent changes to TTML parsing, to not inherit regions,
inadvertently ended up breaking text alignment in situations
where a region with alignment was on the p or div above a span.
Previously, we only inherited the text and display alignment
from a region on leaf nodes... which was a problem, since we
also didn't apply any styles to text nodes.

Change-Id: I62ac155bc4310a5f7da52c10ca2dd434f8015c97
2022-01-25 21:39:21 +00:00
Álvaro Velad Galván 771619ff0e fix: Fix support for TTAF1 namespace (old version of TTML) (#3864)
Fixes #3009
2022-01-25 10:40:13 -08:00
Theodore Abshire bf67d87387 fix(text): Fix caption overlap.
This changes the TTML parser to not allow cue regions to be inherited
to the children of the element the region was originally assigned on,
except for the purposes of styles (colors, etc).
To allow regions on elements "above" the cues in TTML, such as the
<body> or <div> elements, this also changes the TTML parser to render
the full structure of the TTML file as a tree of cues. The end result
will be a single cue representing the <body>, with children
representing the <div> elements inside it, and those <divs> will have
children that represent the actual cues. Now that our text displayer
can intelligently update child cues as they enter or leave the display
window, this approach should be possible.

Closes #3850
Closes #3741

Change-Id: Ia8d750daa06920610c04e9b26e29d2d304eaf8a9
2022-01-20 22:41:37 +00:00
Álvaro Velad Galván 3ff48cba9b fix(text): Made nested cues inherit region (#3837)
Closes #3743
2022-01-12 12:45:24 -08:00
Álvaro Velad Galván c5a81f53fe fix(text): Allow comments in the TTML parser (#3827)
Closes #3766
2022-01-04 11:34:44 -08:00
Theodore Abshire 157bd77be2 fix(ttml): Fix ttml erroneously dismissing cues.
When trying to detect if it is appropriate to ignore a non-break
element, the ttml parser would base the decision on the presence
of timing info in the cue itself, and on the presence of
textContent within the node. If neither is present, the element
might be ignored.
This works in most cases of nested cues, as the presence of text
within a child node will show up in the textContent of the parent
node. However, not all valid ttml cues have textContent; image
cues, for example, have their contents defined as a DOM attribute.

This changes the ttml parser to not ignore any cue that has child
cues. It also changes the ttml parser to cause cues with no defined
timing to base their timing on their child cues, if present.
This also changes our UI text displayer to respect the timing info
of child cues.

Closes #3643

Change-Id: I9a017f53398bbed8dbeeeebca2cff76dd3666c64
2021-09-29 21:53:41 +00:00
Theodore Abshire 911ce6d250 feat(text): Partially support tts:textOutline
Unfortunately, modern browsers do not support any CSS property that
directly maps to tts:textOutline. However, the non-standard (but still
commonly implemented) -webkit-text-stroke-width and
-webkit-text-stroke-color properties, when used together, can
replicate the functionality of tts:textOutline, with the exception of
the optional blur radius.

Closes #3612

Change-Id: I863d09fc447765646bd405c59b0b20960362a594
2021-09-14 12:05:39 -07:00
Álvaro Velad Galván 9f54c41860 fix(TTML): fix image subtitles parsing in TTML (#3294)
TTML allows "smpte:backgroundImage" on both the div level and p level. Adding parsing the background images into cues on the div level.

Closes: #3097
Closes #3248
2021-04-01 14:40:01 -07:00
Joey Parrish 43538fba43 fix: Fix TTML background image attribute case
Ever since background image support was introduced in PR #1859, and
since the feature was first released in v2.5.0, we were checking for
"imagetype" (lowercase) instead of the spec-compliant "imageType"
(camelCase).

This fixes the parser to accept both, and updates our unit tests with
spec-compliant content.

Fixes #3196

Change-Id: Ife13ca92220e4bfde150f9f0b1d9a3de3a954821
2021-03-08 15:14:40 -08:00
david-hm-morgan 57ba772fc0 fix: Support localized whitespace preservation in TTML (#3043)
Closes #3011
2021-02-18 10:12:13 -08:00
david-hm-morgan d3640d1da1 fix(TTML): Fix TTML extent and origin percentage calculations (#3044)
Closes #3044 .
2021-01-29 10:11:07 -08:00
david-hm-morgan df74eab0ae feat(ttml): Add support for SMPTE namespace 2013 (#3062)
We have TTML SMPTE XML Namespaces support for 2010.
Add SMPTE namespace support for 2013.

Closes #3061 .
2020-12-26 12:35:27 -08:00
aluklon 2bebfd3de6 fix(ttml): Calculate viewport anchors for cue region (#3065)
Width should be used for calculation x, and height for calculation y.
2020-12-24 09:04:54 -08:00
michellezhuo 65a6f265c7 feat(text): rename cue "spacer" to "lineBreak"
Change-Id: Ifca815b2f4d0c5f6e34edaa7b9fcb809d963f701
2020-11-16 07:53:16 +00:00
Jacob Trimble 20923cca5d fix(ttml): Fix another hard-coded namespace.
This also changes the tests to fail if we use any hard-coded namespace
prefixes.

Fixes #2756

Change-Id: I06cb7c2043cd7e1278f89a355e40d9d5d375d87d
2020-11-10 00:24:35 +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 df22ddacda cleanup(text): Remove hard-coded tts:extent namespace in TTML parser
Closes #2860
2020-09-23 02:04:19 -07:00
Joey Parrish 85476bc227 fix(ttml): Fix TTML style inheritance
Styles in TTML can refer to other styles for inheritance.  This fixes
the implementation of inheritance in the TTML parser so that it
recurses up the chain of styles that refer to other styles.  This is
done both for elements and regions.

Fixes: 159050711

Change-Id: I59a8f9df73d98710832b329f59ce64ba28c9f573
2020-08-11 14:00:41 -07:00
Joey Parrish f539147d48 fix: Correct license headers in compiled output
This fixes all the license headers in the main library, which corrects
the appearance of the main license in the compiled output.

It seems that the `!` in the header forces the compiler to keep it in
the output.  I believe older compiler releases did this purely based
on `@license`.

Issue #2638

Change-Id: I7f0e918caad10c9af689c9d07672b7fe9be7b2f3
2020-06-09 16:05:09 -07:00
Alex Jones 64557ff82c Add support for nested TTML captions with an offset (#2602)
Closes #2601
2020-06-03 11:49:15 -07:00
Joey Parrish f15f371d20 Fix issues with nullability of strings
Various issues with the nullability of string types led to various
fixes, including:
  - adding an assertion or runtime check that something is not null
  - moving an existing null check to before a calculation
  - converting a test expectation into an assertion that the compiler
    understands (which will still fail the test if the assertion
    fails)

These issues were caught by a compiler upgrade.

Issue #2528

Change-Id: I11da091c9e7974c8bea84b3b584cbd29d1e320e2
2020-04-29 22:40:49 +00:00
Joey Parrish 8867db6773 Fix implicit string-to-number conversions
This was caught by a compiler upgrade.

Issue #2528

Change-Id: Ica262703aa30dce2e59c139c88f3c1e74d5d9e2f
2020-04-27 17:33:06 -07:00