Commit Graph

475 Commits

Author SHA1 Message Date
Jacob Trimble 0f92d8221f Fix use of private tags.
Issue #1553

Change-Id: I8c0412eda3d68f2ad475bf8282afcaeffd80852a
2019-08-13 19:08:48 +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 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
Joey Parrish 625938e2f9 Revert offline PSSH support for manifest that are missing inline init data
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.
2019-08-02 16:56:24 -07:00
Shaka Player BuildBot 2ad32aa5b8 Merge remote-tracking branch 'github/master' 2019-07-29 15:57:34 -07:00
Jacob Trimble 5c580e243e Throw an error when FairPlay cert not set.
Fixes #1940

Change-Id: If911986eb70838b1aa81fc85f088c8367f7e1b48
2019-07-29 21:02:21 +00:00
Ante Wall 6e5a0797de feature: Offline PSSH support for manifest that are missing inline init data (#2042)
* 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
2019-07-26 11:01:05 -07:00
Sandra Lokshina 5aefcc7fc1 Clear up the fix for enabling Chromecast.
Change-Id: Ib39f1d7a73890e5174724f05cb0d2ba465a470e6
2019-07-17 19:58:20 +00:00
Jacob Trimble fd0dc8a5cc Add utility for looping from 0 to n.
Closes #1518

Change-Id: I865f7a0311516d04ae84532dab873e1aaa31eb24
2019-07-10 21:23:22 +00:00
Jacob Trimble 5c35108cb8 Avoid integer for loops.
Issue #1518

Change-Id: I3ba3cb6a439264e823022b2a64e7cdbd265494c7
2019-07-09 17:11:49 +00:00
Joey Parrish 08cec995c9 Replace find/get callbacks with SegmentIndex
This replaces find/get callbacks in Stream with a SegmentIndex.  With
the exception of DASH's SegmentTemplate+duration, all manifests were
already backed by SegmentIndex.  Now, all manifests are backed by
SegmentIndex.  This will simplify Period-flattening, in which all
tracks will be represented by a list of segments, some of which come
from different Periods.

The SegmentIndex in Stream will not be created until
createSegmentIndex is called.  Prior to this change, the find/get
callbacks could be invoked without createSegmentIndex() in some cases
(excluding DASH's SegmentBase), which some lazy tests took advantage
of.  Now that find/get are methods on SegmentIndex, createSegmentIndex
must be called in all cases.  The tests have been updated accordingly.

Making SegmentIndex generation async in all cases exposed some issues
with the parser context being modified in-place between one
Representation and the next.  So the parser now makes a shallow copy
of the context before it is bound into an async callback.

To facilitate updating the SegmentIndex for SegmentTemplate+duration
content, SegmentIndex now has a method to update its list on a timer.
Once per segment duration, the index will be updated to add and remove
SegmentReferences.

The initial expansion of SegmentTemplate+duration will be limited to a
relatively small number of segments, to avoid excessive CPU or memory
consumption.  This defaults to 1000 segments, but is configurable.

Issue #1339

Change-Id: I99c007b1096c3b396d04a729750cd7b743cb899d
2019-07-08 22:22:13 +00:00
Jacob Trimble 47533d1173 Add an enumerable() method for loops.
This is a helper to aid in iterating over items.  This returns a list
of objects that contain:
- "item": The current value.
- "prev": The previous value in the list.
- "next": The next value in the list.
- "i": The zero-based index in the list.

Issue #1518

Change-Id: Id18ab977e3ae45dfbfd2b4137a1bffb6e53c6bce
2019-06-27 16:31:42 +00:00
Sandra Lokshina 24f5a29501 Export protected memebers of shaka.ui.Element
This enables custom buttons that aren't part of the
library to be used in compiled mode.

Closes #2011

Change-Id: I500f93a86bfd2893948e594a969b6f8208836251
2019-06-25 22:07:34 +00:00
Jacob Trimble f6d0f15fa6 Refactor handling of destroy().
This changes several classes to use the Destroyer class to handle
destroy().  This also changes the behavior to not ignore destruction
and instead throw a new error.  This is more clear for callers and
ensures we propagate errors.

Change-Id: I756c085639558509c22e5c43d69ddf4acd28d46f
2019-06-19 20:39:20 +00:00
Jacob Trimble 424f21c839 Use log2 to avoid a loop.
We can calculate the index of the highest bit set using log() instead
of looping and using bit math.

Change-Id: I6ff9af600cb17ea83398ce6fbbcb84982a789653
2019-06-18 22:54:36 +00:00
Jacob Trimble 7bbca076aa Detect the chunk size the browser supports.
Instead of using a hard-coded chunk size when creating large strings,
this now uses a browser check to detect it.  This allows us to use
large chunk sizes on browsers that support it but still support low-end
devices.

Closes #1985
Closes #1994

Change-Id: Ibe45902b659516ae66bd7da33007fd15e7f64207
2019-06-14 19:53:50 +00:00
Jacob Trimble 3da809019b Enable additional ES6 linter rules.
Change-Id: I6861541b27153ba034364a5972a9b086de581cef
2019-06-11 18:35:09 +00:00
Jacob Trimble 98aa050de9 Fix addEventListener on some platforms.
Some platforms (e.g. IE11 and Tizen) don't support passing an object as
the third argument to addEventListener.  When we do, it interprets it
as a "true" for the capture value and causes the listener to be called
at the wrong time.  This now detects whether the browser supports this
and calls the boolean version if not.

Fixes #1979

Change-Id: I05b3f5e536a9bcb5c275cac7f243a9ccc88f8149
2019-06-07 16:46:57 +00:00
Theodore Abshire 9af7baac8e Fix minor formatting issue in config utils.
Change-Id: I940cc28bf4a9a8edcf31a8ffaaa77a48e222d8f2
2019-06-06 19:56:03 +00:00
Theodore Abshire 5369d11c7b Also export PlayerConfiguration utils.
It turns out that we do not export the PlayerConfiguration utils.
This caused the recent fix to the demo configuration section to break
the nightly, when in compiled mode.

Change-Id: I361145c900f38ae132b2fa4408e0c3a7e02364ce
2019-06-06 19:55:25 +00:00
Michelle Zhuo f67df3d7ad Use eventManager.listen() instead of addEventListener in UI
Issue #1924

Change-Id: I9870d4002fd5f0f99b5de164de41b107af1b3d9b
2019-06-05 16:25:26 -07:00
Theodore Abshire f666974f8c Store base configuration in demo.
In some previous change, the drm configuration method was changed to
reset the player's configuration first, to remove any previous asset
drm configuration.
However, this also removed any user-originating configuration.
This changes the demo to store a record of the configuration from the
perspective of the user, and re-applies that instead to "reset" the
configuration.

Closes #1976

Change-Id: Ia1a659bd037cfd347e5bf763d7145e1523fca56a
2019-06-05 20:49:56 +00:00
Sandra Lokshina 3e3e940e34 Add a temporary fix to enable casting.
Issue #1948

Change-Id: Id3953cdc32f1cdd02729c1a3f08c522b2ee376f1
2019-06-03 21:05:36 +00:00
Jacob Trimble 43e798870f Misc ES6 conversions.
Issue #1157

Change-Id: Ia25a6cae84575f003980e9694b2769f2976e1342
2019-06-03 15:31:57 +00:00
Joey Parrish 615ce93178 Fix formatting of test failures/errors
Code in karma-jasmine's adapter will malform test failures when the
expectation message contains a stack trace, losing the failure message
and mixing up the stack trace of the failure.  To avoid this, we
modify shaka.util.Error not to create a stack trace.  This trace is
not available in production, and there is never any need for it in the
tests.

One test expectation had to be updated.  The previous version of
jasmineError would use the original error by reference.  Now that it's
capturing a few fields explicitly, the severity value doesn't update
when NetworkingEngine modifies the original.

Change-Id: If7af93a1a0357df9763dbf6a4afc45db2c8317df
2019-05-31 21:29:27 +00:00
Theodore Abshire 34e6ea4fba Convert FakeEvent and FakeEventTarget to ES6
Issue #1157

Change-Id: I027a1177fcd098f458b2cc3c3d92f93b43d26447
2019-05-30 17:11:12 +00:00
Michelle Zhuo ebdf9d7817 Update Util files to ES6
Issue #1157

Change-Id: Ib81d198e46bc57745f60af328d1160064e253ba3
2019-05-30 16:40:49 +00:00
Sandra Lokshina 0e7c366e9d Convert more utils to es6.
Issue #1157.

Change-Id: I49092237b7fe7f98a22087b0ecf41f65005dbc61
2019-05-28 22:17:48 +00:00
Sandra Lokshina afa82e2692 Convert array, config and dataViewReader utils to es6.
Issue #1157

Change-Id: I3f57077939f1e8b044dc8af3c826b98e2e1003e1
2019-05-24 20:58:07 +00:00
Joey Parrish 4a4edf52d8 Fix a comment typo
This typo was found by a robot.

Change-Id: I255730c4d4c8cbf6122b6d430d1acf11f5f2d26c
2019-05-20 18:25:52 +00:00
Sandra Lokshina dbb774fa9f Convert ui utils to ES6 and merge duplicate utils.
Both DOM and UI utils had a removeAllChildren method
that did the same thing. This change removes it from
the UI util and replaces all calls to it with calls
to the DOM util.

Issue #1157.

Change-Id: Iaf7998c460c03416d8651e2efd53c96bdcc9a258
2019-05-20 11:08:22 -07:00
Joey Parrish ea4d941f39 Clean up EBML size constants
Instead of using an array of Uint8Arrays, which could trigger a
load-time failure on very old browsers, store an array of number
arrays.  This is equivalent for the purpose of comparison, and it
cannot fail at load-time.

This cleanup seems to fix minor test flake in the EBML parser tests
that was observed with upgraded node modules.

Issue #1694

Change-Id: I87b2307bceddb3a21dfc81d4fe9828afd9508617
2019-05-15 20:32:34 +00:00
Joey Parrish bd787fd069 Raise the default bandwidth estimate
For browsers without NetworkInformation API, a configurable default
bandwidth estimate is used until we have enough data to build a real
estimate of our own.

This raises the default to 1Mbps.  Applications can still set their
own default.

Change-Id: I86d7e7b028e9bf8c8e928d4db28cd1683ebc8646
2019-05-13 22:37:04 +00:00
Jacob Trimble d5780d401b Fix line length issues for indent fix.
Change-Id: I87d75fd88000f8f9bff7b9f1bf5667ba28f6dd60
2019-05-13 22:31:20 +00:00
Jacob Trimble f130dffcef Enable eslint indentation rule.
This is a fully automated change.  The linter will fail because the
extra indentation caused line-length errors.  These won't be fixed
automatically.  They are fixed in a follow-up to make this one fully
automated.

Change-Id: I4d8cf9c998985add2bcd24a81c8d65495668c4f3
2019-05-13 22:31:09 +00:00
Joey Parrish 615b46d70c Fix initial bandwidth estimate on Chrome
The Network Information API gives us an initial bandwidth estimate on
Chrome and Opera (and others, some day).  But the API changed slightly
in a way that broke our detection of it.  This restores the
functionality so that our initial bandwidth estimate is closer to what
we will converge on during playback.

Change-Id: Iaff9224c98127e6fcad1f188d73d243a45f36cd7
2019-05-13 22:29:02 +00:00
Jacob Trimble 0dd64074b9 Only allow one statement per line.
With the new style rule, we cannot have two statements on the same line.
So we can no longer have an "if" on a single line and we cannot have
an arrow function with a body on the same line as when it is used.
This is mostly a manual change.

Change-Id: I2285202dd5ecbad764308bc725e6d317ff2ee7f0
2019-05-13 22:11:50 +00:00
Jacob Trimble f225c047f6 Reorder eslint rules and add some more.
This reorders the rules so they mostly are ordered the same as the
eslint documentation.  The exception is the few at the top, most of
which should be removed.  This also removes some rules that appear in
the recommended or the Google set.  Lastly this adds some more rules:

- Require parenthesis when using "new".
- Disallow confusing regex (e.g. /=/).
- Disallow some confusing coercions (e.g. +foo).
- Disallow some Unicode characters in a regex.
- Disallow using "async" in a Promise constructor.

Change-Id: I597b472bdaee5b4cb92354f057e7ae6aeb96eefa
2019-05-09 22:14:18 +00:00
Jacob Trimble ded2b84313 Require consistent return values.
This enables the eslint rule that requires all functions to consistently
either return a value or not return a value.

Change-Id: I98b579f3689c3b6c74968116824231bb792bd9dd
2019-05-09 20:34:47 +00:00
Joey Parrish ab6f9cfd3d Allow short-form config for UI and offline
With this change, offline and UI config can use the same two-argument
short form that the Player config interface offers.

Change-Id: I5f40ef58da76f3aab1d7178fe7d6e82097352b9a
2019-05-09 19:34:01 +00:00
bcupac b8f032a05e Use standard base64 encoding in FairPlay license request (#1932)
Closes #1915
2019-05-09 09:55:38 -07:00
Jacob Trimble 47daf49f31 Use arrow functions for callbacks.
This is an automated change to convert use of "function" functions
to arrow functions.  This doesn't change all uses of bind() that
could be converted.  This also doesn't remove all "function" functions.

Change-Id: I40ac7d086bcef947a1be083359c8fd1d4499a9c3
2019-05-09 16:40:46 +00:00
Jacob Trimble cea3161ce9 Misc fixes for arrow functions.
A follow-up commit will convert "function" functions to arrow functions.
This caused some errors with the compiler, which this change fixes
beforehand.

Change-Id: Iff85b1e1f56b63a38b09f8db9947ed5daf02ddf4
2019-05-08 20:43:20 +00:00
Jacob Trimble c81389741f Prefer const over let.
A coming update to the Google eslint config will require using "const"
over "let".  This makes that one change to isolate the big changes.

Change-Id: I7d0974c3ae15c53cc45a6b07bf9f6586e2d34aca
2019-05-08 09:22:10 -07:00
Joey Parrish 683d17f57e Hide volume button on mobile
Fixes b/131924038

Change-Id: I4c86cb14c240c8e795e18fdf54e8bee11a3cec61
2019-05-07 22:28:56 +00:00
Joey Parrish 662d6e6533 Un-export IReleaseable
No exported classes implement this, so we do not need to export it.

Change-Id: I9d91e486d598a05f02c3056a5aaa8afae14a32e8
2019-05-07 19:10:46 +00:00
Joey Parrish cbfe4f82a4 Fix warnings found by a newer compiler version
This is only some of the warnings produced.  These were not errors,
but we should fix them anyway so that we can adopt stricter settings
in future.

Change-Id: Ifd12f0e7c69f8f4b3d0d78b11794da2569a06d77
2019-05-06 22:25:12 +00:00
Joey Parrish 685e9d57cf Eliminate free calls of static methods
It is type-safe to alias a class, but not one of its static methods.
Aliasing the method without the class makes it a "free call" to invoke
the aliased method.

A "free call" is when you call a method without the context of its
instance of class.  There were several cases of this with static
methods.

This will be enforced by a future release of the compiler, which I
believe will lead into compiler support for "this" in static ES6
methods.  In ES6, you can use "this" in static methods to refer to the
class and call other static methods.  Closure compiler doesn't support
static "this" yet, but we will start using it as soon as it is
supported.

Change-Id: I4249db8b6dda9231ebba60ee0d4ad734a692c2fe
2019-05-03 18:43:35 +00:00
Joey Parrish d27d8180e0 Only use configured license servers if provided
If the application developer specifies license servers, only those
should be used.  Before this, a manifest-specified license server
for a certain key system could still be used if the application didn't
provide one.

Now, if there are _any_ license servers specified by the app, _no_
license servers will be used from the manifest.  This is important
because it allows the application a clear way to indicate which DRM
systems should be used on platforms with multiple DRM systems.

The new order of preference for drmInfo:
1. Clear Key config, used for debugging, should override everything else.
   (The application can still specify a clearkey license server.)
2. Application-configured servers, if any are present, should override
   anything from the manifest.  Nuance: if key system A is in the manifest
   and key system B is in the player config, only B will be used, not A.
3. Manifest-provided license servers are only used if nothing else is
   specified.

Introduced in #1644 to solve #484
Internal issue b/131264101
Closes #1905

Change-Id: I1a36a70044dc7bcc22681e3e4246d0a43d58e413
2019-05-02 20:30:54 +00:00
Joey Parrish b513a48418 Fix range header regression
Range headers should not be sent when requesting the entire resource.
This fixes compatibility with Microsoft IIS web server.

Introduced in work on issue #1788

Change-Id: I151a2f15d4f5e95531e16d5372ee9a051135f12f
2019-05-01 17:02:53 +00:00