Commit Graph

2275 Commits

Author SHA1 Message Date
Morten Vestergaard Hansen deed10f37d Ignore MIME parameters in Content-Type check (#2215)
Fixes #1946
2019-10-28 11:28:51 -07:00
Sandra Lokshina 110c0bb485 Create a shaka class to encapsulate ads.
Change-Id: Ic9388679754d24cef7246107e1e3b951977ce27f
2019-10-25 15:23:33 -07:00
Joey Parrish 79e2e68853 Fix export of fetch plugin
Without this, custom scheme plugins can't delegate to this standard
one.

Issue #2205
Issue #2213

Change-Id: I13e9762e75ba9afe9fd7f804404ffb1d2e684435
2019-10-23 20:23:26 +00:00
Álvaro Velad Galván 585c725d09 Allow disable the audio parsing/decoding/.. in DASH/HLS with a config (#2196)
Resolves #2195
2019-10-22 15:00:36 +02:00
Sandra Lokshina 7da5dc91b7 Add ad related errors.
Change-Id: I45ada9c983798a136f4e04caaac91e9d149f6a84
2019-10-18 13:27:14 -07:00
Sandra Lokshina 7afac89bc2 Restructure AdManager to be owned by Player, not UI.
This will allow Ad functionality to be available for apps
with custom UI.

Change-Id: I3911cb6d764b7aef94166b5f6de3a0a7fa8bb8d9
2019-10-18 18:42:13 +00:00
Álvaro Velad Galván a1ce0fea61 Use label from DASH manifest AdaptationSet (#2197)
Fixes #2178
2019-10-18 11:15:34 -07:00
Shaka Player BuildBot 3f712c2652 Merge remote-tracking branch 'github/master' 2019-10-17 14:54:24 -07:00
Theodore Abshire db9a0eebec Throw if ttml parsing outputs <parsererror>.
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
2019-10-17 21:53:58 +00:00
Álvaro Velad Galván 5eaca0aebd Offline license support for manifests without inline init data (#2164)
Closes #1531
2019-10-17 14:53:34 -07:00
Theodore Abshire 9f7652e7ad Modify ttml parser to handle decimal percents.
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
2019-10-11 19:59:01 +00:00
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