Commit Graph

108 Commits

Author SHA1 Message Date
Jacob Trimble 1a4d03e463 fix: Workaround less 3.12.0 bug.
Change-Id: Ifb2b1f91eb2f2697fe24d73f0fcb188dab97486f
2020-07-15 14:16:01 -07:00
Joey Parrish 74d9f031e1 chore: Update mux.js
The new version has license headers, which means mux.js release
bundles now comply with some internal Google policies, which in turn
simplifies some of our internal release procedures for Shaka Player.

Change-Id: I796775231c2be2b252d7cbd7adce5d4002e4df76
2020-06-16 00:17:16 +00:00
Joey Parrish b84061a764 build: Upgrade the compiler
This upgrades the compiler to the latest release and fixes some type
errors in the tests found by the new compiler.

Change-Id: I3a555cbdfc94c51fb0683f8397c6adb8ea43f120
2020-06-11 22:03:47 +00:00
Joey Parrish 1b5ba6d6cd Update changelog and bump versions for v3.0
Change-Id: I6ab88140d03b2aeb238fff5eb54802e4b3e104b7
2020-06-01 15:57:31 -07:00
Joey Parrish b839340220 Add screenshot-based layout tests for subtitles
This adds our first screenshot-based layout tests and the
infrastructure to use WebDriver for screenshots through Karma.
This new kind of test will be skipped in any non-WebDriver context.

There are many pieces to this system.

First, we update the Karma WebDriver launcher to a newly-released
version that lets us access the client spec object from the launcher.

Second, we build a Karma middleware plugin to respond to HTTP requests
from the tests.  We handle /screenshot/isSupported and return a bool
so tests can be skipped on non-WebDriver launchers.  We also handle
/screenshot/diff to take the screenshot and compare it to a known-good
version.

The screenshot is a full-page screenshot, since element screenshots
don't work consistently across all the browsers in our test lab.  The
screenshot is then cropped to a rectangle specified in the request.
This rectangle is measured to match a specific element, so in
practice, we are screenshotting just one element.

Browsers use sub-pixel rendering, effectively rendering at a scale
larger than the "pixels" seen by JS.  The screenshot comes in at this
scale, so the requested cropping rectangle is scaled to match, then
the cropped screenshot is scaled down to the JS-measured size.

Because of sub-pixel rendering, element offsets can be non-integer
numbers.  Normally, Karma puts the tests in a iframe, above which is a
variable-height banner showing which devices are connected to Karma
and what state they are in.  So this variation and the lack of integer
offsets means we can run into stability issues due to rounding errors.
To make offsets consistent and improve stability of the screenshots,
this banner is now disabled in our Karma config.

The cropping, scaling, and diffing of images is handled Karma-side by
a node module called Jimp.

Before we start the layout tests for UITextDisplayer, we use a node
module in the browser called fontfaceonload to wait for our web fonts
to be fully loaded.  This module is a polyfill that polls on IE and
uses a standard API in modern browsers to wait for our font to load.
This is all wrapped into a new test util called waitForFont.

Screenshots are stored in test/test/assets/screenshots/ and are
organized into folders by platform and browser and named according to
an identifier specified by each test case.  The new screenshot is
written to disk with the suffix "-new", and a diff image is written
with the suffix "-diff".  When a test fails, we can review the changes
in a browser with test/test/assets/screenshots/review.html.  The
known-good screenshots can be updated with the new tool
build/updateScreenshots.py.

Change-Id: Ib477fd3c459de466c6dc91e9a60d3e2579164b12
2020-05-26 22:38:04 +00:00
Joey Parrish a3f1c0220f Fix CEA caption extraction for b-frame content
This updates to mux.js 5.6.3, which includes a fix for v1 trun box
parsing to fix caption extraction for content with b-frames.

Closes #2395

Change-Id: I206ce26bb43e8187599e8ca7be2e718f4ea345c3
2020-05-07 14:01:26 -07:00
Joey Parrish 1076b78465 Unfork Closure base and update the compiler
The Closure Library's base.js, the Closure Compiler, and the Closure
deps-writer are all now loaded via NPM instead of commiting them
directly to the repo.  This also updates both the library and compiler
to the latest version: 20200406.

We still have a fork of the Closure Library's URI parser.  The latest
upstream version of that has too many dependencies on the rest of the
library to import directly from NPM.

Some internals of the build system have been refactored, and the
"complete" set of files in the build system now includes third_party.

Our forked URI parser does not pass lint checks yet, so the linter
does not run over third_party yet.

A couple of overly-severe sets of compiler checks have been disabled,
since even the latest Closure Library's base.js doesn't pass them.

The script-loader in load.js had to be updated for compatibility with
the new Closure Library.  If you don't return "true" now, Closure's
base.js will stop loading subsequent source files.

Some local externs that we had written are now available from the
compiler, so our local copies have been deleted.

A few type-related changes have been made as well, removing casts that
were necessary with the old compiler, but not necessary with the new
one.

Finally, this corrects some type issues in the tests using the new
"typeof" annotation from the compiler.  This allows us to type a
variable as a class defined elsewhere.  For example, after loading the
compiled library, we can reference compiledShaka.Player, which has the
type "typeof shaka.Player".  The compiler can then type-check all uses
of it in the tests.

Closes #2528 (bad polyfill code generated by the old compiler)

Change-Id: I62ec61e82d4edf342b2c576c2d4f89f11562ee65
2020-04-30 19:32:30 -07:00
Joey Parrish 42afedd1e4 Update to mux.js 5.5.4
This gets us a fix for a closed caption parsing issue described in
videojs/mux.js#330 and fixed in videojs/mux.js#333:

> Atypical streams containing 2+ SEI NAL payloads of type 0x04
> (CEA-708 caption content) in the sei_rbsp (specifically a DTG1
> payload preceding a GA94 payload) fail to display captions in this
> scenario, as the current logic results in parseSei() prematurely
> returning with the DTG1 payload.
>
> By checking for the user ID within parseSei, mux.js can continue
> iterating through the sei_rbsp for the GA94 payload.

Change-Id: I9d90419643279a1273187e0354b5e991cd609ba2
2020-04-14 10:26:39 -07:00
michellezhuo 734d129fcd Add Support for HLS Discontinuity
Closes #2397
Closes #1335

Change-Id: I6f540c42c72bf0ae36239b682d4016cca3981c0f
2020-04-09 14:59:42 -07:00
Theodore Abshire 25396ce403 Load pwacompat through npm.
Loading pwacompat off of jsdelivr was flagged as a security issue
through an automated scan. Since Google does not control jsdelivr,
that is theoretically true.
This just loads a local version of pwacompat via npm, and uses that
instead.

Change-Id: Iba9288a1d440dfdfa039a32b530f6da981c5b055
2020-02-28 10:43:14 -08:00
Joey Parrish 2714e3127d Update EME polyfill dependency
This release fixed an issue with some versions of Edge.

Closes #2413

Change-Id: I76e5b5f8d36f37d33cdee6e00b91b480ceadde42
2020-02-21 22:58:41 +00:00
Joey Parrish 8a3708de76 Update encryption scheme polyfill
The new release includes support for encryption scheme queries in
MediaCapabilities.

Change-Id: I041773ed4e8e957123bfd3b666749999a72a7da3
2019-12-20 22:50:38 +00:00
Joey Parrish 0ad9aa3fd9 Fix EME polyfill issues
This fixes several inter-related issues:
 1. Catch errors in polyfill installation so that test setup isn't
    interrupted half-way through
 2. Use the compiled polyfill in tests, fixing polyfill installation
    error during tests on IE
 3. Require at least version 1.0.2 of the polyfill, since 1.0.0 had
    bugs in the module export and 1.0.1 had an infinite recursion bug

Change-Id: I38c973152409d9b3168e70e82f20579566663208
2019-12-02 12:28:28 -08:00
Joey Parrish b9b4118938 Add a polyfill for EME encryption scheme queries
Note that the encryptionScheme field isn't being used by Shaka Player
yet, but that this will enable us to experiment with it ahead of the
full launch of the feature in browsers.

See also:
 - https://wicg.github.io/encrypted-media-encryption-scheme/
 - https://github.com/WICG/encrypted-media-encryption-scheme/issues/13
 - https://github.com/w3c/encrypted-media/pull/457

Change-Id: I9e8c2b6ce4ce3f4fe634fa4164669c69959e7fde
2019-11-22 18:18:36 +00:00
Jacob Trimble 568cc46720 Add a custom eslint plugin for private names.
This plugin can be used to write custom eslint rules.  This adds a
single rule to check we name private members correctly.  This plugin
does not get added to NPM, it is only used locally.

Fixes #1553

Change-Id: Ifdf9208d2bd0d09e1adb9c281b0be34266a867c9
2019-08-16 16:15:49 +00:00
Theodore Abshire f24c4a783f Added stylelint, a linter for our CSS/less files.
Also unified CSS/less style based on that.
This does have to use a forked version of stylelint, since there
is a bug (?) in the globbing library they use that causes it to
fail on our buildbot. I found the simplest solution was just to add
an option to disable globbing, a feature we weren't using anyway.

Closes #1867

Change-Id: I9295b01d5b15d060356e314938b64b551b75de6a
2019-08-08 18:38:19 +00:00
Joey Parrish 51a3789ca0 Update karma-webdriver-launcher
This updates karma-webdriver-launcher.  The new version has an updated
"wd" module dependency and additional debugging information which was
helpful to us in addressing a problem with our testing infrastructure.

b/137548763

Change-Id: Id7fbe53a4c11ff09804a74616791b2e77028386e
2019-07-22 16:47:17 +00:00
Jacob Trimble a6b0bb6f8b Remove PromiseMock from StreamingEngine tests.
Issue #1379
Issue #1953

Change-Id: I21cbb436723f3207c707f1596ebb0f8142bab4e4
2019-07-09 11:05:54 -07:00
Jacob Trimble 98b8d55575 Workaround error in promise-polyfill.
A recent push to promise-polyfill (used by our promise-mock) caused
errors in our tests.  This blacklists the new release until they
release a fix.

See taylorhakes/promise-polyfill#103

Change-Id: I65784e393143a21769c0a40e3f8b93cf189f7e8d
2019-06-14 12:00:16 -07:00
Joey Parrish b042a8198b Upgrade to Jasmine 3
This upgrades our version of Jasmine and drops the expectAsync
polyfill we added to compensate in Jasmine 2.  This also drops the
direct dependency on Jasmine, preferring the indirect version expected
by an upgraded version of karma-jasmine.

Closes #1949

Change-Id: Ibbdb26e9a20ab9b9d8b152678b65c63feed8633c
2019-06-05 20:43:33 +00:00
Joey Parrish 2cf09d6301 Fix source map support in tests
This fixes incompatibilites between Karma and Babel with regard to
source maps.

Babel rewrites our code on-the-fly in the testing environment so that
we can run ES6 code and tests on older platforms.  When Babel does
this, it creates inline source maps which map the modified code back
to the original code.

Previously, the karma-source-map-support Karma framework was using
these inline source maps to map stack traces back to the original
code.  This framework, however, uses a V8-specific hook to modify
Error objects, so this only works on Chrome and Opera.

But it turns out that Karma itself already supports source maps for
formatting errors.  For some reason, though, a third-party module is
necessary to connect the dots and make Karma aware of Babel's inline
source maps.  For this, we are now using the karma-sourcemap-loader
Karma preprocessor.

We now have meaningful stack traces on all platforms.

Change-Id: If6033334bb1afb35020f17ae443d6e2192ea5d08
2019-05-22 07:43:48 -07:00
Joey Parrish f6fdec48b9 Fix coverage reports
This changes from using Karma's "coverage" preprocessor to using a
Babel plugin called "istanbul" which adds the coverage instrumentation
to the code.  Because it happens in Babel, all the code
transformations happen in one place, with consistent source maps.
Backtraces in error messages will show the original line numbers, and
code coverage reports will refer to the original line numbers, as
well.

Closes #1693

Change-Id: I706cf21c109f3ec7fa30c6899ca9872c0f8be9d1
2019-05-21 21:37:24 +00:00
Theodore Abshire 96c1f8795c Switch to using tippy.js for tooltips.
Previously, we were using MDL tooltips for our tooltips.
They seemed fine at first, but proved very temperamental; we had to
jump through hoops to get them to work inside MDL cards, and they kept
breaking for various reasons.
This instead adds the third-party tippy.js module, and uses that to make
tooltips instead.

Change-Id: I37ae9c9ade4e3c4dd6cbb1b86601377ed5d9e54f
2019-05-21 16:46:02 +00:00
Joey Parrish 4a8f67686c Downgrade jasmine
This seems to resolve some issues with seemingly unexplainable test
failures since the recent module upgrade.

Issue #1949

Change-Id: I4423f3f9834cdbd71c1432d391aa452a16459e2b
2019-05-17 17:08:19 +00:00
Joey Parrish 42b40bd3da Require NodeJS v8+ and NPM v5+
This updates our build requirements to NodeJS v8+ and NPM v5+, both
released in 2017.

This also clarifies our support for Python 3 (not well-documented
before) to the version we are using on Debian, v3.5.

Requiring NodeJS v8+ means our node tools (like our extern generator)
no longer need shims for compatibility.  This allows us to drop the
"es6-shim" and "array-includes" modules.

In NPM v5+, the "prepublish" script has been deprecated, and replaced
with "prepublishOnly" (which is what we want) and "prepare" (the old
behavior we had to work around).  This allows us to drop the
"in-publish" module.

Change-Id: Ied189c76a58fe981c12d41155b834f2d6ea73bbd
2019-05-15 20:32:34 +00:00
Joey Parrish d153472faf Update all node modules
This updates all node modules, which fixes vulnerabilities found by
npm audit.

Other noteworthy details in this upgrade:
 - Our htmlhint dep was a pre-release version, but a release has since
   come out with the feature we needed.
 - Our jsdoc dep is still a fork, but I have updated it to resolve
   vulnerabilities in jsdoc's dependencies.  I have also updated the
   jsdoc PR that would add the necessary feature to allow us to unfork
   this.
 - Our direct dep on wd was to override the version requested by
   karma-webdriver-launcher to avoid issues with the wd module in our
   testing environment.  With an update to karma-webdriver-launcher,
   its dep on wd is now up-to-date enough that we no longer have to
   depend on it directly.
 - I have verified that all of the odd-looking deps are still being
   used somewhere (rimraf, es6-promise-polyfill, which, etc.)
 - The latest version of babel pacakges use a different naming
   structure starting with "@babel/" instead of "babel-", but we use
   these through a karma plugin which isn't ready for Babel v7 yet.
   So instead we depend on Babel v6.

Closes #1694
Closes #1912

Change-Id: I1cf78232b08a2b4482ace6368cec00af6c566f50
2019-05-15 20:32:34 +00:00
Joey Parrish d66d6c4255 Upgrade mux.js and use minified version
The new mux.js release fixes support for a minified build, so we
should use that from now on.

videojs/mux.js#173

Change-Id: I08cff8d33a520fe753c5490a4719cba3bb27f19e
2019-05-13 14:24:41 -07:00
Joey Parrish fd94c685ee Use clean-css plugin in less.js to minify CSS
Saves 30kB on the UI controls CSS and 8.5kB on the demo app CSS.

Change-Id: Ia17a8096bf014f257eefc3ded918ff2452436154
2019-05-13 17:43:40 +00:00
Joey Parrish 23c79955a7 Fix inlining of external CSS
Importing in less is not enough.  It will not necessarily inline what
is imported by default.  The "inline" option, however, will force the
CSS file to be inlined.  Without this, some of the `@import`
statements are put directly into the output file, triggering
additional network requests at runtime.  This also adds the "css"
option, which forces less to treat these inputs as CSS and not as
LESS.

Finally, we import MDL for the demo app as a node dependency instead
of loading it from another origin.

This improves the demo's Lighthouse scores of "First Contentful Paint"
by 27% and "First Meaningful Paint" by 14%.

Change-Id: I28e627d3df494e3c4893d31b6bf818f09e8153e9
2019-05-13 17:43:40 +00:00
Jacob Trimble a90a8f9fe4 Upgrade eslint.
This allows us access to more lint rules and will eventually allow us
to enforce the "indent" rule for the Google style guide.

Change-Id: I993ab1280c3781cb4b56179b3b1389879501516f
2019-05-08 10:20:00 -07:00
Joey Parrish 3ef441c602 Update changelog for v2.5.0
Change-Id: I515572a11da07c3b153f2e55941606eb799c86fa
2019-05-07 22:32:52 +00:00
Theodore Abshire efc2ed3df1 Added new demo page.
This is a complete replacement for the old demo page, made to be more
modern-looking and easier to maintain. It contains new features such as
remembering the URIs you provide for custom assets, and searching through
the default assets by feature.
This demo page is not quite ready for release yet, but it's getting close.

Change-Id: Iad01d1fc02c3cd238d73b9b9e02dbb4301cb6f2a
2019-05-01 19:58:18 +00:00
Joey Parrish 79077b89b3 Update changelog and bump versions for v2.5.0-beta3
Change-Id: I12292c9dadfb4d179adeadb12c45cf7e7a05e296
2019-02-20 09:46:36 -08:00
Joey Parrish da5c399863 Upgrade mux.js to the latest
Related to b/70902665

Change-Id: I1b58365b4cb484c712e57c56b9f998b51df4936a
2019-02-12 23:16:56 +00:00
Sandra Lokshina 6b1ca2d229 Initial release of Shaka Player UI
Other contributors:
 - @joeyparrish
 - @michellezhuogg
 - @TheModMaker
 - @theodab
 - @vaage

Change-Id: If6df33d9ab5035d1ead4402004f7de37ee8470f4
2018-11-16 14:40:37 -08:00
Joey Parrish 6b976c07ac Update changelog for v2.5.0-beta2 and bump versions
Change-Id: Ic6709aefa478d1675f539c05cd104131a226adbe
2018-11-09 21:25:30 +00:00
Jacob Trimble cdf2348077 Work around bug in wd module.
Version 1.11.0 of the wd module has a bug that breaks our remote
browser tests.  It has been fixed in their master branch, but we are
waiting for them to make another release.

https://github.com/admc/wd/commit/b9678b7602b738ac2906aa4dbd2bac60f861d878

Fixes: 117771894
Change-Id: Iba346590989990ec0885c4d72ce41afac7d8b8d9
2018-10-17 13:23:39 -07:00
Joey Parrish 9211dc129c Add changelog and bump versions for v2.5.0-beta
Change-Id: I6ebfe140d82bb7eb9100211c90023c9b2f352f55
2018-08-23 21:54:42 +00:00
Michelle Zhuo 1a8c63eb35 Upgrade mux.js
Upgrade mux.js to verison 4.5.1 since it supports CEA608/708 closed
captions parsing for Dash now.

Issue: #1404.
Change-Id: I09c26dc44ba2e68734f201f58ba8856c836ed55e
2018-08-17 11:21:48 -07:00
Joey Parrish f164934ce2 Unfork "wd" module
My changes have now been accepted upstream.

Change-Id: I4abfbad9ddcf1167c9b9a7eacfb509ce4552474a
2018-06-01 16:51:41 +00:00
Joey Parrish d70196ba7e Upgrade WebDriver module to new W3C protocol
The WebDriver protocol has been updated, but the "wd" module in node
only speaks the old protocol.  Firefox and IE have updated their
drivers to speak the new protocol, which means that the "wd" module
can no longer speak to Firefox and IE.  This overrides the "wd"
dependency from "karma-webdriver-launcher" with a forked version of
"wd" that speaks enough of the new protocol for Karma to do its job.

Fixes: 80138962
Fixes: 80140386

Upstream issue: admc/wd#495
PR: admc/wd#533
Related: SeleniumHQ/selenium#5952

Change-Id: I6e255543b36c908e59565268fa13abb01f9c9e12
2018-05-29 22:58:08 +00:00
Joey Parrish 4d88905463 Build docs as part of build/all.py
Originally, docs were slow to build, and many people did not need a
local copy.  Now, building the docs is fast, and doing everything as
part of "all" is less surprising.

Closes #1421

Change-Id: I5ac254df9d2beca8c1c5898614782a81e662a0e9
2018-05-11 21:55:32 +00:00
Joey Parrish 0b75b8c974 Bump version numbers for v2.4
Change-Id: I55d42050ba0f6c648049546f8135cf64980f1c0d
2018-04-11 08:04:45 -07:00
Joey Parrish 8bce0b34e6 Build docs before publishing on npm
Change-Id: Id79f8a68cbfbb2462fca24210447bb7fee83a68e
2018-03-29 10:31:48 -07:00
Joey Parrish b27ea82e7f Allow Player to attach/detach from video
This adds attach/detach methods to replace the media element in the
Player constructor.  Now applications can take back control of the
media element or provide a reference later in the Player's life cycle.

This also allows applications to decide whether or not to set up
MediaSource in advance, through an optional argument on attach and
unload.  The default will be to set up MediaSource in advance, which
maintains current behavior.  This advanced setup of MediaSource can
improve load latency later.

This change also introduces async/await for the first time in the
project, which required changes to eslint config, Closure build
arguments, Babel & Babel-polyfill setup, and the esprima parser used
by our extern generator.

The use of async/await will improve readability in many places, and
these infrastructure changes to enable async/await should also unblock
issues #1336 and #1337.

Closes #1087

Change-Id: I0d6b4e0e2af27a6520a3d070fa92b7139b2cb8b0
2018-03-06 22:19:53 +00:00
Joey Parrish 1f1c05fbc1 Upgrade promise-mock
The new release has a new parameter in runAll() which simplifies
flush().

At this point, we could technically do away with our flush() method
and call runAll(false) directly, but I find flush() more clearly
indicates to the reader what we are doing.

Change-Id: I90f105ff38d032e3c9caf5484d78824dc64fe43d
2018-03-01 18:41:52 +00:00
Joey Parrish 5061631f29 Sort jsdoc tutorials according to the config file
This feature is based on a forked version of jsdoc which we hope to
land https://github.com/jsdoc3/jsdoc/pull/1502 upstream.

Closes #1259

Change-Id: I48e07ffd8ae9fc2c07cd48b3e02b85e87694d341
2018-02-02 14:51:40 -08:00
Joey Parrish ed54199260 Upgrade and unfork jsdoc
This updates jsdoc to the latest version from npm and forks a copy of
the default jsdoc template.

In subsequent commits, we will reapply our customizations to the
template and to a jsdoc plugin.

This also fixes several bad annotations that the new jsdoc failed to
parse.

Issue #1259

Change-Id: I00a47270ea4754e1c96c43ca900d5cf889ab72e6
2018-01-31 22:04:48 +00:00
Joey Parrish 82357486a6 Replace buggy Promise polyfill
A bug in our Promise polyfill caused issues with the recently-added
AbortableOperation class on IE11.  Since external polyfills for this
are smaller, it is easier to remove ours in favor of a third-party
polyfill.  Applications that wish to support IE11 must now load this
additional polyfill.

We are using the "es6-promise-polyfill" module from npm, but any
compliant polyfill should suffice.

One feature our own polyfill offered was the ability to flush all
Promises, which allowed us to write synchronous unit tests that
simulated async processes.  To get this ability back, we are now
using the "promise-mock" module in our tests.

Getting "promise-mock" to load correctly involved switching from
"requirejs" to "cajon", which builds on requirejs and supports
AMD modules more directly.

Closes #1260

Change-Id: I5de48e88a910736ae5c1897a7a509bc5641acb70
2018-01-30 23:10:04 +00:00
Joey Parrish e298fb60fc Update muxjs to use new keepOriginalTimestamps option
Depended on issue videojs/mux.js#168

Issue #1194

Change-Id: Ia2ad5c17ad82a2c53215d34fbfec7be1d119df95
2018-01-18 20:18:09 +00:00