An empty list is still truthy, so the if statement should check for a
non-empty list instead. This ensures we don't try to append captions
when we play audio-only content.
Fixes#2187
Change-Id: I589a5508878ab28ad1ac69211f331ea829fa8b28
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
Include event ID in findSimilarRegion_() check so that events with same
presentationTime and duration but different ID are treated as separate events.
Closes#2077
According to RFC 3986, URL schemes should be case-insensitive. Our
scheme plugin map is registered with exclusively-lowercase scheme
names, so we should convert the input scheme to lowercase before
looking up the plugin.
Closes#2173
Change-Id: I78218c18d3df154aabd101a9ef5fd3156d0c57a8
When we are in the "same" stall, we shouldn't handle the stall multiple
times. If we do, the video will step forward slowly over time, which
isn't desirable; especially on slower platforms where a seek would
restart the time it takes to start playing again.
Change-Id: I11a1811f9ecf754484d3530f4dc047cf95b007a4
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
We would incorrectly initialize the embedded captions multiple times
during a Period transition, which caused duplicate cues to be given to
the displayer. We also wouldn't handle the case when switching between
embedded captions and external text during a Period transition. This
fixes both cases and adds tests for them.
This also avoids passing an empty cue list to the displayer.
Fixes#2076
Change-Id: I89add3eb86ad8d93644bba14eabd11f98d57bc5e
The demo tests previously had fake versions of some functions and
classes from third-party libraries. However, it turns out there were
a few things that were not being provided.
Specifically, this adds fakes for what we use of dialogPolyfill,
MDL's componentHandler, and the methods on Awesomplete.
b/140930726
Change-Id: I4f283d48850b4fe127976840b3f9037a089b1274
Because src= content lacks codec information, ClearKey setup fails.
However, because there was no DrmInfo prior to the ClearKey settings
being applied, the variable hadDrmInfo was false, which led to a
suppression of the resulting DRM error.
Instead, we should count ClearKey settings toward hadDrmInfo. So now,
ClearKey settings are applied before we calculate hadDrmInfo.
Closes#2139
Change-Id: I14d5bfe63fd2ce1a461ae7ef8c2fee7f42bb1b3e
This moves some of the tests around to have each file use only one
top-level describe() block. This removes some Player integration tests
that are already tested elsewhere.
There are two cases where there are two top-level describe() blocks
left: the segment reference and http plugin tests.
Change-Id: Iab7365919cfba739d4710184f079b6d2638192b6
The event was being raised synchronously, so it wasn't getting caught
by the waiter. This caused each test to take 5 seconds while it waits
for the timeout. Now the tests take <100ms.
Change-Id: Ia62423a22cff6eb6098fded43b914ae379b07a88
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.
These tests don't use the compiled assets, and this line doesn't even
build the assets for the compiled library, it uses the uncompiled
library.
Change-Id: Iff5c74c7ef258a18c29a3011266ce459f9e5cf75
Before we would only update the current Period when we got a key status
change; this caused us to fail playback for the second Period if the
streams were restricted. Now we update all the Periods.
Closes#2135
Change-Id: I2238a90c1d367a1d898ec26e4318852cd26da4b7
This standardizes how we handle the spacing in argument comments. The
other way is much more common, so we standardized on that. This add a
new linter rule to catch and automatically fix those issues.
Change-Id: I8ea54c47ae4d34cf8e1646e56c6ed8142b42afbe
This allows us to avoid suppressing the indentation rules and ensures
we have correct indentation. It also makes it harder to make mistakes
since the variables are only accessible within the callback and you
can't accidentally contaminate another object with an incorrect call.
Closes#1692
Change-Id: Ic38b5cd57a2587dfc8c115ba782656c15565b655
mux.js version 5.2.0 broke our test since we were expecting a non-empty
segment to be returned. Since it should work fine if we append an
empty MP4 segment, we should just allow it. This changes the test to
not expect any specific value for the buffer.
Fixes: 140235880
Change-Id: I18ed4347c05553e7abcb967beb684d8ad1a2a187
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
Using "new Uint8Array" with a TypedArray creates a copy of the buffer;
this is unnecessarily expensive for large buffers. This adds a rule
to disallow using it in favor of a new utility that correctly creates
a new "view" on the same buffer.
Note it is fine to pass an ArrayBuffer to "new Uint8Array" and it won't
copy; but there there are many cases where the type is BufferSource,
so it could be a TypedArray. Unfortunately, there are many other cases
where we explicitly pass an ArrayBuffer; but the compiler rules don't
allow us to whitelist this case (since ArrayBuffer is part of
BufferSource).
Change-Id: I58696a85a9cbcc188c0b16919c9eeb63e56edca1
We filter out tracks that aren't supported on the platform. For
Chromecast, we filter out high resolution tracks and 6-channel audio
(MediaSource reports no support). This caused our UI resolution test
to fail since the tracks no longer existed.
Change-Id: Ib56ab1ade09a491011d499587b355bcd3a5183da
Fixes: 139733198
Now the EbmlParser and DataViewReader types can accept BufferSource
objects to avoid the caller having to convert it at each callsite.
Change-Id: I527fbc638485214bfe976d7da89b79b6098033a8
This changes the network API to use BufferSource instead of ArrayBuffer,
which allows plugins to return a "view" on a buffer instead of the
whole buffer. This also adds some utilities for changing between
views and buffers.
Lastly this forbids the use of the "buffer" property of TypedArrays
since it doesn't work with partial "views". This audits and fixes the
usages of the "buffer" property to ensure correct usage.
It should be noted that both MSE and EME accept a BufferSource as input,
so we don't need to convert a "view" into an ArrayBuffer before passing
to it.
Change-Id: Iaa417773f8ce5304424e43c7372ce10ebf540d2a
This greatly speeds up startup time when running tests on a modern
browser. This change also fixes a bug in one of the tests that only
worked with Babel running.
Change-Id: I1493ef30388c5043dcdf8350bec7817ab5d28d55
This tests wasn't working properly before since the 'onBuffering'
callback wasn't given to StreamingEngine. This test was broken on
Edge, but at some point got fixed (or Edge fixed it's behavior).
Fixes#1743
Change-Id: I0af48207f5e8ad1c2e5007967a093f243e1837c9
During startup, there was a race between the video element's ready
state and seeking to the requested start position. If the video
became ready before the seek to the start position, there could
briefly be 0 tracks. Reproducing this required a first period start
> 0 and a start position > 0, such that a lookup of the "current"
period during this brief window would return null.
The problem was more likely to be seen on Chromecast, where the time
between load() and the completion of a seek was much larger than on
desktops.
The bug was caused by Playhead, which both seeks to the start position
and manages the concept of "current time", returning the start
position during startup and the video element's position thereafter.
This fixes the race, making sure that startup is not considered
complete by Playhead until the initial seek is over. This adds an
appropriate regression test and simulated content that can reproduce
the conditions in the original bug report.
Fixes b/138941217
Fixes#2045
Change-Id: Ie8a57283468d88697619349a29e37a804586e5ef
This adds a separate configuration value for this because (a) the HLS
parser can't access the streaming configuration and (b) this behavior
is different in that the streams are removed instead of just not playing
them.
Closes#2065
Change-Id: Ic9b1e0d40b161cd4ba0eb6d7c922882112034626
Because configure() is called multiple times, we used to add some of
the event handlers multiple times. For fullscreen, this caused us to
try to toggle fullscreen multiple times. This changes to only add the
main event listeners one time and the DOM-specific ones have been moved
to be added in the configure() call.
This also moves the fullscreen toggle to the try so we can propagate
any errors from it. Lastly, this adds an "error" listener to the
tests to fail the test.
Closes#2054
Issue #2089
Change-Id: Ic78417ce52cae1c53133b5a4217004bb91ebcc4f
Our previous approach:
For every variant tag, find the associated media tags(with the same
group id), create stream info for each media tag, and then create stream
info for variant tag based on that, and create variants.
This approach has duplicate calls for the media tags with the same group
id to create stream infos.
New approach:
1. Get codecs from variant tags
2. Create stream info from each media tag (with the codecs from variant
tags)
3. Create stream info for each variant tag, and then create variants.
This creates stream info for each media tag once, and avoids duplicate
calls to guess the codecs.
Issue #1558Closes#2066
Change-Id: Icdf3133b1b15d1baf60624ff449e0a61fdb78d8a
This reverts commit 6e5a0797de, #2042.
The PR as it landed broke some test cases and functionality for storing persistent licenses, and it doesn't seem to work even for its intended use case.
To prepare for flattening out the manifest structure to remove
periods, this change moves initSegmentReference and
presentationTimeOffset fields into the SegmentReference object. This
way, the segments on either side of a period transition or HLS
discontinuity can have different offsets or init segments, eventually
allowing us to create a single array of SegmentReferences for
multi-period content.
Issue #1339
Change-Id: Ic7eff0483789644881247ecf8044c5fb6a48f0e6
* fix: Reference issue with SegmentReference createUris
* test: Added Segment GetUris Test for timeline
* feat: Get PSSH from segements if not initdata exists
* feat: Get PSSH from segements if not initdata exists
* fix: JSDoc comments and moved drmEngine update to storage
* fix: Remove comments
* fix: Remove unused import
* fix: Lint erros and dedup initData code
* fix: remove no init data test and add check for use persistent license