Commit Graph

133 Commits

Author SHA1 Message Date
Sandra Lokshina a4a2ef5a7c Make the demo close button implement shaka.ui.Element
Issue #2011

Change-Id: I51c828b0457133ccee4b3f3ff2e1a33da8b3a34c
2019-06-28 09:42:11 -07:00
Sandra Lokshina 24f5a29501 Export protected memebers of shaka.ui.Element
This enables custom buttons that aren't part of the
library to be used in compiled mode.

Closes #2011

Change-Id: I500f93a86bfd2893948e594a969b6f8208836251
2019-06-25 22:07:34 +00:00
Jacob Trimble 52522c7dca Fix cases where errors weren't propagated.
This propagates errors in several places and fixes waiting for some
async calls.

Change-Id: Idf4519b473538c1fa00bfe63e634194610ba29f2
2019-06-19 20:35:30 +00:00
Jacob Trimble 3da809019b Enable additional ES6 linter rules.
Change-Id: I6861541b27153ba034364a5972a9b086de581cef
2019-06-11 18:35:09 +00:00
Jacob Trimble 98aa050de9 Fix addEventListener on some platforms.
Some platforms (e.g. IE11 and Tizen) don't support passing an object as
the third argument to addEventListener.  When we do, it interprets it
as a "true" for the capture value and causes the listener to be called
at the wrong time.  This now detects whether the browser supports this
and calls the boolean version if not.

Fixes #1979

Change-Id: I05b3f5e536a9bcb5c275cac7f243a9ccc88f8149
2019-06-07 16:46:57 +00:00
Michelle Zhuo f67df3d7ad Use eventManager.listen() instead of addEventListener in UI
Issue #1924

Change-Id: I9870d4002fd5f0f99b5de164de41b107af1b3d9b
2019-06-05 16:25:26 -07:00
Joey Parrish 6aa35d1433 Fix text display styles
Changes to text styles:
 - Default to 20px instead of 18px
 - Default to a black background (issue #1955)
 - Fix the line height (otherwise set in px by MDL in the demo app)
 - Scale font with the window in fullscreen or cast receiver

Fixes #1955

Change-Id: I98da85030f4b5a40ba1be962b3d1b4fc2c34489e
2019-06-05 20:08:08 +00:00
Joey Parrish 8c8d437038 Minor UI cleanup
This inlines a method and replaces some redundant calls.

Change-Id: If1e7dc29ada3293445ffe156c1bdfb35beb007e0
2019-06-05 18:00:29 +00:00
Sandra Lokshina e1fc168d4a Fix unclickable controls on the bottom panel.
Position control buttons panel in front of other controls.

Change-Id: Ic71505ba6e4590387512dc334e64fab601bf74a0
2019-06-04 22:40:59 +00:00
Joey Parrish b6d3455a3c Drop misplaced @private annotation in UI
Change-Id: I7e53162f1365ad93e1eddcbdd6db0e082cbbec49
2019-06-04 11:00:09 -07:00
Sandra Lokshina 3e3e940e34 Add a temporary fix to enable casting.
Issue #1948

Change-Id: Id3953cdc32f1cdd02729c1a3f08c522b2ee376f1
2019-06-03 21:05:36 +00:00
Joey Parrish c1ae34383a Fix style errors in TextDisplayer
Style properties like width, height, and paddingTop should be set on
the style object, not the element directly.  Further, "float" is the
wrong name for the css float property in JavaScript.  This should be
"cssFloat".

These bugs were caught by a newer compiler.

Issue #1852

Change-Id: I80e8b98a7b693b2b6bb0c52ff9f4a0611e3ea106
2019-06-03 18:41:04 +00:00
Sandra Lokshina 382d16bcd7 Show spinner when buffering even if other controls are hidden.
Fixes #1921

Change-Id: If7cfac07e09893b3f087c033bd3bb2d7f66dc463
2019-06-03 18:31:08 +00:00
Michelle Zhuo 76ba685c89 Add comments in control.js
Change-Id: I4c59045c4aa62841fd09f96969298d51a06d586e
2019-05-30 22:33:08 +00:00
Sandra Lokshina 5723324925 Don't recreate controls object on configure() calls.
Issue #1948

Change-Id: I86a10c61d704688b2830e7f08b894a98faaf68e7
2019-05-30 21:45:32 +00:00
Theodore Abshire f584c9aab6 Convert remaining polyfills to ES6.
Issue #1157

Change-Id: Ie330cd870ccf14dc3f56987b2787970b46b1ac89
2019-05-29 23:39:08 +00:00
Jacob Trimble b4c1be72f3 Fix some missing ES6 conversions in UI.
Issue #1157

Change-Id: Ied0d37222680f4aa88638e7510b7a0e07844aa69
2019-05-21 21:02:00 +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
Sandra Lokshina d23e4a6b38 Convert ui.js and controls.js to ES6
Issue #1157.

Change-Id: Ica807387c652e7e7f0986ea3be7145a089c4c3cd
2019-05-17 17:26:59 +00:00
Joey Parrish e54f729a04 Deprecate ui.getPlayer for controls.getPlayer
The controls have the cast proxy and the proxied player, so the UI
itself offering direct access to the local player is confusing.
Instead, we will send all requests through the controls, which have
explicit getPlayer() and getLocalPlayer() methods for access to the
proxied and local players.

Closes #1941

Change-Id: I1d6154d76b1b3b5b550e55e39efcbb2c451f7569
2019-05-16 18:30:16 +00:00
Germain a9b24b8d64 Improve french translations (#1944) 2019-05-15 14:18:50 -07:00
Alan Huang 00c25ff8d2 Change instance attribute to local variable.
backToOverflowMenuButtons_ is only used in the constructor immediately
after it is set.

Change-Id: I7a320711eb604c70e69a84737ee7c26f6b2e8271
2019-05-15 14:35:21 -04:00
Jacob Trimble d5780d401b Fix line length issues for indent fix.
Change-Id: I87d75fd88000f8f9bff7b9f1bf5667ba28f6dd60
2019-05-13 22:31: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 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
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
Joey Parrish 58cedb0367 Add @license to all LESS and CSS files
Change-Id: Ibefe715afcb3676d5a2694032b9c99fe98dd2c44
2019-05-10 17:26:14 +00:00
Jacob Trimble 381274fbbd Enforce a consistent dot location.
Change-Id: Ic3b86c4c113023206bc37a117e96f672f351121b
2019-05-09 21:09:30 +00:00
Jacob Trimble a0122c8805 Fix error with UI TextDisplayer.
An automated change converted a "function" function to an arrow
function.  But arrow functions can't be used with "new", so it broke
the UI's TextDisplayer.  This changes it back to a "function" function.

Change-Id: Ic34cb43cc9b728b0a8420ac6b0ce6d7d5d0bbcd0
2019-05-09 21:09:16 +00:00
Joey Parrish 46bb04a95e Fix API-based UI setup with default config
Without this change, an app using API-based UI setup won't have any
controls displayed until the call configure().  This didn't affect
declarative setup in HTML or our demo app, but an app should not be
required to call configure() at all if they want to use default
settings.

Change-Id: Ibeef86ccc471e1d04d79fd5af96c7d495ef8203c
2019-05-09 20:05:21 +00:00
Joey Parrish ab6f9cfd3d Allow short-form config for UI and offline
With this change, offline and UI config can use the same two-argument
short form that the Player config interface offers.

Change-Id: I5f40ef58da76f3aab1d7178fe7d6e82097352b9a
2019-05-09 19:34:01 +00:00
Joey Parrish ffb07d71a8 Add missing export on ui.Overlay.getConfiguration
Change-Id: Ief41e49999858164207dff9498afff2636dcecab
2019-05-09 19:30:30 +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
Jacob Trimble 47daf49f31 Use arrow functions for callbacks.
This is an automated change to convert use of "function" functions
to arrow functions.  This doesn't change all uses of bind() that
could be converted.  This also doesn't remove all "function" functions.

Change-Id: I40ac7d086bcef947a1be083359c8fd1d4499a9c3
2019-05-09 16:40:46 +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
Joey Parrish 683d17f57e Hide volume button on mobile
Fixes b/131924038

Change-Id: I4c86cb14c240c8e795e18fdf54e8bee11a3cec61
2019-05-07 22:28:56 +00:00
Theodore Abshire d6706cc174 Made PiP and fullscreen mutually exclusive
Fixes b/131837672

Change-Id: Ic4760a695c5a8cfe3f3c044a4958d2060f3a0846
2019-05-07 18:02:16 +00:00
Joey Parrish f39bade337 Add play/pause button in controls
This is different from the giant play/pause button that sits over the
video container.

Change-Id: I4629b3a64a5208f23c65b383f4fb992e6ddfd334
2019-05-07 17:57:59 +00:00
Joey Parrish 91a848cb05 Fix UI integration tests
Fix missing await.  These tests were not behaving correctly, in part
because they were running async processes synchronously.

Re-evaluate tracks.  Some of the failures in these tests were because
the Track objects were not re-evaluated after the tracks changed.  The
Player does not modify these object in-place, but generates new ones
when the track API is called.

Re-evaluate buttons. These buttons are remade when state changes, so
they need to be re-evaluated.  Before, we were recreating the map, but
still using old references that were no longer in the DOM.

Turn captions on before turning them off in UI test.  Otherwise, the
test assumptions are invalid.

Add missing caption event in UI.  The UI tests use this event, but it
was only dispatched on track changes, not visibility state changes.

Make sure text is being streamed so API change does something.

Use correct track API in each test.  Before, selectAudioLanguage was
used in text language tests.

Fixes b/131909906

Change-Id: Id58495da8f99e3c6f35c09d2d5762c99aaba30d1
2019-05-07 01:23:15 +00:00
Sandra Lokshina 65768a3d41 Hide fullscreen button on platforms that don't support it.
Safari on iOS does not support HTML5 fullscreen API. There
seems to be a (separate) way for a video element to enter
fullscreen mode. I will see if we can adopt it in a different CL.
For now, just hide the button if fullscreen API is not supported.

Issue #1909
Issue b/131923216
Change-Id: Ia30660c7a68fd626051fdf5abce59dbe993b2de2
2019-05-06 22:25:41 +00:00
Joey Parrish e5620f3891 Thoroughly wipe out references in UI destroy
There are some cases in testing where held references cause issues,
such as video elements lingering between tests on Tizen.  This does a
better job of clearing out resources in destroy() methods in the UI.

Change-Id: Ib1434ed11561216cd41ec247535ea7b32c1154d1
2019-05-06 16:13:39 +00:00
Joey Parrish 62c8762fdd Destroy UI child elements in controls.destroy
The IUIElement interface include destroy(), so we should make sure to
call it.

Change-Id: I91b9f2cc7b94ba8659e9fe65a2fe7df4da9ddfa2
2019-05-03 20:45:33 +00:00
Joey Parrish 9d1861599d Fix test failures on IE 11 and Tizen
In these two environments, we must convert ES6 code to ES5.  Rather
than work around specific cases, we should let babel convert all test
code into ES5.

This fixes new problems on IE and Tizen introduced with the new demo,
and reverses some work-arounds that were used before.

Change-Id: I6be5ed2cd271e88bc7ebc1e878acbec6bbc21a2e
2019-05-03 17:11:40 +00:00
Joey Parrish 6a1cbc5814 Fix text displayer positioning on IE
Before, the text displayer on IE was positioned outside of the video
container, to the right.  On IE, the left property was defaulting to
something surprising.  The simple fix is to specify left: 0.

Change-Id: Iaf5456c4976afbe59853b32b978e63aac5df2571
2019-05-03 17:11:01 +00:00
Theodore Abshire 6bfb35fc69 Use declarative ui setup in demo.
Also adds a getConfiguration method to the ui, so that the demo does
not need to construct a config object from scratch.

Change-Id: Ic583fbcc0815494c7668242f6c798b8c15f09697
2019-05-01 20:53:47 +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 9e11920e95 Fix UI test failure on IE
The nightly tests caught a problem on IE where classList was used with
an SVG element.  This fixes the problem and adds an assertion that
would catch future regressions even on Chrome, where classList is
available on SVG.

Issue #1674

Change-Id: Ie4200db6989b3d5dd429e6b730069bd060ece0cd
2019-05-01 17:43:49 +00:00
Joey Parrish 56a48ec9b9 Fix resolution menu restoration
If the resolution menu sees audio-only content, it should be hidden.
But it should come back as soon as the audio-video content is seen.

This came up during work on #997 and #382

Change-Id: I3297847c905c867bcdd14cf7e525a408890a273a
2019-04-30 12:03:29 -07:00
Sandra Lokshina 7a15c1e94f UI: Dynamic layout construction.
Fixes #1674

Change-Id: I338917bbd43a6ddc837388fdc8beea9e3f7b0778
2019-04-29 21:17:39 +00:00
Joey Parrish 87694d0027 Rename errorDetails to detail to UI events
This follows an existing convention in Player error events of using
the standard "detail" member of Event objects.

Change-Id: I26d0fb73e18ad38ec7d231c8560c13da420b2b88
2019-04-29 20:44:22 +00:00