Commit Graph

13 Commits

Author SHA1 Message Date
theodab 9d1fe4abd5 fix(preload): Fix error handling (#6753)
After a previous bugfix to the preload system, we ended up with a
situation where the
overall progress in the preload was tracked by two promises:
`successPromise_`, which is resolved when the preload finishes
successfully.
`destroyPromise_`, which is rejected with an error when the preload
process trips an error condition.
These two promises were confusingly named; it sounds like destroyPromise
is related to the destroy process,
but really it has more to do with errors.
They were also completely redundant, as a single promise can be used to
carry both a resolved and
rejected state.

This PR simply combines the two promises into one.

---------

Co-authored-by: Joey Parrish <joeyparrish@google.com>
2024-06-04 16:08:07 -07:00
Joey Parrish 0263386599 test: Fix several test failures (#6281)
- Fix bogus assertion failure in tests on Safari (#6272)
- This test should not be seeking so close to the duration (10ms) as to
cause flakiness on certain browsers. Adjusting the seek time fixes the
assertion without compromising the purpose of the test.
 - Fix uncaught rejections in load graph tests (#6274)
- These tests had calls that were interrupted by the teardown process
that occurs after the test body. Waiting for the operations before
ending the test fixes the issue.
 - Fix interrupted load in test on Tizen (#6274)
- This test triggers a deliberate DRM error without waiting for load().
On most platforms in the lab, the load() operation completed before the
error. Not so on Tizen. This exposed a general problem in which we
should be catching errors in this test. Only timing saved us on most
platforms.

Closes #6272
Closes #6274
2024-02-22 10:27:35 -08:00
Joey Parrish d795a00d6c fix(preload): Fix load interruption (#6271)
Interrupting load() was causing two concurrent sets of load() operations
to happen at once, which led the asset URI for the second operation to
be overwritten by the first.

This was exposed by a test failure on Safari. There is nothing special
about Safari, but the timing happened to work out such that the
concurrent load() calls would intefere with each other.

This fixes the issue by acquiring the mutex in load() for the
preloadManager.start() operation.

This issue did not affect any releases.

Closes #6225
2024-02-21 15:28:57 -08:00
theodab 489b11a959 feat: Add preload system to player (#5897)
Adds a new player method, preload. This asynchronous method creates a PreloadManager object, which
will preload data for the given manifest, and which can be passed to the load method (in place of an asset URI)
in order to apply that preloaded data. This will allow for lower load latency; if you can predict what asset will
be loaded ahead of time (say, by preloading things the user is hovering their mouse over in a menu),
you can load the manifest before the user presses the load button.
Note that PreloadManagers are only meant to be used by the player instance that created them.

Closes #880

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2024-02-02 00:27:29 -08:00
Álvaro Velad Galván 272b7a973a test: Fix some tests in Safari 17 (#6078) 2024-01-10 17:47:13 +01:00
theodab 4425dca283 chore: Remove state engine (#5752)
The state engine mechanism, designed for the player class, was
over-engineered. The structure of the class makes debugging player
errors unnecessarily annoying, by obfuscating the code-path the error
followed, and in general
has created a significant amount of technical debt.
This changes the player to use an async-await setup for the top-level
operations, laying things out much more cleanly
and linearly.

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2023-10-30 23:59:08 -07:00
Joey Parrish fbbd63d96b test: Late load tests, fix Chromecast test flake (#4115)
This change fixes tests on Chromecast by loading tests later in the process.  Test scripts are now dynamically inserted by boot.js, rather than loaded by Karma.  The bootstrapping code then awaits the completion of that before starting the Karma frameworks (Jasmine) to run the tests.

This also removes the use of goog.provide/goog.require in tests and test utils.  We don't need to load test utils or library sources dynamically in each test, and this gives us more explicit control over script loading and ordering.

Closes #4094
2022-04-11 15:47:48 -07:00
Joey Parrish 1507b1e844 chore: Update URLs after moving projects (#4008) 2022-03-03 14:34:40 -08:00
michellezhuo 648e12e9c1 build: add goog.require for compiler upgrade (Part 4)
Change-Id: I6b4a7209c7a3a9f6069351377dac32f22222c0fb
2020-10-12 16:54:08 +00:00
Joey Parrish 7e6a0f38ff fix: Correct license headers in misc. files
This corrects/normalizes license headers in misc. files, such as
config files, docs, build tools, tests, and externs.  This does not
affect the compiled output, and is only done for consistency.

Issue #2638

Change-Id: I9d8da2de55243b08d7df2b743aac73c6f15e858a
2020-06-09 16:13:56 -07:00
Joey Parrish a48f8792a9 Move test-only method to test utils
This method should probably never have been in the library, since it
creates a fixed-sized, muted element.

Change-Id: I53b474305465bef34d43ce40ec5e7dedceb20a25
2020-01-06 18:57:28 +00:00
Joey Parrish 64896d70b0 Use shorter license header
This reflects changes in Google's policy on JavaScript license
headers, which should be smaller to avoid increasing the size of the
binary unnecessarily.

This also updates the company name from "Google, Inc" to "Google LLC".

Change-Id: I3f8b9ed3700b6351f43173d50c94d35c333e82b4
2019-11-22 18:18:36 +00:00
Jacob Trimble cbcfba031d Avoid having two top-level describe() blocks.
This moves some of the tests around to have each file use only one
top-level describe() block.  This removes some Player integration tests
that are already tested elsewhere.

There are two cases where there are two top-level describe() blocks
left: the segment reference and http plugin tests.

Change-Id: Iab7365919cfba739d4710184f079b6d2638192b6
2019-09-12 15:50:43 +00:00