Commit Graph

22 Commits

Author SHA1 Message Date
Joey Parrish 06fd3ce322 fix: Fix strict compiler errors
In our Google-internal build systems, with the strictest compiler
settings, we were seeing errors related to these two issues:

1. A missing require
2. Incomplete type info

This fixes the errors in that environment.

Change-Id: I9c4c482ed6ef8f669e113263a70958b53138c4ee
2020-06-11 10:17:48 -07:00
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 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
Michelle Zhuo a6beb0efdc Update media files to ES6
Issue #1157

Change-Id: I81ff0cee6e479bba728c1e65af70133ba6f28091
2019-05-20 23:11:16 +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 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
Aaron Vaage fd2d61d027 Make Stall Detector Configurable
Make the stall detector configurable via Player.configure. This
should make it easier for developers to work around stall issues
and make it easier for us to find ideal configuration for
different platforms.

This exposes:

- Enabled   : A flag for whether or not the player should
               initialize and use a stall detector.

- Threshold : The number of seconds that must pass without
               progress before firing the stall-event.

 - Skip     : The number of seconds to skip forward after a
              stall-event.

To make enable possible, the stall detector was made optional and
is now passed into the gap jumper. This allows Playhead to evaluate
the config and create the detector as desired.

Issue #1839

Change-Id: Ife1bf34b4cfc7b469f4b0beb312a06d5b5cd81a9
2019-03-20 19:19:03 +00:00
Aaron Vaage 7a56dd1bdc Prevent late-timer-invokes
In our tests, it was possible for a timeout to fire after |clearTimeout|
was called. This CL makes sure that cannot happen by adding an "alive"
flag to each timeout.

To ensure that the change was as well defined as possible, this CL
changes how |shaka.util.Timer| is implemented and updates the API to
better communicate what is happening internally.

Change-Id: I57e3899046a762bff3293b9822a7e8f7ac804042
2019-03-12 18:52:32 +00:00
Aaron Vaage 7148354aab Refactor Playhead (and below) to use IReleasable
This change takes playhead and its internal members and moves them
over to use the IReleasable interfaces instead of the IDestroyable
interface.

Change-Id: Iddb525725591a29a61ca6b5e2ad519ab708164eb
2019-01-24 01:11:48 +00:00
Aaron Vaage 43afe3a7c8 Refactor Event Manager To "Release" and not "Destroy"
We often use the IDestroyable interface to provide us with a standardized
way to break internal references and tear-down objects, however many
objects don't need this to be async. Once using IDestroyable, everyone
must assume that you must be async.

This change introduces IReleasable, a sibling to IDestryable, which
provides the |release| method. IReleasable is the synchronous version of
IDestroyable.

This change converts EventManager from IDestroyable to IReleasable as
the first of many conversions.

Change-Id: Ic3e90e594abc1c7326eccbe2521eb71676b74a09
2019-01-24 01:11:38 +00:00
Aaron Vaage e2d0e8c562 Model Stall Detection On Its Own
While looking into a bug that involved stalling content, I found it
hard to keep the separation between stalls and gaps straight in the
code.

To help make it easier, I tried moving the stall code into its own
class (but used by the previously owning class).

During this change, an edge case was found, when paused for a while,
when we start playing again we see that as a stall. To avoid this,
we reset our stall duration so that once we start playing again, it
won't think it was stalled.

Change-Id: Ia6055e56e12ae4bc02063eeb6bbf6ffe472c2cb5
2019-01-18 18:52:56 +00:00
Aaron Vaage 9e180712f4 Update Timer to ES6
Updated the shaka.util.Timer class to ES6. In this upgrade, the implementation
was slightly changed to make better use of arrow-functions.

Documentation for the class was expanded on to better document how multiple
calls to start would work. To ensure consistency, both "schedule*" methods were
merged into a single "start" method.

Issue #1157

Change-Id: Iae86cae4d9cb751f0985ef20c371c0023c40bd53
2018-12-21 23:39:54 +00:00
Joey Parrish 49ce58bffa Fix chopped playback in MS Edge
Fudge the append window end to fix a playback bug in Edge.

Because Edge does not seem to implement MP4 edit lists correctly, we
may end up with some audio truncation and a gap.  If we fudge the end
of the append window a bit, we avoid this truncation and we get a
continuous buffered range and smooth playback.

Fixes #1597
Fixed #1435

Change-Id: If28f3f5499dbf5ad9d33ee4859f95ebd91ad3e59
2018-11-30 18:48:55 +00:00
Jacob Trimble d95b37732b Fix stalls on Tizen TV.
Sometimes the Tizen TV will stall inside a buffered range.  We have
stall-detection logic, but for Tizen's case, it doesn't change the
readyState of the video, so our logic doesn't trigger.  This changes
the logic to work for other kinds of stall too.

This also changes the tests since they waited too long.  Since the
tests would wait for a second, the stall-detection logic would trigger
and move the playhead.  So now the tests move time more frequently to
more accurately represent the moving playhead time.

Fixes: 110093558
Change-Id: If4dd36dd3da309d5a9bc67d539bf2f9cb27df862
2018-09-27 20:21:51 +00:00
Joey Parrish fd0449d8f7 Re-enable some disabled style rules
This re-enables the following style rules:
  - "block-spacing"
  - "brace-style"
  - "comma-dangle"
  - "comma-spacing"
  - "new-cap"
  - "no-multi-spaces"
  - "no-multiple-empty-lines"
  - "one-var"
  - "padded-blocks"
  - "prefer-rest-params"

Change-Id: I15d616e8d5b88b273ded6128b4f9ad86bdb26bd1
2018-07-09 19:44:56 +00:00
Aaron Vaage dc06c1f680 Make Gap Jumping Controller Take Timeline
Before, we would pass a manifest to the gap jumping controller
just to use the presentation timeline. To avoid needing to have
a manifest, we can just pass the presentation timeline to it.

Issue #816

Change-Id: I606645cbfcc82811ee95f1f39d750f99f8e7efaf
2018-07-09 17:58:20 +00:00
Jacob Trimble 759eef9685 Change goo.gl links to bit.ly.
https://goo.gl is being turned-down, so we can't use it for new URLS.
So we have consistent short links, this converts them to be
https://bit.ly.

Change-Id: I07a86cba807b67157664893341f648023918d0de
2018-06-22 20:20:00 +00:00
Sandra Lokshina 8065bd54a8 Change namespace from shakaExterns to shaka.externs
Change-Id: I16432351e2a266aa8fd175669aa27c44bfdffeae
2018-04-11 17:26:26 +00:00
Theodore Abshire 5ae80cc67d Typo fixes and rewording in comments, part 4
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: I5904ec91b96417a9ac5e19cb4f7b07a084f26ac8
2018-03-21 17:25:03 +00:00
Jacob Trimble 624acc66b8 Add curly braces to all blocks.
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
2018-02-21 11:23:34 -08:00
Jacob Trimble 909c7a8fde Don't jump extremely small gaps.
The browser should handle extremely small gaps for us.  So having the
browser handle these gaps, this avoids an infinite loop if there are
rounding errors.

Closes #1309

Change-Id: I365f44185f570571f6b093bdcaad92fef49b5b16
2018-02-21 18:42:35 +00:00
Jacob Trimble 917a01df5b Split Playhead responsibilities.
This splits some of the independent code from Playhead into several
new helper classes.  This allows Playhead to be simpler and easier to
understand.

This keeps the new behaviors and classes as private pieces of Playhead
to keep Playhead conceptually in-charge of handing the Playhead.  It
still has the same responsibilities, but the code is split into other
files.

Issue #1224

Change-Id: Ia828f902ba9490d128f4ca9cb1e34119ec93f188
2018-02-20 18:10:22 +00:00