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
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>
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
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#3850Closes#3741
Change-Id: Ia8d750daa06920610c04e9b26e29d2d304eaf8a9
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
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
TTML allows "smpte:backgroundImage" on both the div level and p level. Adding parsing the background images into cues on the div level.
Closes: #3097Closes#3248
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
1. Added hdr as a property in stream when constructing.
Fixes build failure from commit
71372869de .
PR #3116
Issue #2813
2. Fixed the test error from commit
d3640d1da1 .
PR #3044
Issue #3029
3. Fixed the new line with no other arguments from commit
0845843b65 .
PR #3060
Change-Id: I5833e49c1a95172742c4ec820960c9c5a7bf0cca
1. Add support for multiple layers of nested cues.
2. Add support for anonymous span.
Closes#2623Closes#2761
Change-Id: I10a253b1a965606fc2db49c3168e92bcf4a95fa1
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
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
A regex in the TTML parser was looking for "word" characters (\w),
which is short-hand for non-whitespace ASCII characters, and excludes
Unicode characters and symbols from non-English languages.
There is a better option in Regex in some browsers, which is /\p{L}/u.
This is not supported universally yet, and defining an equivalent
regex constant using character codes is over 4kB of extra code.
It seems that the original author of that code meant "word" (\w) in
the sense of "non-whitespace" (\S), so we can just use \S instead.
This change also adds a regression test that doesn't depend on the
specifics of the regular expression used.
Closes#2478
Change-Id: I794258a797ba5d26a7bd8fc0a5244adc70c8a1ef
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
Previously, if no XML was produced, or if it failed to have a <tt> element,
we assumed that parsing had failed. This caught some failures, but not
every possible failure; there are some partial failures that still return
valid XML. These sorts of errors are signaled by the output containing a
<parsererror> tag; this CL makes us also return an error in this case.
It also corrects the documentation for XML parsing errors, which was
incorrect; it seems that we had been confusing INVALID_XML and
DASH_INVALID_XML for documentation.
Issue #2157
Change-Id: I79716c9d2ff90ed9672eef8e54dd4019d8ca109b
Something I noticed while working on issue #2157; their text tracks
contained percent values with decimals in them (for example "4.17%"),
which was something the percentage-parsing regex we were using did
not handle.
Change-Id: I90f4a223f0a335057a92ae606e7298eefaa0b4aa
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#1558Closes#1563
Change-Id: I0e95ab93ea2b13758128f11019b262bc53dbcd38
When using DOMParser parseFromString with an empty string, it returns an errored XML document. The next part of the code is then executed and throws an unnecessary error.
This adds a special case for an empty string.
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
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
Instead of checking each property separately, just use
jasmine.objectContaining. This also adds a utility for matching a
number that is close to an expected value. This is required when
matching objects with toEqual().
Change-Id: I4de49cfaf254e0752beffc97c578a77f9ec8ee95
This is a fully automated change. The linter will fail because the
extra indentation caused line-length errors. These won't be fixed
automatically. They are fixed in a follow-up to make this one fully
automated.
Change-Id: I4d8cf9c998985add2bcd24a81c8d65495668c4f3
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
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
CSS style 'direction' supports only horizontal directions, (left to
right, right to left), and writing-mode supports horizontal top to
bottom, vertical left to right, vertical left to right.
Separating the field 'writingDirection' to two fields 'direction'
and 'writingMode', so that they're the same as the css style names.
Issue #1708
Change-Id: Ie730bd7d13e5483d7425261854c268cd7f095400
This is an automated fix to be inline with Google style guides, this
was created with eslint's --fix option.
Change-Id: I860eecbc8152603e730aa17a1393f16d26b3b6fc
Google style guide requires adding curly braces to all block statements
even if it is only has one line. This fixes it by using eslint's
--fix flag followed by running clang-format to reformat the change.
Change-Id: Idc086c2aa8c02df5ef8b2140a11bfb9128eeb4bd