Commit Graph

75 Commits

Author SHA1 Message Date
Dave Nicholas 335eab08ba feat(WebVTT): Handle badly formed VTT (#6147)
Handle remove chevrons that appear as part of the inner text of the
element to avoid parse failure.
2024-01-26 13:01:51 +01:00
Dave Nicholas ee600c4fd5 feat(WebVTT): Remove un-needed VTT payload normalisation (#6145)
The tXml parser gracefully handles this now, so it is no longer needed.
2024-01-23 16:53:50 +01: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 9462e1252d perf(WebVTT): Improve parsing time for unstyled payloads (#6066)
Related to https://github.com/shaka-project/shaka-player/issues/6065
2024-01-10 10:29:19 +01:00
Álvaro Velad Galván ea7d83ed87 fix(WebVTT): Fix wrong writing-mode in nested cues (#5807)
Fixes https://github.com/shaka-project/shaka-player/issues/4765
2023-10-25 10:06:50 +02:00
Álvaro Velad Galván f55c6ab997 refactor(WebVTT): Refactor how nestedCues are handled in WebVTT (#5663)
This change makes WebVTT more similar to how nestedcues are managed in
TTML.
2023-09-15 14:32:10 +02:00
Álvaro Velad Galván 6975be92d4 revert: "fix(WebVTT): Fix wrong writing-mode in nested cues (#5641)" (#5662)
This reverts commit 56a4cea578.

Fixes https://github.com/shaka-project/shaka-player/issues/5661
2023-09-15 13:08:07 +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 76ffd38c1d feat(WebVTT): Add support to ruby, rt, rp html tags (#5642)
Related to https://github.com/shaka-project/shaka-player/issues/2853
2023-09-12 14:27:07 +02:00
Álvaro Velad Galván a2f253f8d6 feat(WebVTT): Add support to text-combine-upright (#5633)
Related to https://github.com/shaka-project/shaka-player/issues/2853
2023-09-12 12:47:46 +02:00
Álvaro Velad Galván 56a4cea578 fix(WebVTT): Fix wrong writing-mode in nested cues (#5641)
Fixes https://github.com/shaka-project/shaka-player/issues/4765
2023-09-12 12:19:04 +02:00
Álvaro Velad Galván 62156bae02 feat: Use shaka.text.Cue everywhere instead of shaka.extern.Cue (#5529)
Closes https://github.com/shaka-project/shaka-player/issues/2818
2023-08-25 10:51:28 +02:00
Álvaro Velad Galván a8f7c41b07 feat(WebVTT): Add support to auto position (#5532) 2023-08-25 06:52:07 +02:00
Álvaro Velad Galván 963cf614d9 feat(SRT): Support stylized payload in SRT format (#5500)
Info about the format in https://docs.fileformat.com/video/srt/
2023-08-21 14:21:49 +02:00
Álvaro Velad Galván ac6a92a28d fix(WebVTT): Fix text-shadow in WebVTT not working (#5499)
Fixes https://github.com/shaka-project/shaka-player/issues/5020
2023-08-18 14:26:53 +02:00
Álvaro Velad Galván 5691d5e459 fix(WebVTT): Add support to middle position (#5366)
This setting is used in https://devstreaming-cdn.apple.com/videos/streaming/examples/adv_dv_atmos/main.m3u8 (Apple HLS example)
2023-06-28 12:39:23 -07:00
Tom Bloom 9b1c614815 feat: Allow VTT files with erroneous linebreaks (#2394)
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>
2023-02-09 11:07:23 -08:00
Álvaro Velad Galván d4fc54f8dc fix(WebVTT): Tags in the WebVTT subtitle are not parsed (#4960)
Fixes https://github.com/shaka-project/shaka-player/issues/4956
2023-02-03 11:11:23 +01:00
Joey Parrish 128562d93e fix(VTT): Fix combining style selectors (#4934)
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.
2023-01-25 15:04:10 -08:00
Álvaro Velad Galván 68968c17d8 fix(WebVTT): Fix voices with styles and support to multiple styles (#4922) 2023-01-24 19:53:48 +01:00
Álvaro Velad Galván 726ef425b0 fix(WebVTT): Add support to &nbsp;, &lrm; and &rlm; (#4920) 2023-01-20 23:41:51 +01:00
Joey Parrish da84a2c86b fix: Fix WebVTT parser failure on REGION blocks (#4915)
We do not yet support VTT region settings, but we should still not fail
when a region block appears in a VTT file.

Related to work on PR #4767
2023-01-19 11:53:22 -08:00
Álvaro Velad Galván a5f8b4361e feat(WebVTT): Add support to voice tag styles (#4845)
closes https://github.com/shaka-project/shaka-player/issues/4844
fixes https://github.com/shaka-project/shaka-player/issues/4843
fixes https://github.com/shaka-project/shaka-player/issues/4479
2023-01-19 11:35:21 +01:00
Álvaro Velad Galván 2b8b38788a feat: Support HTML-escaped cues in VTT (#4660)
Co-authored-by: Joey Parrish <joeyparrish@users.noreply.github.com>
2022-11-09 16:02:46 -08:00
Joey Parrish 3b9af2efa6 fix: Fix HLS live stream subtitle offsets (#4586)
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.
2022-10-17 19:27:55 -07:00
Álvaro Velad Galván 60af516520 feat(webvtt): add support for karaoke style text in WebVTT (#4274)
Closes https://github.com/shaka-project/shaka-player/issues/4264
Closes https://github.com/shaka-project/shaka-player/issues/3893
2022-06-07 11:12:33 +02:00
Álvaro Velad Galván 62bda2cd36 feat: Add support to text-shadow in VTT parser (#4257) 2022-05-27 07:52:55 +02:00
Joey Parrish 58182605a7 fix: Fix VTT cue timing in HLS (#4217)
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
2022-05-11 15:26:02 -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
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
Chuong 3670996269 style: Fix misspelling default (#3602) 2021-08-27 09:27:03 -07:00
bcupac 65e9d8ff85 fix: Display captions with forward slashes (#3556)
Closes #3555 .
2021-08-15 22:30:22 -07:00
Joey Parrish 38ce45dce5 cleanup: Fix nullability declarations
Cleanup imported from an internal Google migration process, courtesy
of Laura Harker.

Change-Id: I11de518eafe6008938589e5250bdcaf8151267e9
2021-06-22 21:03:20 +00:00
Percy Tse d882d282f9 Support WebVTT default text color and default text background color (#3182)
Closes #3182
2021-03-11 08:52:40 -08:00
Álvaro Velad Galván 6db55e0141 feat: Add support for WebVTT style blocks (#3071) 2021-02-18 16:01:36 -08: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 96f36278c4 Be more permissive in vtt files (#2941)
Resolves #2720
2020-10-26 10:05:46 -07:00
slasktrat 1b40aa2532 fix: Recognize "wvtt" codec in HLS WebVTT tracks (#2778)
Co-authored-by: Espen Aa Ljosland <espen@ljosland.com>
2020-08-24 12:39:21 -07:00
Joey Parrish 4bf22e2359 fix(VTT): Fix timing of VTT in HLS without map header
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
2020-08-12 14:10:11 -07:00
Álvaro Velad Galván f42ccd2867 feat(VTT): Adds VTT tag rendering for <b>, <i> and <u> (#2776)
Closes #2348
2020-08-11 11:58:21 -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
Joey Parrish 92ecacb663 Export default text parser plugins
This makes it easier for apps to app-specific build subclasses of
these plugins.

Closes #2428

Change-Id: I4fde7de76c139bfeddc1afecccf9374a49ecee19
2020-02-26 10:22:27 -08:00
Jacob Trimble 3f63021a2f Avoid using "new" with factories.
Instead of having the "factories" use "new" to construct them, now they
will be plain functions.

Closes #1521

Change-Id: Ia6151ad679a78a5c6db128d43094c82add0af348
2020-02-19 09:57:51 -08: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 1ada5e7574 [Hls] Move MPEG TS Timestamp rollover to Vtt Text Parser
Change-Id: Id840f8201d9d31f00fa38c88f632ff9e515e07a6
2019-10-08 23:39:52 +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 50938a02a4 Remove throws directives.
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
2019-08-28 17:00:04 +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 5c35108cb8 Avoid integer for loops.
Issue #1518

Change-Id: I3ba3cb6a439264e823022b2a64e7cdbd265494c7
2019-07-09 17:11:49 +00:00