Commit Graph

1964 Commits

Author SHA1 Message Date
michellezhuo d520324f57 [Fix] Check initDataTransform with default implementation
Closes #2136

Change-Id: I6c98ceb48d21a26b2a1c4bc7516ee9d7279728bf
2019-10-10 14:27:24 -07:00
Satheesh Velmurugan 22a0d3e85c Include event ID in findSimilarRegion_() check (#2175)
Include event ID in findSimilarRegion_() check so that events with same
presentationTime and duration but different ID are treated as separate events.

Closes #2077
2019-10-09 09:32:59 -07:00
michellezhuo 1ada5e7574 [Hls] Move MPEG TS Timestamp rollover to Vtt Text Parser
Change-Id: Id840f8201d9d31f00fa38c88f632ff9e515e07a6
2019-10-08 23:39:52 +00:00
Joey Parrish 65370b4b99 Update MediaSource polyfills for Safari 13
Safari 13 is out, and needs polyfills just like Safari 12 did
(although one fewer).  This assumes that Safari 13+ all need the same
polyfills (to avoid surprise failures when Safari 14 comes out).

This also raises the minimum version from Safari 9 to Safari 11, since
usage stats for Safari 9 and 10 are vanishingly small.  Dropping
support for Safari 9 and 10 allows us to delete a complicated polyfill
used for those versions.

Change-Id: I8f833d915215fc19a89e3aea292b67c5d677c779
2019-10-08 15:36:38 -07:00
Joey Parrish 9e92167910 Treat URL schemes as case-insensitive
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
2019-10-04 10:32:58 -07:00
Jacob Trimble 260e485cbe Use bind() with console methods.
We avoided bind() since we could use lambdas instead; but with the
console methods, we loose the link to where the log happened in the
DevTools.  So by using bind(), we can see where the log came from.

Change-Id: I04ad1f360e459c3676eabb6d0651a7963d186b43
2019-10-01 17:47:36 +00:00
Jacob Trimble 495e215bee Don't fire stall handler multiple times.
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
2019-10-01 10:10:33 -07: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
Álvaro Velad Galván 46ddaa0b8b Move PatchedMediaKeysMs.normaliseInitData_ to shaka.util.Pssh.normaliseInitData (#2161)
Related to ongoing work for #1531
2019-09-26 10:44:08 -07:00
Joey Parrish 0b2b8e3f02 Eliminate goog.define
Changes in the Closure Compiler have made it so that goog.define
without using and assigning the return value will no longer be
allowed.  There is no need for goog.define, though.  Instead, we can
just use the @define annotation and assign directly to a variable.
This eliminates the use of goog.define.

A similar change was already made almost two years ago for the Player
version in lib/player.js
(in Change-Id: Iad9040d0f5ee397c7d46b1d64bc5bebf2def57bc)

Replaces PR #2158

Change-Id: Ia7c7de0407f9790284c418fb6edde948b922ab62
2019-09-25 21:52:15 +00:00
Theodore Abshire 8173085fc8 Fix strange compiler problem in HLS parser.
Previously, the Closure compiler was causing a strange problem in
non-debug compiled builds in the HLS parser: when we make an alias for
shaka.net.NetworkingEngine.RequestType, if we access RequestType.SEGMENT
the value is undefined. However, if we store
shaka.net.NetworkingEngine.RequestType.SEGMENT in a variable, it works.
Looking at the compiled code, when shaka.net.NetworkingEngine.RequestType
is defined, SEGMENT seems to be treated as some special case, which might
explain this odd behavior.

Fixes #2156

Change-Id: I272dbc8b8db08ef8f9067c535c25890adae32440
2019-09-25 14:17:23 -07:00
Jacob Trimble c014d445a4 Fix Period transitions with embedded captions.
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
2019-09-23 22:54:00 +00:00
Joey Parrish 9e3745f953 Fix suppression of ClearKey errors with src=
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
2019-09-12 10:40:19 -07:00
Jacob Trimble a6b9c484e2 Fix load graph test failure on Firefox 69.
We are seeing spurious errors from the load graph tests.  These errors
don't appear to be thrown from any of our code and I can't find what is
causing the uncaught rejection errors.  But adding a delay seems to
remove the errors.

Fixes: 140725109
Change-Id: Ia08e7a4c12a17cf5610db64b146b863c8e5ecbeb
2019-09-12 15:49:40 +00:00
fadomire 2c0d824a1c Fix support for empty TTML data (#1960)
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.
2019-09-11 14:35:58 -07:00
Sandra Lokshina 1e746e6551 Keep a mapping of compiled to extern player method names in cast proxy.
In compiled mode, UI calls player methods by their compiled, renamed names.
The proxy object doesn't know those, so an error used to be thrown while
casting in compiled mode. This change adds a map from compiled to extern
names that cast proxy can use.
It also cleans up proxy code a bit and points the demo to the nightly
build of cast receiver.

Closes #2130.

Change-Id: I39b83c6a1e050a68d70e7923d1a07ad8929daeeb
2019-09-11 11:20:30 -07:00
Jacob Trimble 0e1e1a0491 Fix multi-Period handling of key statuses.
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
2019-09-10 21:39:19 +00:00
Jacob Trimble 7764ff609f Don't put space before '=' in arg comment.
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
2019-09-06 13:49:10 -07:00
Theodore Abshire a84fd65d9e Added "report bug" button to demo.
Change-Id: I27e25f8b88effc596e2f836ec263f9ae9d2b5fc0
2019-09-04 22:51:03 +00:00
michellezhuo 15968e8d97 [Hls] Remove hard code for finding audio streams with the same uri
For audio only content that the audio variant tag and media tag has the
same uri, we should compare all media tag uris with the variant tag uri,
instead of comparing only the first one.

Change-Id: Ifa985eae441076418fc289e5601020c06c135c24
2019-09-04 20:54:48 +00:00
Álvaro Velad Galván 6d31b57956 Add change event to audiotracks and texttracks (#2134) 2019-09-04 12:04:12 -07:00
Sandra Lokshina 8d4f9a492b Add config for using src= on Safari.
Closes #2116.

Change-Id: I4742037563a20e2e585a6dfbeae29a65bffe2117
2019-08-29 16:07:19 -07:00
Sandra Lokshina 8f57efbe9f Export getMaxSegmentDuration() on presentationTimeline.
Closes #2124.

Change-Id: I6260c2156575ff5adf5c251713d0e1a522334251
2019-08-29 18:35:01 +00:00
Joey Parrish 0fa058662a Support pre-standard DASH MIME type
This adds support for a DASH MIME type that predates standardization
on "application/dash+xml".  Some servers still use the older, now
non-standard MIME type of "video/vnd.mpeg.dash.mpd".  This is trivial
to support, and it helps some folks who needs it, so there's no good
reason not to support it.

Change-Id: I17e85fdb74491e9e32628eddf30ef9e88acf5221
2019-08-29 09:46:17 -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
Jacob Trimble 17684c6c35 Refactor "try" blocks in MediaSourceEngine.
- Avoid nested try block in enqueueBlockingOperation_.
- Simplify running next operation.
  - Ensure QuotaExceeded error is handled correctly.
- Use "throw" instead of Promise.reject.

Change-Id: I0d9d95290baafedd6bbadc158ba826836c9f7d10
2019-08-28 16:54:36 +00:00
Theodore Abshire 1aa015b56a Increase src= fudge factor for buffer end.
Apparently, the 100ms fudge factor we had was not sufficient for
some assets, which could cause those assets to get stuck buffering at
the very end of the video, when on native controls.
This just increases the fudge factor to a whole 1000ms (1 second).

Fixes #2117

Change-Id: Idf3c09f397ebb6abf7f681efaa042608eed60152
2019-08-26 17:17:57 +00:00
Jacob Trimble f169bfae58 Update changelog and bump versions for v2.5.5
Change-Id: Idc87567fea3a3d7df936e82eb41f6e44525c3a90
2019-08-26 15:41:00 +00:00
Jacob Trimble 042dde14a3 Fix playback of multi-Period embedded text content.
Since embedded text tracks are not "real" tracks, we need to ignore them
when handling Period transitions.  This ensures that the other streams
will handle the transition instead of waiting for the text stream to get
updated.

Fixes #2075
Fixes #2094

Change-Id: I2c7c92cb04795edb3f7695677ee6745bad3f4471
2019-08-23 14:39:04 -07:00
Jacob Trimble eac0f57806 Fix conformance violation from PR #2106.
A new conformance rule was added after the PR was started and it is
violating it.  This fixes the violation and adds another assertion.

Change-Id: Ie18760d9e1db1959d9587682ff6c9c8ca4fe6a8f
2019-08-23 08:54:21 -07:00
Álvaro Velad Galván 5a5864c653 Get PlayReady PSSH from <mspr:pro> in DASH (#2106)
Creates "pssh" init data based on the <mspr:pro> element in the DASH manifest.

Closes #2058
2019-08-23 08:46:56 -07:00
michellezhuo 47db0cff08 Skip webm stream instead of throwing exception
We can't parse webm segments to extract segment start
time yet. Getting webm streams in hls stops playback
even if there are other formats we can play. This change
skips webm segments for now.

Fixes #2108

Change-Id: I4ff167efea45967cdf95a91afbe75efef3d9aa32
2019-08-22 22:45:42 +00:00
Jacob Trimble 26aecdd36e Use Uint8ArrayUtils.concat in polyfill.
Change-Id: Ie6170e662ba8964fd2d683f2d06f54b38326e91c
2019-08-22 21:11:16 +00:00
Jacob Trimble b9bad77f70 Mark unsafeGetArrayBuffer as private.
This is no longer used anywhere else.

Change-Id: I7ec005d5d65b195a591ab95fa32bba3518ff3083
2019-08-21 22:02:33 +00:00
Jacob Trimble 454ff49006 Add a type to lazily generate a value.
Change-Id: Ibcd5bc76953f1c0c153dd5845d1b095dac0bb358
2019-08-21 22:02:06 +00:00
Jacob Trimble 971e0012ff Add success* to misspelling list.
Change-Id: Ia2d520e809bfb16fc9cbf187e448e05c29e9ded8
2019-08-21 20:45:41 +00:00
Jacob Trimble 887f2e614d Make Uint8ArrayUtils accept BufferSource.
Change-Id: Ia22b4535f4a6cbc156022299d732b27602c677d3
2019-08-21 20:41:45 +00:00
Jacob Trimble 18b59c5294 Disallow using new Uint8Array with BufferSource.
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
2019-08-21 20:40:59 +00:00
Jacob Trimble ac4fdfd0cd Make the reader types more permissive of inputs.
Now the EbmlParser and DataViewReader types can accept BufferSource
objects to avoid the caller having to convert it at each callsite.

Change-Id: I527fbc638485214bfe976d7da89b79b6098033a8
2019-08-20 22:08:27 +00:00
Jacob Trimble a2bcf7278d Move some utilities to BufferUtils.
Change-Id: Ifb3c4348cc912640b99ff53f7cac59a63480c68e
2019-08-20 22:07:35 +00:00
Jacob Trimble 596c80a949 Refactor handling of ArrayBuffer.
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
2019-08-20 20:17:33 +00:00
Jacob Trimble 32e7665fc1 Updated workaround in MediaSourceEngine.
Chrome has fixed their behavior involving endOfStream(), but both Tizen
and IE11 have the same broken behavior.  Unfortunately these platforms
will likely never be fixed, so we need to keep this forever.

Fixes #1357

Change-Id: Id540170f8c8cb6e0ddf3a30bde5035016fa61df1
2019-08-16 18:35:38 +00:00
Joey Parrish f4536acb7e Fix missing tracks, race on time during startup
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
2019-08-14 18:01:56 +00:00
Jacob Trimble 0f92d8221f Fix use of private tags.
Issue #1553

Change-Id: I8c0412eda3d68f2ad475bf8282afcaeffd80852a
2019-08-13 19:08:48 +00:00
Jacob Trimble 79aae2aeaf Fix protected member names.
According to the style guide, protected members should not end with
an underscore.  This renames them to fix it.  This also marks some
members as private that aren't used outside the class.  Lastly, this
fixes a possible bug with the use of "this".

Issue #1553

Change-Id: I6c7ecdcd228ec4e4aded4af52e2262d0bf5beaf4
2019-08-13 19:08:03 +00:00
Jacob Trimble d7fc19ab31 Allow filtering out failed HLS text tracks.
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
2019-08-12 18:16:28 +00:00
Jacob Trimble e660667725 Make exported docs better for Player.
- Use <code> blocks.
- Use <p> to separate blocks (since newlines in comments are ignored).
- Use <ul> for lists.
- Give messages for deprecated tags.

Change-Id: I06d5e0e75eb3e498063cf0c291e6031af5d93b2d
2019-08-09 21:50:15 +00:00
michellezhuo 1d417ff5ed HLS Refactor: Flatten createPeriod_() logic
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 #1558
Closes #2066

Change-Id: Icdf3133b1b15d1baf60624ff449e0a61fdb78d8a
2019-08-07 19:28:32 +00:00
Jacob Trimble c5b9d6804f Allow custom content ID in FairPlay.
Now there is a generic callback to transform the init data before
passing it to the browser.  This can be used by apps to use a custom
content ID in FairPlay content.  This also adds some utilities to help
in writing these functions and moves the default behavior to DrmEngine.

Closes #1951

Change-Id: I78ce660c126b53a69d5f55b16775ffcdbbe4d748
2019-08-07 18:38:40 +00:00
Jacob Trimble 438d599804 Parse Accessibility tag into text "kind".
Closes #2060

Change-Id: I916bbaf3357e9cdfbcfbfbafbd6dfc99890d7ebd
2019-08-05 10:27:59 -07:00