Commit Graph

26 Commits

Author SHA1 Message Date
Á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 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
Joey Parrish bd75032d63 fix(TTML): Fix duplicate cues overlapping segment boundaries (#4798)
Closes #4631
2022-12-08 09:05:08 +01:00
Joey Parrish fbbd63d96b test: Late load tests, fix Chromecast test flake (#4115)
This change fixes tests on Chromecast by loading tests later in the process.  Test scripts are now dynamically inserted by boot.js, rather than loaded by Karma.  The bootstrapping code then awaits the completion of that before starting the Karma frameworks (Jasmine) to run the tests.

This also removes the use of goog.provide/goog.require in tests and test utils.  We don't need to load test utils or library sources dynamically in each test, and this gives us more explicit control over script loading and ordering.

Closes #4094
2022-04-11 15:47:48 -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
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
michellezhuo 65a6f265c7 feat(text): rename cue "spacer" to "lineBreak"
Change-Id: Ifca815b2f4d0c5f6e34edaa7b9fcb809d963f701
2020-11-16 07:53:16 +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
michellezhuo 341b92ad04 build: add goog.require for compiler upgrade (Part1)
This change includes files under test/cea and test/text folders.

Change-Id: I1db1ccb6daeea77058cb56f1f5fc80992596600c
2020-10-07 19:20:29 +00:00
Joey Parrish 7e6a0f38ff fix: Correct license headers in misc. files
This corrects/normalizes license headers in misc. files, such as
config files, docs, build tools, tests, and externs.  This does not
affect the compiled output, and is only done for consistency.

Issue #2638

Change-Id: I9d8da2de55243b08d7df2b743aac73c6f15e858a
2020-06-09 16:13:56 -07:00
Joey Parrish 64896d70b0 Use shorter license header
This reflects changes in Google's policy on JavaScript license
headers, which should be smaller to avoid increasing the size of the
binary unnecessarily.

This also updates the company name from "Google, Inc" to "Google LLC".

Change-Id: I3f8b9ed3700b6351f43173d50c94d35c333e82b4
2019-11-22 18:18:36 +00:00
michellezhuo 9d66e3bb09 [Hls] Avoid duplicate calls to get segment start time for VOD
For VOD, the first segment of every Media Playlist in every Variant
Stream must start at the same media timestamp. Thus, we can get the
start time once and store the value, and all the streams can use the
value directly. For live, we assume for the same.
This change reduces calling getStartTime_() from 15 times to once for
Angel One, and also fixes the text segment timestamp issue.
Also removed associated methods that no longer needed.

Closes #1558
Closes #1563

Change-Id: I0e95ab93ea2b13758128f11019b262bc53dbcd38
2019-09-30 15:43:57 -07:00
Jacob Trimble bf5547b78c Refactor ArrayBuffer usage in tests.
Change-Id: I27e898a7d3c2d706e265abfc4b9bde88b67f3256
2019-08-21 20:44:36 +00:00
Theodore Abshire 3a67802ce2 Fix parseFirstCue test on some platforms.
It turns out that, on some browsers, incomplete XML does not properly
parse. This means the parseFirstCue tests did not work on those platforms.
This modifies those tests on platforms that do not support partial XML;
when no support is detected, it instead tries to get the first cue
from a non-partial segment.
This also modifies the HLS parser to only load partial text segments if
the text parser supports it; otherwise, the hls parser will load full
captions in order to extract start times.

b/137945635
Issue #2037

Change-Id: I58112864a818baf155b365a65fba1c8a56eb9520
2019-07-24 11:23:03 -07:00
Theodore Abshire 1e12873fb7 Only parse first cue when getting text start time.
Previously, when the text engine tried to load the start time of
a segment, it would parse every cue in that segment, then check the
time of the first cue. This was judged to not be a significant
performance issue, as parsing cues is a fast operation. However, it
did have an unintended side-effect: in some situations, this method
was being passed partial segments; notably, the HLS parser would load
the first 2048kb of the stream's texts to extract timing data.
If the caption parsers tried to actually parse an incomplete caption,
they would error.
This gives the text parsers "parseFirstCue" methods, and uses those
methods when it only needs the first cue anyway.

Fixes #2037

Change-Id: I2a1fb2f1a96d98967f0c6e6a5c277914a28b42ad
2019-07-17 21:27:32 +00:00
Jacob Trimble 83de1ad634 Use toBe instead of toEqual for primitives.
This ensures that we get the expected types and that type coercion
doesn't convert between types.  This also ensures we are consistent
in how we check for equality of primitives in tests.

Change-Id: I9f3aacdf25ab1afe5e8d6e4b895b5299ee687d54
2019-06-26 18:57:18 +00:00
Jacob Trimble a69047ba0d Convert text tests to ES6.
Issue #1157

Change-Id: I839d4ab38324a2247bb3c788837a16652d401595
2019-05-21 22:56:34 +00:00
Jacob Trimble 47daf49f31 Use arrow functions for callbacks.
This is an automated change to convert use of "function" functions
to arrow functions.  This doesn't change all uses of bind() that
could be converted.  This also doesn't remove all "function" functions.

Change-Id: I40ac7d086bcef947a1be083359c8fd1d4499a9c3
2019-05-09 16:40:46 +00:00
Jacob Trimble c81389741f Prefer const over let.
A coming update to the Google eslint config will require using "const"
over "let".  This makes that one change to isolate the big changes.

Change-Id: I7d0974c3ae15c53cc45a6b07bf9f6586e2d34aca
2019-05-08 09:22:10 -07:00
Joey Parrish fd0449d8f7 Re-enable some disabled style rules
This re-enables the following style rules:
  - "block-spacing"
  - "brace-style"
  - "comma-dangle"
  - "comma-spacing"
  - "new-cap"
  - "no-multi-spaces"
  - "no-multiple-empty-lines"
  - "one-var"
  - "padded-blocks"
  - "prefer-rest-params"

Change-Id: I15d616e8d5b88b273ded6128b4f9ad86bdb26bd1
2018-07-09 19:44:56 +00:00
Jacob Trimble 064089152b Remove spacing around object definitions.
This is an automated fix to be inline with Google style guides, this
was created with eslint's --fix option.

Change-Id: I860eecbc8152603e730aa17a1393f16d26b3b6fc
2018-02-21 13:35:00 -08:00
Jacob Trimble b512db87dd Convert 'var' to 'let'/'const' (8 of 9).
This is part of a change to convert all usages of 'var' with either
'let' or 'const'.  This takes a conservative approach for 'const' where
it will only be used for aliases and storing the "original" values in
tests.

Change-Id: I6a329d28e13a81c9f7136737518c6bb8fa18402e
2018-02-20 11:29:30 -08:00
Joey Parrish 186e3e69c4 Consistently take Uint8Array in text plugins
Instead of taking Uint8Array for media segments and ArrayBuffer for
init segments, take Uint8Array for everything.

Clean-up after #1022, discovered while preparing the upgrade guide for
v2.3.

Change-Id: I1f284f6f51f345e663c06d96d788bd9cfb941c52
2017-12-19 22:29:43 +00:00
Jacob Trimble d125a54656 Use Uint8Arrays in text parsers.
This converts from using ArrayBuffer in the text parsers to using
Uint8Array.  This avoids doing extra buffer copies when using
ArrayBuffer.slice().

Closes #1022

Change-Id: I34a789ec4eb76c95169ba81f27a8433ef25f27f0
2017-10-03 10:36:48 -07:00
Theodore Abshire 3af3a2caec Modified mp4 ttml parser to allow multiple MDATs.
Beforehand, if we were parsing a ttml subtitles stored in an mp4, we did
not account for the possibility that there would be multiple mdat boxes,
each with its own ttml data. In such a case, we would only use the
payload from the final mdat.
I don't know if having multiple mdat like that is really in the spec, but
at least one user has had this problem, and it's a straightforward change
to make that doesn't really slow down the text parser at all (since we
parse every mdat anyway).

Closes #1028

Change-Id: Id782695548cb92f7aa7278843695b670d8c15ff0
2017-09-20 16:18:24 +00:00
Sandra Lokshina c6c6d05810 Move text-related files into their own directory.
This change creates a lib/text directory and moves all files
with text-related logic to it. It also lays the ground for
separating text parsing and display logic. (That change will
introduce even more files with text-related logic which will
crowd lib/media directory).

Issue #796.

Change-Id: I65ac134020a0126ff02a8f2067beb73870232e65
2017-06-06 18:21:09 +00:00