Commit Graph

14 Commits

Author SHA1 Message Date
Joey Parrish f539147d48 fix: Correct license headers in compiled output
This fixes all the license headers in the main library, which corrects
the appearance of the main license in the compiled output.

It seems that the `!` in the header forces the compiler to keep it in
the output.  I believe older compiler releases did this purely based
on `@license`.

Issue #2638

Change-Id: I7f0e918caad10c9af689c9d07672b7fe9be7b2f3
2020-06-09 16:05:09 -07:00
Joey Parrish 286ff17361 Fix getPlayheadTimeAsDate while loading/buffering
Before we buffer a segment, video.currentTime will be 0, even for live
streams.  So this should not be used in getPlayheadTimeAsDate().
Instead, we should use the Playhead time or the time that will be used
later once content is loaded.

Bug: 149549467

Change-Id: I585fd2364003021839bc16724f41510637489326
2020-04-30 16:22:34 +00:00
Joey Parrish 342d35f4f9 Fix issues with nullability of numbers
Various issues with the nullability of number types led to various
fixes, including:
 - defaulting a nullable number to 0 to avoid propagating a null value
   through calculations
 - adding an assertion or runtime check that something is not null
 - moving an existing null check to before the calculation
 - returning early on null during an iteration
 - changing a nullable number to non-nullable
 - defaulting to NaN instead of null

These issues were caught by a compiler upgrade.

Issue #2528

Change-Id: I86d516c74a42ee3624c33d7513d2d4c76d3ea589
2020-04-30 16:00:00 +00:00
Jacob Trimble bc45564721 Remove deprecated ability to pass factories to load.
Player.load and Storage.store used to accept the manifest parser factory
directly.  But now they should only accept the MIME type string.  This
removes the deprecated functionality in preparation for v2.6.

Change-Id: I1b4c5a4a9f0b6edbea909d18111ddc87a39da331
2020-02-20 23:44:51 +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 001c3c7b8c Add check for common misspellings.
Change-Id: Iaf546678ed787724513ed21b19a78cc895f069e8
2019-07-08 12:08:45 -07: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 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
Jacob Trimble b87a066832 Add some additional style rules.
- Disallow mixing different types of some operators (e.g. && ||).
- Disallow useless constructors.
- Require a newline between class members.
- Require spacing around arrow functions.
- Require using the compound assignment when possible (e.g. +=).
- Check for possible errors in assignments involving "await".

Change-Id: Ib48167aea61a62b33f0b76bb869abe18398ee5b7
2019-05-08 20:43:07 +00:00
Aaron Vaage e081c5717c Surface "idling" event from walker
The walker knows when it is about to go idle. This even can be useful to
our tests and cast receiver.

This change takes the first step and surfaces the event from
|shaka.routing.Walker| through |shaka.Player|.

Some tests were updated to make use of the state-idle-event and
state-change-event.

Issue #816
Issue #997
Issue #1843

Change-Id: I809a6963f49c569883ab58d4ed8e8f5898726ef4
2019-03-21 15:58:39 +00:00
Aaron Vaage f9aaec4d2a Have Walker Surface Error
When the walker encounters an error, it handles the error but it did not
surface the error. This made it hard to log the error without putting
the log statement in the walker.

This changes the walker to pass the error to the handle error method so
that the class using the player (e.g. Player) can use the error in
determining how to respond to the error.

Change-Id: Ied91f8fcf80d5dd8058e8ba58de16d25213c2f0b
2019-03-12 20:33:43 +00:00
Aaron Vaage a072f858ab Use Abortable Operations in Walker
Changed the walker to use abortable operations so that the current
step can be aborted when a new route is added.

Aborting is only done the current step because then the route
interruption logic will kick-in. When a step is aborted, the
onCancel event will be triggered.

Issue #816
Issue #997

Change-Id: I2ae3d29cbd5b08673eb0738e39c0010d286f3738
2019-02-26 23:42:36 +00:00
Aaron Vaage b978ae83b5 Refactor Player to Use Walker
This is the initial integration between the walker and the player. In
order to make this simpler, this keeps all of "load" as one transition
and will slowly break it into multiple parts in later CLs.

Tests that focused on verifying the changes in states were moved from
the unit tests to the integration tests.

As of this CL we model the load graph as:

  Detached -> Attached -> Loaded -> Unloading
      ^         ^                       |
      |         |                       |
      +---------+-----------------------+

With this CL we lose:
  - Interrupting manifest load retries when interrupting a load.
  - Interrupting loading.
  - Pre-initializing media source.

We have immediate plans to add back:
  - Interrupting loading.
  - Pre-initializing media source.

We are still designing how to handle:
  - Interrupting manifest load retries when interrupting a load.

Issue #816
Issue #997
Issue #1570

Change-Id: Ie929621f94c2701f7d4e031b7a31dbd1c74a69c6
2019-02-26 23:42:36 +00:00
Aaron Vaage e1e312538c Add load graph toolkit
In order to support multiple different forms of loading, we have
designed a toolkit that we are calling "The Load Graph Toolkit". It
allows us to describe a series of work as a graph, and provides a way
for us to move through that graph, executing actions at each step.

This is the first step toward resolving #816, #997, and #1570. This
will provide the framework to build a more structured system for
loading and unloading content.

Issue #816
Issue #997
Issue #1570

Change-Id: I2f91089d07b0c901843550492308fcfd775bf161
2019-02-26 23:42:36 +00:00