This makes a large number of small typo fixes. It also rewords a
number of comments and JSDoc descriptions, and does some
formatting standardization.
This doesn't fix every single issue, but it fixes a lot. Notably,
there were some formatting issues I declined to standardize due to
ambivalence on what the proper standardization would be; for example,
when and where empty lines should show up in JSDoc.
Change-Id: Ibcaf21382bd78b91e589122983dd14e001bfdad5
- Translate uncaught Promise rejections into test failures
(Chrome only until the event is more widely implemented)
- Clean up uncaught Promise rejection caused by exceptions thrown
after destroy() in:
- CastProxy
- CastReceiver
- NetworkingEngine
- StreamingEngine
- Clean up uncaught Promise rejection caused by test cases in:
- CancelableChain unit tests
- DrmEngine unit tests
- StreamingEngine unit and integration tests
- Player unit and integration tests
- Speed up rejection in NetworkingEngine when we should not retry
- Add --delay-tests to test.py, to aid in debugging uncaught
Promise rejections and other types of async test pollution
Closes#1323
Change-Id: I5a8f5702a22430929babeb071bf6650c52c5ad17
Google style guide requires adding curly braces to all block statements
even if it is only has one line. This fixes it by using eslint's
--fix flag followed by running clang-format to reformat the change.
Change-Id: Idc086c2aa8c02df5ef8b2140a11bfb9128eeb4bd
This is part of a change to convert all usages of 'var' with either
'let' or 'const'. This takes a conservative approach for 'const' where
it will only be used for aliases and storing the "original" values in
tests.
Change-Id: I475eba0a477d13cd9201c88ad44899d521ad8991
When changing networking engine to use AbortableOperation, we had an
accidental regression. Now, when it runs out of retries, it rejects
with an error of "undefined" instead of with the actual error that was
causing it to retry.
This changes networking engine to save the last error and return with
that. It also modifies the unit tests to catch this problem.
Closes#1278
Change-Id: I8af9a81d7a8ad58d195a8e9f1af622ddbc3592f2
This uses AbortableOperation in all networking, from the scheme
plugins all the way to the request interface.
This also updates all default scheme plugins, docs, and sample code.
Backward compatibility is provided for scheme plugins and the
request API in NetworkingEngine. This compatibility will be
removed in v2.5.
Two cancelation-related tests have been disabled in
player_integration until the new abort interface has been adopted
in the manifest parsers.
Issue #829
Change-Id: I91c8e6efe97798d111e8ddca5655cddc1f6bcbf3
This adds the ability to supply an isCanceled() callback when making a
backoff object. If the callback is provided, the backoff will break the
timeout into a series of 200 MS timeouts, and check isCanceled() between
every segment.
This changes makes it so that, when canceling a load, you can quickly end
the current backoff. This will making canceling a load significantly faster,
especially if the player is on a late retry.
This still does not quite fix issue #1084 to my satisfaction; if the
manifest is currently downloading, the cancel will need to wait on that.
Canceling an in-progress manifest download will be yet another followup CL.
Issue #1084
Change-Id: I0a53310a9b521de375f2e128f63eaa133547c340
If the parser is failing to load a manifest, perhaps due to being offline,
and the player is destroyed mid-load, it will wait for all of the retries to
run out before canceling. This causes a significant wait time on destroy.
This change adds an optional isCanceled callback to the request method in
NetworkingEngine, allowing requests to be made that can be canceled via a
provided callback. This is then used to quickly skip past all of the
retries, when destroying the parser.
This doesn't stop any backoff in progress, so there still might be a delay of
a second or two (depending on networking settings, of course) if you destroy
during a backoff period. That will be changed in a followup CL.
Issue #1084
Change-Id: I0b99616ed4d5be078161122532ea271e84613170
This modified the networking engine to store every plugin it is given
for a scheme, and adds a priority system to pick which of the plugins
to use.
Issue #829
Change-Id: I21a8a534383f2be898160d609d77efecfc2b684b
This extracts the delay, backoff, and fuzzing code from
NetworkingEngine in a way that can be used by other classes that need
this same backoff/retry behavior.
Issue #976
Change-Id: I2a370fc996e6f8f507768559c44cf7855e16abe1
This adds a severity field to Error objects. This can be used to
detect whether an error is recoverable. All the same errors are still
reported so the field can be ignored.
There are two possible values:
* RECOVERABLE means that the Player will try to recover from the error
* CRITICAL means the Player will be unable to continue and must call
load() again
Closes#564
Change-Id: Ie2c5468340c13e7a288b99690ab65b7ecc0a6b29
This adds a field to the network response that will indicate that the
response was from a cache and should be ignored for bandwidth
estimation.
Change-Id: I6b02e9d4fb3be02731bdf0a2a46bc5ce5f11e302
By exporting StringUtils and Uint8ArrayUtils, we can simplify the
process of wrapping, unwrapping, and parsing requests and responses
in NetworkingEngine filters.
This makes it easier to write filters that deal with text-based
data, as it is no longer the job of the application developer to
deal with subtle conversions between string and ArrayBuffer.
We will also fill in requests with defaults if needed. This allows
developers to omit fields when initiating extra requests at the
application level.
Closes#667
Change-Id: Ie6a0f23b4d46e7e458d996759eac6cd85a36b741
In some cases, the networking engine could have attempted to
remove a pending request that did not exist, thus removing other
requests.
Change-Id: I08fb9c11c3dd153af7a148fcb591fe5c0c3634a1
This allows the networking plugins to pass the duration it took for
the request. For example, if a plugin were pre-fetching the segment,
this allows the plugin to tell NetworkingEngine about how long it
really took to download.
Closes#621
Change-Id: Ie67e3f99389cf02d5b4a345bde06ccc418b6e91c
The test flake was caused by a leaked instance of Playhead interfering
with NetworkingEngine unit tests. The quickest way to reproduce a
failure on the networking tests was to focus the unit tests for
Playhead and NetworkingEngine and run the suite on IE11.
Playhead tests tear down the Playhead object after each test.
However, one test created two Playheads, effectively leaking one.
That leaked Playhead would continue to poll the fake video element
after the test was complete. Polling used setTimeout.
The NetworkingEngine unit tests would mock setTimeout and show that
the engine was calling it appropriately. However, the leaked Playhead
would also call setTimeout during the NetworkingEngine test, which
would cause an expectation on the number of calls to fail.
The Playhead tests should clean up after themselves, but the
NetworkingEngine tests should not have to mock global setTimeout in
the first place. This change not only fixes the Playhead tests, but
isolates NetworkingEngine's use of setTimeout to a private method
which can be mocked without affecting global state.
Change-Id: I94dd7f6c39c25f81c7e4122895ab5fae0feef2cb
An upcoming compiler release will allow us to generate externs from
exports. Because of that, we are adding some extra exports which are
otherwise not needed at runtime.
- Export properties which implement an interface
- Export classes which are referenced in external APIs
- Export base classes of other exported classes
Change-Id: I78b3a4569b4b82b0a9d8993978faf268c2a791d9
If an external project wants to reference the filter or scheme plugin
typedefs, these should be in shakaExtern.
Change-Id: I7bf70d2efbf741c8b07a7b8502b3f52eff49dd9d
Still missing custom controls for live, but otherwise functional.
UI design and CSS based on work by Sam Dutton.
Change-Id: I0ee41254fb3b145822b018dff87aa583d6bef179
Using goog.asserts will work with the compiler. So rather than
simply casting a nullable value when passing to a method, we can use
an assert which will correct the type and print a log if it somehow
is null.
This is not the same goog.asserts found in closure library, this
simply calls console.assert, but it is not required to do anything
for the compiler help.
Change-Id: I2548e39e772f0aa7ec41437cf9f5a2be383e0fbd
Before there were two style to indent comments after an annotation,
using 2 and 4 spaces. Now this only uses 2 spaces.
Change-Id: Id06415d7193cc154a2768fb3932aff7a06b7ed32
Uses location to determine what the scheme should be if unspecified.
This is important because it allows us to use URIs that work for
either HTTP or HTTPS hosted apps without mixed content warnings.
Some special sauce was needed to make it testable, since we generally
can't mock location in tests.
Change-Id: I294ac532f1bba80977597e11addd7f585d1e9b79
The optional arguments in this convenience function really only help
in the tests. To avoid some component in the library accidentally
making a request with default retry parameters instead of those
configured by the user, I'm making the retry parameters required.
The optional argument for method is only used once. To avoid the
temptation to add more positional arguments for other seldom-used
fields, I'm dropping the method argument completely.
Change-Id: Ib0afb5766f68c5505f11372e3b004fc8eaca1223
This adds some utility functions to NetworkingEngine for common
actions. This also cleans up the related unit tests.
Change-Id: I1105b77b6dac3637d566c1a4e2f77004ad705e8b
This is important to avoid renaming properties during compilation so
that applications can inject these types without compiling their code.
This also migrates record typedefs to the new documentation format.
Each record will be annotated with 'property' for each field in the
record. This results in better output from jsdoc.
Change-Id: Ia877b1e2b333ef7020a85f16bc2469a20879bf94
Renamed variables to only use URI instead of URL. Also made variable
names plural when referring to an array of choices.
Change-Id: I7bfd5022606d77a3153575d8f13dd1e040331901
This error type will be used for all internal errors, and will rely
on numeric error codes which can be easily checked by the application.
This also changes PSSH parsing to throw on errors instead of retaining
partial data.
Issue #201
b/25306826
Change-Id: I19d23d99d4ee72cb31fe5f233bac57a3a9cfc283
This changes namespace exports to the more targetted exportDoc,
adds exports where they are needed and removes them where they are
not. Exporting of Uint8Array and String utils should be re-evaluated
later.
Change-Id: I9298e73a0a5ef026b6f2b1854488d2c359be10c1
Previously, destroy() would reject as soon as any in-progress request
failed. Now, destroy() waits for all requests to end regardless of
their ultimate state.
Also adds tests to cover destroy() behavior and drops unused test
util code from 1.x. Line coverage for NetworkingEngine is now 100%.
Change-Id: I0e39e494d8f28c6dc595725a46094d10e3a58e93