## 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.
Bad linebreaks will now cause cues to be skipped (with a warning),
rather than throwing an error.
Closes#2358
Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
When multiple style blocks exist for the same selector, they should be
combined. For example,
::cue(b) { background: white; }
::cue(b) { color: blue; }
should set both the background and foreground of bold tags.
Subtitle timing and offsets were not calculated correctly for HLS live
streams. This issue appears to have affected all v4.x releases up to
v4.0.5, v4.1.5, and v4.2.2.
Since the transition to sequence mode for HLS in v4.0.0, VTT cue
timings were broken. This is mainly because VTT cue timing in HLS is
meant to be based on an offset from the media timestamps, and we
generally don't know those now that we use sequence mode.
To fix it, this change uses MediaSource segment mode for the very
first video segment as a way to extract the timestamp, then clears the
buffer, switches to sequence mode, and appends it again. This lets us
get the timing data we need, while avoiding major drawbacks of the
previous HLS implementation:
- We don't need to fetch segments upfront (which is high latency)
- We don't need to fetch segments twice (once for timestamps, and
once again to buffer)
- We don't need to maintain parsers (which were complex and limited
the formats we could support)
Closes#4191
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>
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
1. Add support for multiple layers of nested cues.
2. Add support for anonymous span.
Closes#2623Closes#2761
Change-Id: I10a253b1a965606fc2db49c3168e92bcf4a95fa1
When there is no X-TIMESTAMP-MAP header, the HLS spec states that the
client should map 0 to 0, effectively. That means we were wrong to
offset the cues by the segment time.
Since DASH IOP states that segmented text should be packaged in MP4,
this should not affect compliant DASH content.
Closes#2714
Change-Id: Iddb00f2fd1afeb4f0f2c99f92f65e5db0e3a84f1
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
Instead of having the "factories" use "new" to construct them, now they
will be plain functions.
Closes#1521
Change-Id: Ia6151ad679a78a5c6db128d43094c82add0af348
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
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
These are intermittently used and cannot be verified. Most of our
methods can throw a shaka.util.Error, so having it doesn't really add
anything. Plus, if we change a function to throw, we'd need to update
all their callers to ensure they have an accurate description of what
they throw; otherwise we can't trust the directive.
Change-Id: I520bd0fc4c33443e967bf5b103ca5aa9e3274884
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