- Reduce times for "short delays".
- Remove backoff delay from networking tests.
- Avoid hard-coding delays in the library.
- Move Storage tests to integration tests since they use indexedDB (and
take over 200ms each to run).
This reduces the time it takes to run unit tests (with --quick) from
50 seconds to about 6 seconds. Now all but one unit test finish <100ms.
Change-Id: I88461472a87c4cf750a36d07d07422818e069a4d
This add a filterDescribe that can be used to filter groups of tests
based on platform support. This consolidates the different test
filtering to one place.
Change-Id: I8f320fcf0edfa2d984433890fcfc3714e78b195b
This makes progress callbacks into a required parameter on all network
scheme plugins. This does not mean that every plugin must make use of
the callback, but every caller must supply the callback.
In production, NetworkingEngine already supplies this callback
universally, so our HTTP plugins make use of it whenever progress data
is available.
Our tests, however, did not always supply this callback, leading to
test failures. These failures were more likely to show up in Jasmine
3 than Jasmine 2 for some reason, which caused us to downgrade back to
Jasmine 2 recently.
By making the callback required, we can clean up this inconsistency
between test and production and give the HTTP plugins what they expect
in all cases.
Issue #1949
Change-Id: I8a6e1904e73cf7ca6ae8f3964261c339f404854d
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
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
We use custom indentation for the ManifestGenerator to make the repeated
calls easier to read. This disables the coming linter rule for these
blocks of code. This also goes through and unifies the formatting. The
indentation should be 4 spaces from the left side.
Change-Id: I687e69cea39bded1e9e06bffdcc888970b383fa2
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
This enables the eslint rule that requires all functions to consistently
either return a value or not return a value.
Change-Id: I98b579f3689c3b6c74968116824231bb792bd9dd
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
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
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
Track methods are now implemented for native HLS and other src=
playbacks. This will allow the UI to select text and audio languages.
This change adds best-effort methods to get track information for src=
playbacks, including native HLS on Safari. In many cases, it relies
on the audioTracks and videoTracks members of HTMLVideoElement which
are only implemented on Safari. They are in the spec, though, so
there's no harm in using them when they exist.
This is fully parallel to the manifest-based paradigm for MSE-based
playbacks. Each of these top-level methods in Player has an "if" to
decide which way to supply the requested info, except for the language
methods, which now delegate to the track methods.
With this, Safari's native HLS can supply audio and text language
information to the UI/app, and the UI/app can have some control over
those things through the tracks API. I believe this is important to
the success of our new iOS support.
Issue #997
Issue #382
Change-Id: Icc44a932927fafedda1b62a9d4c6e2ed3dc7db30
We support these older ones and warn about the deprecation, so do not
also leave the older configs and trigger an error from configure.
Change-Id: I49e25e43ce556ff54ad3c1f1408699ff36c31833
This makes some of our integration tests more robust by using
integration test utilities for observing playback status.
b/128923302
Change-Id: Iae5efe55308660bfe1cde9a7f735ee54dbc0b526
Before we would just wait X seconds and hope that playback would reach a
certain point. In some cases this would mean waiting 10 seconds.
In this change, those tests are changed to poll the media element's
current time. To allow context-specific timeouts, we include a timeout
time with each call. This equates to "we expect to see playback pass
time=X within Y real seconds".
Change-Id: I8293c7dd5fdccf2c1d910fb48e037c93a25e3199
There was an access suppression tag in the offline tests, however there
was not accesses to suppress. Removing the tag did not yield any
compiler errors or runtime errors.
Change-Id: I4a6d4a5611791427d752b1fd2157e9aa7ae35ec1
Isolate the download estimation code out of DownloadManager so that it
can be tested in isolation and allow the code in DownloadManager to
focus on downloading.
Change-Id: I509adeaf50acb77bfaa9b2128f730de2653eda81
The |Destroyable.with| function was a way to ensure that objects were
destroyed regardless of success or failure. With ES6 we have the
try-finally to offer this functionality.
This replaces all uses of |Destroyable.with| with try-finally with
exception of |shaka.offline.Storage|. |Storage| appears to have testing
errors if we change over to try-finally.
Issue #1516
Change-Id: Ia772b94aed047a1dd7b406fd2d716bcb64a0ca10
Refactored |StreamUtils.getAllVariants| to get variants from a collection
of periods (rather than a manifest). This allows us to avoid needing to
assert that the manifest exists (when we know it will).
Looking long-term, as part of the refactor the method was moved to a
period-focused utility class. The goal of this is to make it easier to
see what methods may go away when we flatten periods.
Change-Id: I50aa97583892361ee4714a7beaf61e4cd95fb6b4
In our storage tests we need a player instance in order to get
a player config and networking engine. However when we initialize
a player with a video element, it attaches to the video element
and initialize media source. This is not needed in the storage
tests.
Issue #816
Change-Id: I1cf2bf6b447da9f17df07f9ab2657dec18eebe13
This adds workarounds for one of the issues affecting the test, but
not all of the issues affecting the test. The test must remain
quarantined until some of the issues in Chrome are resolved.
Change-Id: Ib44c09737d9abf56d5614b0bdfac800fa3518086
This updates the comments to explain why the test fails, what we are
waiting on from Chrome, and under what conditions it could leave
quarantine.
Change-Id: I1def268ebbc59a4e7be57e46d878061b5b7e2efa
In cases of corruption or version mismatch, we must be able to delete
the database without loading anything from it. This comes up in
testing when you run an older version of Shaka Player after a newer
one has created the database.
Our ability to erase the database in these cases was lost when we
fixed#1277. This reverts that change and changes the contract of the
storage classes to ensure that we will always be able to erase the
database, no matter what.
Change-Id: Iccfbe1fa2ca880877e4743e5ca6bd42cba44abe0
Adding support for CEA closed captions embedded in video streams for
Dash.
1. Dash parser reads and parses closed captions' channel and language
information.
2. Player creates text streams for the closed captions.
3. Media Source Engine calls mux.js Caption Parser API to get the closed
captions embedded in the video streams.
4. Text Engine stores the closed captions, and text displayer shows the
captions.
TODO:
1. Add test cases, will send out another CL.
2. Change closed captions support for hls to the similar way we handle
dash closed captions, will send out another CL.
3. Handle dash content that's missing language indication from the manifest.
Issue: #1404
Change-Id: Ibae8f69623c13561415ec860107d7f5bc86e19e9
If we fail to remove an offline session, don't fail to delete the
content. Instead, store the session ID so we can remove it at a later
time.
Closes#1326
Change-Id: Id76481ece96bd6541367ccc67d13916a2aa51be2
Went through all the class in shaka/offline and removed all uses
of |MapUtils.values|. This required changing many uses of Object
to Map.
Change-Id: I6bd6d37009e7b32ea38e9cbabd64c2d36ffeabbc
This replaces almost every instance of indexOf on both String and
Array. There are very few places where we really wanted an index.
Mostly, indexOf was used to check for inclusion.
Change-Id: I08e299768b6ffdb4bfc30b39b5d82a058c6d1b56
In the Storage unit tests, it should always delete the old data to
ensure it doesn't contaminate other tests. This also removes the
checks in the beforeEach/afterEach blocks since calling pending()
in those doesn't have the desired effect.
Change-Id: Id345882a7ac1ae0ab99d2785851b7553b49a9d3f
Changed the ClosedCaptions field in Stream from an object to an
array of ClosedCaption objects, so that it can be iterated through
and accessed easier.
Issue: #1404.
Change-Id: I67980cf4d5b5746785ba29f95718970fe89056f4
There was an ugly promise chain in Storage.loadInternal. This change looks
to clean up that promise chain and to use async syntax instead.
Part of the refactoring splits |loadInternal| into two more focused methods
as an effort to make the code easier to understand.
Change-Id: Ica113344c6c4ba1d82b6cee281268e20be1aa411
Before, we would need to pass a manifest to DrmEngine to initialize
it. This was a problem as we look to support playback via src=.
When looking at how DrmEngine used the manifest, it appears to just be
a simple way to pass in the variants and the offline session ids. By
changing DrmEngine to accept the variants and offline sessions ids, we
can break the association between DrmEngine and Manifest.
Issue #816
Change-Id: Ie0dc82aaec871d7e6e002fe59b3a984449eda8c7
There are two intents when we initialize Drm Engine and the meaning
of the parameters are nuances depending on what you are trying
to do.
This change creates two different initializing methods so that
initializing drm engine for the intended purpose can be more
clear.
With this, some internal naming was change to better reflect how
some variables were being used to give them a bit more context.
Change-Id: Id8925eca53a34fe870ba5c973f9f0bb584f6e2d6
This change allows storage to be initialized without a player instance.
Since Storage is the same post initialization, the only test being added
is a test that checks that the storage instance was successfully
initialized.
Close#1297
Change-Id: Id2588696eac2a866bba74278322727b1d91f56eb
Our storage progress tests on Edge were sometimes failing as the promise
resolution order would change. This happened because we queue streams to be
downloaded in parallel.
This changes FakeNetworkingEngine to allow us to register an async function
as a callback for a request. This allowed us to update the test to resolve
network requests in lock step ensuring a deterministic order.
Since the progress test rely on a lot of assumptions, the tests were moved
into their own top-level group and now have their own test manifests.
Change-Id: Id366efccd15d90814ee34ca9a17df7d733ab6d67
The DASH parser will now expose Representation IDs via new fields in
the Stream and Track objects. The "id" field will continue to be a
unique, auto-generated numerical ID, and will be supplemented by a
nullable string containing whatever was originally in the manifest.
The HLS parser will now expose the NAME attribute in the originalId
field as well.
Bug: 112087288
Change-Id: I6b8107d27780fb97ab18de767f7abdc6c7110fe7
As part of the effort to allow storage to be initialized with or
without a player instance, this change moves the offline config
into the player config and changes storage to share a configuration
object with a player instance.
We opted to share the instance between the two classes because if
storage was initialized with player, the initializer is implying a
relationship between the two objects and therefore configuration
changes should be shared.
Issue #1297
Change-Id: I991365255e63c284fbfcf147cf63c9588dd764ab
Created the Destroyer class to handle working with IDestroyable so that
IDestroyable can be a simple interface (no more static methods).
Change-Id: I5afd915b895a4c60d758475a2b879bf0eb0096c9
Before, when clearing storage with Storage.deleteAll, offline
licenses were not released. Now before erasing storage, all
sessions ids are collected and requested to be removed.
Closes#1277
Change-Id: Ib88a14f5132d3b2a34bd339cc45f121792b65ebc