Commit Graph

21 Commits

Author SHA1 Message Date
Joey Parrish c9bd9a5dc9 fix: Correct license headers in demo app
Though not part of the library, this corrects/normalizes the license
headers in the demo app to be consistent with those in the library.

Issue #2638

Change-Id: I4546c4c6970d72ff71a37489fd582623bd6e2ca3
2020-06-09 16:07:06 -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 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 c5b20cc18f Simplify variable in load.js.
The "scripts" variable's contents are determined by the build type; so
instead of setting them at the same time, we can just use an object
lookup once when the variable is needed.

Change-Id: I84c52b5c770974d5c18b6546ecd9f8d19ce259e0
2019-08-21 22:00:04 +00:00
Jacob Trimble f3f427eb0b Disallow naming variables "async".
Fixes #1588

Change-Id: I2e1fc04a18d3f52e4fc46aa7b7b558989d5bced2
2019-06-10 21:56:19 +00:00
Joey Parrish 34585af993 Inline external CSS for quicker load
This reduces the number of resources we have to load by using LESS to
import them into the compiled CSS bundle.

This also gets rid of a flash of unstyled content in compiled mode by
always including the compiled CSS in HTML directly, regardless of
mode.  If the app is running in uncompiled mode, LESS is still loaded
and can override the compiled styles.

Change-Id: I8cde25c15c281029a129225fc85a8baee767f424
2019-05-09 19:05:17 +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
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 1ffac75d93 Disable uncompiled mode on browsers without async
Browsers new enough to have ES6 arrow functions, but too old to have
async/await, should not be allowed to use uncompiled mode in the demo
app.

This also fixes a bug in which the disabled "uncompiled" link was
still clickable.

This came up while poking at Firefox 48.  To be clear, this is NOT
a supported browser version anyway, due to apparent MediaSource bugs.

Change-Id: Ic055357e5149236722afae46d0652e51edaf90d0
2018-09-20 11:56:49 -07:00
Jacob Trimble d47ab5c98c Disallow use of 'var'.
This also fixes some usages of 'var' that didn't get caught by the
previous CLs.

Change-Id: I4ce53d62d24e53e121d7eced70590836c1d26523
2018-02-20 22:43:30 +00:00
Joey Parrish 3adbd40520 [ES6] Disallow uncompiled mode in non-ES6 browsers
As we convert Shaka Player to ES6, we will lose the ability to run the
demo app in uncompiled mode on older browsers, such as IE 11.

This detects ES6 syntax support and disables the link to uncompiled
mode in the demo app.  It also prevents the loader from choosing
uncompiled mode by default in these older browsers.

Issue #1157

Change-Id: I13e3a80669daaabd38a056f5242ee713f3d014cc
2018-01-05 20:10:42 +00:00
theodab 21475cf64d Fixed urls with query strings.
In a previous change, urls with query strings were broken such that
if one contained a /, it caused the demo page to fail to load.
Therefore, legacy custom URLs from before we added URL fragments which
contain asset or license URIs stopped working.
This change accounts for that.

Fixes: 71509895

Change-Id: I9e631a83fc7a551e841419dd4bec2885a2fd0a07
2018-01-03 10:04:45 -08:00
Jacob Trimble 117ed46bd5 Add links to switch between compiled and uncompiled
This also modifies the build scripts to produce debug builds of the
demo and the receiver when doing debug builds.

Change-Id: I386a7b8f541332594a5022955a69970ebbe79200
2017-10-17 17:26:37 +00:00
Joey Parrish 802a674c13 [PWA] Add a service worker
This adds a service worker, which will cache application resources to
make the application itself available offline in browsers which
support service workers.

Issue #876

Change-Id: I13096b2d4b9236d2a3f220af6b1dfce43d7a0004
2017-10-02 11:19:10 -07:00
Joey Parrish 958e1c68dd [PWA] Compile the demo app and cast receiver app
When using the compiled version of the library, use a compiled version
of the demo app, as well.  This makes use of the generated externs, so
we now have additional confidence that they are correctly generated.

Refactor the load.js script to use a configurable list of sources.
This enables us to use the same load.js in both the demo and cast
receiver.

This, ultimately, makes it easier to cache demo resources in our PWA.

Issue #876

Change-Id: I274660fe2ea23236ceea3c2d3c97572762d2f785
2017-10-02 11:19:10 -07:00
Jacob Trimble 1224464535 Use goog.DEBUG over COMPILED.
This allows including the extra assertions and logging in the debug
compiled library.

Change-Id: Ie8575a31b428e1985077939169bfae9254e395d5
2017-09-27 11:24:32 -07:00
Joey Parrish dbbbbd160f Clean up demo loader
The loader script for the demo uses document.write to add script tags.
This is not ideal, and currently generates these warnings in Chrome:

[Violation] Parser was blocked due to document.write(<script>)
[Violation] Avoid using document.write().

This replaces the import mechanism and hooks it into Closure library.

This also fixes uncompiled mode on Cobalt, which does not have
document.write.  (http://cobalt.foo/)

Fixes: 37246436

Change-Id: I4b8acf41edb314be359bca42d224112020c30709
2017-05-25 23:49:01 +00:00
Joey Parrish 96b802bdfd Fix compiled parameter in demo app
The demo app supports a "compiled" parameter to load the compiled
version of the library instead of the uncompiled (default).  Support
for this was briefly broken when we transitioned to using URL
fragments.

Change-Id: I84e5a481a18caf0e1e5a17e171a1b925848b9540
2017-04-18 18:22:56 +00:00
Jacob Trimble c105c4dff5 Use the release compiled version in the demo.
There are two versions of the compiled library: a debug version and a
release version.  A recent change altered the differences. Before, the
only difference was that the debug had the source mapping. Now the
debug version doesn't rename anything and exposes all internal members.

To get the source mapping, the demo used the debug version.  Now both
versions have the source map, so we should be using the release
version of the compiled library in the demo.

Change-Id: I33b4af6532e0eaf0749ffd8341d4f9d72a1ff0fa
2017-01-05 20:00:35 +00:00
Joey Parrish b8ccc02320 Fix support test on old browsers
- IE did not get forEach until IE 9, so it can't be used in
   polyfill.installAll().
 - Object.keys, console, and console.log.bind may all be unavailable
   on older browsers, so skip initialization of on-screen logging in
   the demo app if they are missing.  The support test will fail
   anyway.
 - 'catch' is a reserved word on older browsers, so use the two-arg
   version of then() to catch promise failures.

With these fixes, the support test can again be used on old browsers,
and the compiled-mode demo app can report an error back to IE 6.

Change-Id: I3019468f24a510a265ad5b13df4f01cd1bb1f34d
2016-04-07 20:51:24 +00:00
Joey Parrish bda33cc9b6 Demo app v2
Still missing custom controls for live, but otherwise functional.

UI design and CSS based on work by Sam Dutton.

Change-Id: I0ee41254fb3b145822b018dff87aa583d6bef179
2016-03-30 00:36:32 +00:00