Commit Graph

24 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 d60cb13c47 fix(ui): Apply upstream styles for icons font
When we changed the font for the icons without changing the class
name, we lost upstream styles from the font server.  This was not
obvious in our demo, but was more obvious in other apps where the font
size was different.

By using the same class name as used by the font server, we get those
upstream styles applied correctly.

Issue #2633

Change-Id: I615c1dfd86e5b9802d03050c5db0154ac196c2ef
2020-06-09 19:16:23 +00:00
Joey Parrish 07335d79f6 Fix missing or bad type info
In many places, the implicit type info was insufficient.  For example,
document.createElement returns Element, but the actual return is
always a subclass of Element.  In many cases, we need the compiler to
know that a specific subclass is in use, so that it can correctly
check our use of subclass-specific properties.  Another common pattern
is confusion between Node and Element (which is a subclass of Node).

Almost all of the changes in the demo and UI are Element-related.

In some places, we referred to HTMLMediaElement, used in the Player
API, instead of the more specific HTMLVideoElement in use in our demo.
Since the demo uses video-specific properties, we must use the more
specific type.

Another case is the use of document.createEvent, which returns Event
according to the compiler, but in reality always returns a subclass,
like CustomEvent.

In one case in NetworkingEngine, correcting the type of an
AbortableOperation led to the discovery that we had been incorrectly
accessing a private method of that type.

In goog.Uri, there were several instances of "*" for a type, which the
newer compiler won't accept.  These have all been corrected.

Finally, in some places, we had the wrong nullability on a type.

These were all caught by a compiler upgrade.

Issue #2528

Change-Id: I7f2d070e3da32fe9ff5f444315649f3cbdb5a4a5
2020-04-28 16:51:20 -07:00
Theodore Abshire a8927828e8 Add search filters to the URL.
Closes #2422

Change-Id: I567ad6b0368badcf1e8e2535a640adc650f4daea
2020-03-12 12:03:09 -07:00
Álvaro Velad Galván 111ba958e6 Add set custom asset with Ad Tag URL (#2393) 2020-02-20 11:13:34 -08:00
Theodore Abshire 5cd3bebd5c Support re-loading page when locale changes.
Change-Id: I8c9a8801be445f62c292e049018fecf11ccc820c
2019-11-22 23:42:07 +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
Theodore Abshire 4c6325de08 Added localization system to demo.
No localizations exist currently, but this adds the framework for them.

Change-Id: I81a8cab128884753c765a192181d5d88f0ed13f1
2019-11-18 19:41:58 +00:00
Theodore Abshire 83ed3559c1 Moved the config field checks into actual tests.
Also added a cleanup procedure for the demo, for use in tests.

Change-Id: Ic26a8c7b012e66cdd88c09eb8d478ceeb6743ab4
2019-09-11 22:11:09 +00:00
Jacob Trimble 7764ff609f Don't put space before '=' in arg comment.
This standardizes how we handle the spacing in argument comments.  The
other way is much more common, so we standardized on that.  This add a
new linter rule to catch and automatically fix those issues.

Change-Id: I8ea54c47ae4d34cf8e1646e56c6ed8142b42afbe
2019-09-06 13:49:10 -07:00
Theodore Abshire fa0445679d Added a confirm dialog for deleting custom assets.
Change-Id: I81df896797262f2fc38019714c4dc289134cc413
2019-08-27 20:28:08 +00:00
Theodore Abshire edc77647ea Made shakaDemo namespace for demo.
Change-Id: I53508d808f9b1d868f4c797095dcc9829cac7871
2019-06-28 10:50:19 -07:00
Theodore Abshire 9ce78fe388 Convert demo to goog.require and goog.provide.
Previously, in uncompiled mode, we were loading Shaka Player using
goog.require calls, but loading the demo code directly. This meant that
the demo code was loaded before the Shaka Player, code, which lead to
issues if something needed the "shaka" namespace to exist during
load-time; for example, if a demo class wanted to extend a Shaka class.
This adds goog.provide calls to the demo, so that it can be loaded with
goog.require also while in uncompiled mode.

Change-Id: If6cc92db0ce05dd9c3f298e9bd1a5119452ad8a4
2019-06-27 22:02:36 +00:00
Sandra Lokshina dbb774fa9f Convert ui utils to ES6 and merge duplicate utils.
Both DOM and UI utils had a removeAllChildren method
that did the same thing. This change removes it from
the UI util and replaces all calls to it with calls
to the DOM util.

Issue #1157.

Change-Id: Iaf7998c460c03416d8651e2efd53c96bdcc9a258
2019-05-20 11:08:22 -07:00
Theodore Abshire 75b561444c Move download buttons to corner.
Instead of the download button being a button called "Download" or
"Delete", this moves it to the upper-right corner and made it into an
MDL icon instead of text. That way, there's no confusion between
removing a custom asset from storage and removing a custom asset from
the assets list.

Change-Id: I74d426bc9e9030598b741afc58a3ba7d6cec4c4a
2019-05-15 18:02:18 +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
Joey Parrish 05e0b80db2 Defer creating contents until shown
Each of the three pages in the demo app displays asset cards.  In some
cases, these can take a long time (hundreds to thousands of
milliseconds) to create the DOM elements and load the images.  To
improve startup performance for the app, defer creating the contents
of any given page until the page is shown.

This improves the demo's performance score in Lighthouse from 54 to
82, the "First Contentful Paint" score by 43%, and the "First
Meaningful Paint" score by 10%.

This incidentally fixes a race condition between the asset setup and
calculation of the platform's capabilities, so that the buttons are
always in the correct state on startup.

Change-Id: I73a70dec89e13cc16566dde7ef8659b3e1c64b17
2019-05-13 09:54:04 -07:00
Theodore Abshire 7d9625dbac Made name field for custom assets more permissive.
Now, it allows for any characters, not just alphanumeric.

Change-Id: Ia9a43f00efd4bdf61c62f931792343c58ce1e944
2019-05-10 20:56:20 +00:00
Theodore Abshire 4583402735 Re-load current asset if page reloads.
This changes the demo to store the currently-playing asset inside
the hash, and reload that asset if it's in the hash parameters at
page load time.

Change-Id: I6cce6ad8cfd9e941965446ee027435d47b9f479f
2019-05-08 12:13:55 -07:00
Theodore Abshire 0ddff4f7ea Add support for multiple concurrent downloads.
At the moment, the storage manager does not support multiple concurrent
downloads. This modifies the demo to create a new storage instance every
time a storage operation is desired, then dispose of that instance after
the operation is complete.
This also refactors out the shaka-main-offline-changed event, which was
no longer necessary after allowing asset cards to re-load their buttons.

Issue #1432

Change-Id: I1312cf74a92f877279adb461e423a38e93bcfa0f
2019-05-07 16:31:15 -07:00
Theodore Abshire 3d83f409fa Enabled storage of custom assets.
Change-Id: Ibc8223628f03e3b09571725375616ada94b277d4
2019-05-07 17:21:07 +00:00
Theodore Abshire 5eebd021d2 Allow asset cards to re-load only buttons.
Change-Id: I47bca9eb70e0933b132544c851e79328f1ccaa04
2019-05-06 22:39:19 +00:00
Joey Parrish 269b53b7a0 Improve lighthouse score
- Use a minified mux.js and awesomplete.js
 - Add rel=noopener to offsite target=_blank links for security
 - Improve contrast on selected nav button and footer text
 - Add empty alt attributes to asset images, since these are
   not necessary to understand the page

Change-Id: I253c7354243aaa0fe98e1f075dae304ddad4a3e2
2019-05-01 17:25:45 -07: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