Commit Graph

58 Commits

Author SHA1 Message Date
Theodore Abshire aa9fe1d049 fix(demo): Fix behavior when UI fails to load
This modifies the demo to load localizations even when the UI fails
to load, so that the footer links will still be visible.
This also makes the footer links work in that situation, and modifies
the shaka-ui-load-failed event to return a failure reason code, so
that we can display a contextual error message in event of a failure.

Closes #2669

Change-Id: I0cf38f7e39558f1977eee490131378c32105437f
2020-06-23 23:29:37 +00:00
Theodore Abshire 6694d3c13e feat(UI): Add forceLandscapeOnFullscreen UI config
This is a UI configuration that forces the device to orient to
landscape mode when the video goes fullscreen.
It may or may not work on all platforms, due to being based on an
experimental browser API.
It is true by default.

Issue #883
Closes #2653

Change-Id: I947bfb84e77f65b38bcf8a1572d70a04a3073ba0
2020-06-16 21:22:48 +00: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 09ea6e6526 Make UI immune to extra destroy() calls
Change-Id: Icb46e1a837187c2d1b7e5832fab0c07433163eb8
2020-05-21 16:19:29 +00:00
michellezhuo 562168a1f6 Set UITextDisplayer as TextDisplayFactory in default config
In player, SimpleTextDisplayer was set as the default TextDisplayer. In
our UI, it changes the configuration to use the UITextDisplayer, and
UITextDisplayer gets constructed with the player. Later in our demo, it
resets the config, so an extra SimpleTextDisplayer gets constructed.
This introduces an extra TextTrack created by SimpleTextDisplayer.

This change sets the UITextDisplayer as the default TextDisplayer in
player's default config.

Closes #2516

Change-Id: I3f653be9fad8b2edbc2fb9de84e8abb327dcfc51
2020-05-04 20:40:18 -07:00
Joey Parrish 11f3347a48 Fix static method aliases
We used to alias static utility methods by assigning the method itself
to a local variable.  This is not allowed by the new Closure Compiler
release that we are adopting, and for good reason.

The old compiler did not understand the use of "this" in static
methods, but the new one does.  And it turns out that when we start
using "this" in static methods (see #2532), aliasing the method itself
can break everything.

When you refer to "this" in a static method, it refers to the class.
This is really useful in utility classes that have private static
methods they use to perform common tasks.  However, just as it ruins
the value of "this" to alias an instance method, the same is true of
an ES6 class's static method.

The fix is to always alias the class instead of the method.  The new
compiler will simply not let us get away with the old way any more, so
regressions after this are unlikely.

Issue #2528 (compiler upgrade)
Issue #2532 (static "this")

Change-Id: Id800d466e639c7cbcf4aa6fbb05114c772a2229f
2020-04-30 19:28:53 +00:00
michellezhuo 002c52c2c1 Add configuration to enable/disable fullscreen-on-rotate
Closes #2494

Change-Id: If66521593d80dd7ddb983c320ebd9c35343f6594
2020-04-11 22:31:00 +00:00
michellezhuo 6d171f7d5a Add configuration to enable keyboard playback controls
When set the configuration to true, using keyboard to control playback
will be enabled, such as seek forward/backward, jump to the
beginning/end, play/pause by press the space key, etc.

Closes #2489

Change-Id: I0e46bd5853d47855aae6e6dedcc7de8798bf4298
2020-04-10 23:56:06 +00:00
Theodore Abshire d1dce29e89 Added 'doubleClickForFullscreen' config to UI.
This configuration, which is true by default, lets a user optionally
disable the "go fullscreen on double-click" functionality.
This allows a developer to fully disable fullscreen mode, if they so
wish, or to retain the fullscreen button but disable other methods of
entering fullscreen.

Issue #2459

Change-Id: I196602fc9843e0fd799c78703de60f864e906841
2020-03-16 17:03:53 +00:00
Sandra Lokshina 3a18f1c087 Add ad markers to the seek bar.
Issue #2367.

Change-Id: I6757ac2195b06a205d298082ea7b3d8e3fcc6d8e
2020-03-02 19:44:14 +00:00
Joey Parrish fabf820ac7 Add config to show an unbuffered at seek bar start
If set, this new config field will show any unbuffered region at the
start of the seek bar.  This matches the v2.5 default behavior.  If
unset (the v2.6 default), this will paint any unbuffered region at the
start of the seek bar as simply "played" content (matching Chrome's
native seek bar).

Closes #2424

Change-Id: I528169982ce493b0dbf5a8a1bb46e9e096f422d6
2020-02-25 15:20:30 -08:00
Jacob Trimble c49f24b31b Remove remaining deprecated features for v2.6.
Change-Id: I2199e3c960fe6319eb9ab342291dfd9a62d9090e
2020-02-24 15:57:05 -08:00
Jacob Trimble 3f63021a2f Avoid using "new" with factories.
Instead of having the "factories" use "new" to construct them, now they
will be plain functions.

Closes #1521

Change-Id: Ia6151ad679a78a5c6db128d43094c82add0af348
2020-02-19 09:57:51 -08:00
michellezhuo cfe1f89171 Add playback speed selection to UI
Closes #2362
Closes #1676

Change-Id: I10184dccab301be7382940e35e36d66dc7a5e2ad
2020-02-12 20:24:03 +00:00
Joey Parrish 4a7aee1daf Customize default UI config for desktop/mobile
To match Chrome native controls, the default controls for desktop will
now contain the small play/pause button, but default controls for
mobile will now contain the large play/pause button.  Mobile controls
will also not contain the volume button.

This removes several CSS-based versions of these things in preference
for configuration.

Apps can still override the defaults, no matter the platform.  Apps
can also make their own mobile-based config choices in JS by checking
video.ui.isMobile() or change styles in CSS using ".shaka-mobile".

Change-Id: I4fb8391f7f3727c7086cd3bca2b1d5c93bd9e856
2020-01-18 23:24:33 +00:00
Joey Parrish 400d5a9faf Add "fadeDelay" option to delay fading UI controls
This option will be used in our cast receiver to delay fading the
controls for a few seconds when playback begins.

Change-Id: Ia44c2eb6cd4fc9c40f07b0336556a87762f2ee14
2020-01-14 10:42:36 -08:00
Joey Parrish 361e39eaa6 Revert recent cast changes
This reverts commits:
 - a43f52caf3
   "Add "noFade" configuration to UI."
 - 08a36e886f
   "Add transparency transition cast app controls."
 - a6b159ffcf
   "Keep controls visible while casting."

Moving the showing/hiding up to the receiver app level can waste CPU
on low-end devices, and puts undue configuration burden on the
receiver app.

We will follow up with a more direct fix for #2314, as well as a
"fadeDelay" option to allow the cast receiver UI to delay fading for a
few seconds.

Related to issue #2314

Change-Id: I0028803432ad028930002b29dd7b94c7d9a0ec56
2020-01-14 03:04:45 +00:00
Theodore Abshire a43f52caf3 Add "noFade" configuration to UI.
This allows users to tell the UI to stay visible at all times, even if
there are no mouse events.
This is necessary on ChromeCast, where there is no mouse, or touch
controls, or anything; without this setting, the controls just stay
transparent all the time.

Change-Id: Ie74c689f9bee9f07ffcb68dbacfd7bfe3ad066de
2020-01-10 23:43:37 +00:00
Jacob Trimble 011749e95f Standardize argument comments.
This changes the eslint rule to enforce a strict pattern for the
argument comments.  The comment must appear before the argument and
must be /* foo= */.  This still ignores line comments.

Change-Id: I3afb01c65e1088eda13facb3aeeaa7595a2f5aee
2020-01-06 19:40:52 +00:00
Theodore Abshire 9aaedede95 Change UI to show text/audio roles.
Closes #2307

Change-Id: I13ce5d6185f27a4bfa7481eff4fef629520ff0ce
2019-12-20 22:35:03 +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
Joey Parrish bc1c3fd012 Make seek & volume bar colors configurable
The seek bar and volume bar are both styled with CSS linear gradients
which are constructed at runtime using the player & video state.  This
makes their styles impossible to tweak in pure CSS.  Before this
change, to maintain the same gradient with different colors, an
application would have to replicate our JS logic.

Now, the application can configure the colors without replicating the
logic used to construct the gradient.

Fixes #2203

Change-Id: I22e62de6c436241e141c76557ebf950cfc8b3ff5
2019-10-22 08:31:01 +00:00
Sandra Lokshina 7afac89bc2 Restructure AdManager to be owned by Player, not UI.
This will allow Ad functionality to be available for apps
with custom UI.

Change-Id: I3911cb6d764b7aef94166b5f6de3a0a7fa8bb8d9
2019-10-18 18:42:13 +00:00
Sandra Lokshina c2105a362b Lay the ground for the Ad Insertion work.
This CL does:
- define CS IMA externs
- define Ad Insertion classes and sctructures
- add a (non-working) skeleton for the Ad UI
- provide a (working) early draft of the CS implementation

This CL does not:
- add any SS logic
- have a working ad UI
- provide a final and complete implementation for the CS logic
- fully follow the finalized Ad Insertion design

Change-Id: I645cdcb3a1d4041792b940c2d6faf011be5eb682
2019-10-03 20:01:38 +00:00
Joey Parrish 7a09cb1082 Make API-based UI setup consistent with DOM-based
By moving the contents of createUI_ (called by the DOM-based
declarative setup code) to the end of the Overlay constructor, the
API-based setup is now consistent in behavior with the DOM-based
setup.

Both methods now correctly handle defaults for text displayer configs
and attachment of the UI itself to the DOM.

This was caught while giving API-based setup instructions in #2159.

Change-Id: Iedac655559cdf5a2fdc8a748e7f99fa3305bbcdc
2019-09-26 17:54:09 +00:00
Sandra Lokshina 827e5d813f Support setting source through HTML
Issue #2088.

Change-Id: Ib0ee45e4b5e6b0f6bcdd8b76f26ddd0cfa972a03
2019-08-28 18:34:51 +00:00
Sandra Lokshina 05cb3cf2e8 Add clearBufferOnQualityChange field to UI config.
Resolutions menu calls player.selectVariantTrack() when
a user selects a resolution. SelectVariant track has a
clearBuffer argument that we used to always set to true.
However, an app may want it to be false. This change
makes this behavior configurable.

Closes #1733.

Change-Id: I6a0dbcca99a8322d68abd0151afd66af31530856
2019-08-16 21:33:16 +00:00
Sandra Lokshina a7716632d2 Don't create a UI if the app already has one.
If an app uses the shaka.ui.Overlay constructor to create
a UI before our auto-detection code runs, they end up with
two UIs one on top of the other.

I personally think anyone should be grateful to get an
extra UI or two, but people complain for some reason.

Closes #2073.

Change-Id: I793b5a7d8b5092a9b65426f5994019fde75bf957
2019-08-01 23:15:44 +00:00
Sandra Lokshina 635acb6ecf Extract the big play button into its own class & make it optional.
Change-Id: I462632c3da5f8ff5a68e111940591086bb395a13
2019-07-25 22:06:37 +00:00
Jacob Trimble 3da809019b Enable additional ES6 linter rules.
Change-Id: I6861541b27153ba034364a5972a9b086de581cef
2019-06-11 18:35:09 +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
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
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 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
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
Joey Parrish 683d17f57e Hide volume button on mobile
Fixes b/131924038

Change-Id: I4c86cb14c240c8e795e18fdf54e8bee11a3cec61
2019-05-07 22:28:56 +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
Sandra Lokshina 7a15c1e94f UI: Dynamic layout construction.
Fixes #1674

Change-Id: I338917bbd43a6ddc837388fdc8beea9e3f7b0778
2019-04-29 21:17:39 +00:00
Joey Parrish 4343e954aa Fix UI unit test cleanup
The UI unit tests were leaving players undestroyed, which caused
additional failures on Tizen in the src= tests.  This makes some
changes to the UI to allow discovery of the UI through the DOM, which
in turn enables automated (and thorough) cleanup of the UI in our
tests.

b/130554111

Change-Id: I8bfef07f670ce7ec5deafaf19314d7bfd2eb6eed
2019-04-17 21:28:24 +00:00
Joey Parrish c3afb84209 Allow demo to play video inline on iOS
Without this attribute, iOS playbacks will force fullscreen mode.

Issue #997

Change-Id: I32bbe3d16f68d91c5fb3083c5d5862967140d140
2019-04-15 16:02:48 -07:00
Joey Parrish 4334f1956b Allow UI-using apps to show support errors
By dispatching the shaka-ui-loaded event when we give up because of
browser support, apps can still finish their own setup and show an
appropriate support error.

This bug was discovered while working on #1857

Change-Id: If584ba916f7ba2e807f4861638d66319e8c8638f
2019-04-11 14:48:02 -07:00
Sandra Lokshina 4d41b7b90c Refactor the overflow menu to use components design.
Closes #1673.

Change-Id: I030745def928796a6abc813a91fb163cb2d76175
2019-02-21 13:14:28 -08:00
Aaron Vaage df3926916e Correct Factory-Constructor Syntax
Right now because the text displayer factory must be a constructor
and () => {} can't be a constructor, we need to change function-syntax
used in ui/ui.js.

Change-Id: Ib87b9353c5a955a3556949ed754314b1bee16dad
2019-02-21 01:54:24 +00:00