Commit Graph

107 Commits

Author SHA1 Message Date
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
Sandra Lokshina cda30283d2 Fix: fix UI not showing up for server side ad streams.
Apparently, IMA SDK adds their ad UI differently on SS vs
CS ad streams. The solution we devised for CS ad experience
that combined our UI with the IMA's native ad UI turned out
not to work for the SS experience - our UI was being obstructed
by the IMA's UI.
This change adds a new container for the SS IMA UI that allows
our own UI to stay visible.

Issue #2592.

Change-Id: Iedb24beeb8d6f777b1fd7f4155c591350432ec78
2020-06-12 16:55:33 +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 5d2dc2daaf Update deprecation timelines (v3.1 => v4.0)
Since we are getting strict about semantic versioning, we can't remove
features in v3.1.  Any backward compatibility we offer will be
maintained until v4.0.

The exception is explicit IE 11 support, which will still be removed
in v3.1.

To help us follow the rules for removal, the Deprecate utility no
longer accepts a minor version argument.

Change-Id: I4dd94a6084e4ed72eeec410eb9aa0ad974d8dac8
2020-06-01 15:57:31 -07:00
Joey Parrish aba5e2583c Rename v2.6 to v3.0 and v2.7 to v3.1
We have decided to bump the major version number instead of the minor
number, based primarily on the fact that this release breaks
compatibility with our previous manifest structure.

Change-Id: I67e4c8267c6e103cfc7278e09daac186ae5cbbc6
2020-05-29 17:50:22 +00:00
Sandra Lokshina 43b9567b5b Propagate UI locale changes to ad manager.
Change-Id: I4de1a8a5d16c9b2d8efb71eb94df70ae73fc0c3f
2020-05-26 15:29:10 +00:00
Joey Parrish 4592a090ae Remove controls container when destroying the UI
Removing the controls container when destroying the UI restores the
DOM back to its pre-constructor state after destroy() is complete.
This allows the video container to be reused.

This became an issue while developing screenshot-based layout tests.

Change-Id: I5aa74e9ef443037ad84ac6c8acf7d09f657d6b5e
2020-05-21 16:19:54 +00:00
Joey Parrish 6e95843d09 Rename skim to scrim
We might have misunderstood something the UX team said early on in our
UI efforts, but this element that partially obscures the background is
called a "scrim", not a "skim".

See https://travishorn.com/responsive-scrim-6f286da5b6a5

Change-Id: I483eb38deb9d98b9fc22b45772992029d43a4b65
2020-05-21 16:19:39 +00:00
Joey Parrish 7c189a5b39 Add backward compatibility for IUIElement release
We changed IUIElement from IDestroyable to IReleasable since v2.5.x,
so this adds compatibility for the v2.6 release to avoid breaking
existing UI element plugins apps may have.

Change-Id: I38e90cda80048669834bbc8e5ad5650c3df32f10
2020-05-01 21:06:29 -07:00
Joey Parrish a955d9f189 Fix UI keyboard Event types
The latest Closure Compiler is more picky about Event types, and
complained about the use of "key" on Event.  This updates the Event
types so that the compiler has the correct type info.

This also stops using "keyCode", which is deprecated, and only uses
the current "key" property, which is even supported on IE, and should
not create any compatibility issues.

Issue #2528

Change-Id: Ic565772b1cc9597e358df015a73c40ac245edd6a
2020-04-28 21:41:02 +00:00
Sandra Lokshina 8cb5001984 Replace our skip button with the IMA's default one.
According to the agreement with the IMA team, we will
no longer hide their UI during ads. Instead we will
incorporate their elements into our layout.
(Some of the elements they expose are legally required
or business critical for partners for certain types of
ads).
This change replaces our skip button with the IMA one
and tweaks our layout to make it fit better.
We are keeping our ad counter and the 'Ad X of Y'
element.
Our skip button will stay in the library, and we will
use it for other (non IMA) ad integrations.

Change-Id: I648c6c65a34607685a409a264c2a03d74cc4d461
2020-04-22 21:03:11 +00:00
Joey Parrish d5e20b5ea8 Fix Shaka UI controls in Cast receiver
The Cast receiver does not ever change the controls between our UI and
the native controls, but the demo app does.  So in the demo app, we
never noticed that they do not seem to show up by default any more.
This fixes the UI library to show its own control by default, which in
turn fixes the Cast receiver app and any other app which did not use
setEnabledShakaControls().

Change-Id: I7889f1a7ec612bc7a260f5433316104d64ad4a26
2020-04-16 16:04:16 -07: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
Joey Parrish f8f64799ef Fix/remove extra keydown listener in UI
After leaving tab navigation, we would wind up with an extra callback
fired on keydown.  This drops the duplicate.

Change-Id: I4e7bc0c433e5648759788a9c1a70267844c2e3f1
2020-04-09 09:38:51 -07:00
Joey Parrish 11cbb267c5 Fix broken docs for UI control events
The event namespaces were wrong, so the generated docs had broken
links.

Closes #2385

Change-Id: I9348dedc1a41edee127548e7f80c7e426ffd237e
2020-04-07 23:37:51 +00:00
Joey Parrish cbbc1c5fc2 Dismiss UI overflow menus on window click
In addition to dismissing the overflow menu when the video is clicked,
dismiss when any part of the window is clicked.  This is no different
from our event listener on the window for key events, so it should not
negatively impact applications.

Fixes: 131843503

Change-Id: Icc5f16f25d74ee5de88f5a928074c4f995a8dea6
2020-04-07 21:28:49 +00:00
Joey Parrish 50724e2a91 Fix UI failure on destroy
When destroying the UI, it destroys the CastProxy & Player.  Then the
Player destroys the AdManager.  The AdManager then triggers events
that the UI elements listen to.  Those events cause the UI elements to
invoke the destroyed CastProxy.

Therefore it is important to destroy the UI elements before the
CastProxy and Player.

This was discovered while working on an unrelated issue, by observing
errors logs from automated UI tests.  The logs contained exceptions
with stack traces.

Change-Id: I6c1d070255bb138967d5e733c0c7ec8dd16350b6
2020-04-03 16:24:07 +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
Joey Parrish 928585c151 Fix UI exception joining existing cast session
this.video_.classList is undefined once video_ becomes a proxy object.
UI-related things (CSS, tab indexes, sizing) should always be done on
this.localVideo_ instead.

Closes #2451

Change-Id: Id6b007f3bf089bdf8fd532e2832f7b909c9fdf97
2020-03-10 13:28:12 -07:00
Sandra Lokshina feed333d46 Hide the seek bar when ads are playing.
Change-Id: Ic46d7620f3b8686872926227839416a59055d27f
2020-02-24 17:46:34 +00:00
Joey Parrish 714da55bbc Clean up FIXMEs in LESS code
- Drop unused classes
 - Drop shaka-displayed in favor of shaka-hidden
 - Move shaka-hidden to general.less and fix specificity issue

Change-Id: I9c91da637023607cccd6e7602d9b9ef30994dd82
2020-02-10 23:14:27 +00:00
Sandra Lokshina e9eb292c65 Move native/shaka controls toggle logic to CSS.
Closes #2345

Change-Id: I54bb91899f2f9aa000c43aedbb04ccec22666751
2020-01-27 21:18:13 +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 22e8c29a0d Use CSS & container attributes to hide controls
This is now based solely on container attributes and CSS, as it used
to be, removing the need for a list of controls to hide in JavaScript.
This also does away with the "shaka-fade-out-on-mouse-out" CSS class.

Change-Id: Ic2f77c5b2f0691023279d9c99cfe3519f4b26cdd
2020-01-14 10:42:36 -08:00
Joey Parrish 55eb33d1c3 Overhaul UI opacity logic
- "Override CSS" could be set and unset from multiple places, such
   that the calls from the overflow menus were easily invalidated by
   mouse movements.  This flag is now gone.
 - "Show on mouse over" controls were implemented using mouseenter and
   mouseleave events on each element.  These listeners are now gone.
 - Casting state, used to compute if the controls are opaque, is now
   based on the same "casting" attribute used by the CSS to force them
   to be opaque.
 - Opacity decisions are now made by a single method, which accounts
   for video and ad pause state, the hover state of "show on mouse
   over" controls such as the overflow menus, and the recency of mouse
   movements (represented by a single flag maintained by the existing
   mouseover timers).
 - An opacity decision is now triggered on play state changes, so the
   UI content should always be correct when we pause a cast receiver.
 - An opacity decision is now triggered on keyboard navigation
   changes, so the UI should always be opaque when using keyboard
   navigation.

Closes #2314

Change-Id: I5062feaf4698595deb89a2471a37c06bc9762bb5
2020-01-14 03:04:45 +00: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 a6b159ffcf Keep controls visible while casting.
There was a comment that suggested that controls were supposed to
be opaque as long as the video was casting.
However, that was not the case; the controls would quickly go
transparent while casting.
This changes the controls to not fade out while casting (but to
fade out after casting ends, if applicable).

Change-Id: I7f7e4275d941db3b544b56a68395b8a8f0a55818
2020-01-10 23:50:09 +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
Joey Parrish ee91f4a38a Fix style errors
Change-Id: I0c390d3e69881a875ce1cc8383029b3a10ab932b
2020-01-06 11:49:25 -08:00
zarmhast 3dc0b17891 Allow video to go complete fullscreen on Android
Hide the navbar on Android devices with onscreen navigation.

Fixes #2324
2020-01-06 11:49:25 -08:00
Sandra Lokshina 1b3b78ea16 Add ad position info to the UI. (Ad x of y).
Issue #2222.

Change-Id: I9bf946552bc6f669164c387480fadc100087708a
2019-11-22 22:04:05 +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
Sandra Lokshina 47c857d100 Make it possible to exclude ads from the build.
Closes #2231

Change-Id: I3ef4ce09fa3a08bfcaffa2d53aae4bbec70b33c1
2019-11-14 18:13:55 +00:00
Sandra Lokshina 0f6e973589 Play/pause the current ad on video container click.
Similar to how we play/pause the presentation in
this case.

Issue #2222.

Change-Id: I58944afb49159e3dc8bd6b16b930f13b9556f25f
2019-11-04 20:29:44 +00:00
Sandra Lokshina d47362ac5e Integrate play button icon change with ads and fix fade out.
1) Play buttons' icons now toggle between play and pause
depending on ad state during ad playback.

2) Controls fade in and out on mouse out/in during
ad playback similar to how they do it during the
presentation.

Issue #2222.

Change-Id: I97ce3b5aa70bdfdd758a54894a3d94b38bccf953
2019-11-01 14:02:19 -07:00
Sandra Lokshina 8fff91531f Toggle ad's fullscreen mode when document.fullscreen changes.
Issue #2222.

Change-Id: I2ab145391cf8dacad261e0a21f69f68508ef3884
2019-11-01 11:27:50 -07:00
Sandra Lokshina 688d8881d9 Change controls behavior when an ad is playing.
This CL makes the controls switch between controlling
the ad and the presentation. If there's an ad currently
playing, pause button will pause the ad instead of the
presentation, mute button will mute the ad, etc.

Change-Id: I42f57df9a5ce491ed842f39e0f1e6031d1e3a93c
2019-11-01 16:25:52 +00:00
Sandra Lokshina 02847e3b1f Show ad controls and update ad counter when ad starts.
(Also hide ad controls when ad ends).

Change-Id: Ifd5b8ec47fe08ef277d86f96632677c7c07cfbd4
2019-10-28 22:10:55 +00:00
Sandra Lokshina 4df8ab5737 Make the bottom skim fade out with the rest of the controls.
After my CL changing the fade out controls logic, the
black gradient at the bottom of the controls stayed
visible when all other controls faded out. This
change fixes that.

Change-Id: Ieb3d8980c2ddf7fde3c3fdcb6fc1e530a743b77f
2019-10-17 20:43:09 +00:00
Sandra Lokshina 26283599a9 Make sure ad UI stays visible when other controls fade out.
This CL changes the way controls fade out on mouseout to make
sure ad controls stay visible even when other controls are not.
Instead of fading everything within the top level controls
container, it's now possible to hide some controls, but
leave the others. Controls that need to fade on mouseout
are tagged with a 'shaka-fade-out-on-mouse-out' class.

To try out the change, make the 'shaka-ad-controls'
div visible and mouse out of the video container.
Everything except for the ad controls should fade.
(Please note that ad controls don't do anything meaningful yet).

Change-Id: I4fcd1b6430df680699980c492ec1d612437a877d
2019-10-14 14:31:40 -07:00
Sandra Lokshina f485772b6d Add ad elements to the UI layout.
This change adds an ad counter and a skip add
button to the DOM and styles them appropriately.
Please note that they don't work yet!
The elements are hidden for now.
To check them out, remove the 'shaka-hidden'
class from the 'shaka-ad-controls' div.
(data-shaka-player-container -> shaka-ad-controls-container ->
shaka-ad-controls).

Change-Id: I45a33d43abc6b0a023cc77f09abdae94a4cee014
2019-10-11 21:56:44 +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
Sandra Lokshina fdd2602acd Release old ui.Elements on controls.configure() calls.
The calls to controls.configure() deleted the old layout
in terms of the html elements, but the ui.Elements
owning the html still survived.
This CL fixes that. It also switches ui.Element from
IDestroyable to IReleasable to make the release synchronous.

Fixes #2089.

Change-Id: Ic4ce70e91a1b028ef4d971ac3fb9281d8a667ea8
2019-08-20 21:09:15 +00:00
Jacob Trimble d1498f4968 Don't add Control event listeners multiple times.
Because configure() is called multiple times, we used to add some of
the event handlers multiple times.  For fullscreen, this caused us to
try to toggle fullscreen multiple times.  This changes to only add the
main event listeners one time and the DOM-specific ones have been moved
to be added in the configure() call.

This also moves the fullscreen toggle to the try so we can propagate
any errors from it.  Lastly, this adds an "error" listener to the
tests to fail the test.

Closes #2054
Issue #2089

Change-Id: Ic78417ce52cae1c53133b5a4217004bb91ebcc4f
2019-08-12 18:14:59 +00:00
Jacob Trimble 39f0d76a1f Don't enter fullscreen on double click on bottom bar.
Fixes #2053

Change-Id: I4779547ae2116d9cc4394c27aab33366ad36a6a6
2019-07-29 21:01:40 +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
Sandra Lokshina 7c271baba5 Communicate seeking state to controls.
Regression from fcbb725. Other elements rely on controls
knowing current seek state. Now that seek bar is its own
class, it needs to update controls on that.

Change-Id: I29ae8faa9f830ef86380d6b07373dedbeebce263
2019-07-22 15:47:51 -07:00
Sandra Lokshina a8aec9726f Fix fullscreen behavior on double click and rotate.
Enter fullscreen on dbl click behavior got lost after
the UI lib redesign. Also, rotate to fullscreen should
not be conditional on the layout having a fullscreen button.
There might be no button, but we should still enter
fullscreen on rotation for applicable devices.

Closes #2043

Change-Id: Ic75738cdd429851945acb5201780d9d73a6faadd
2019-07-22 21:01:54 +00:00
Joey Parrish fcbb72561f Refactor UI range elements
This factors out common functionality and structure from the volume
bar and seek bar, both of which involved specific CSS workarounds for
IE.  The seek bar had logic to keep the value from jumping around
during casting, which now the volume bar benefits from, as well.
Finally, the seek bar code was spread out throughout controls.js, and
now it has its own class.

Closes #1913

Change-Id: I299476ccbc27f28f7b225a6e6f8b0d21abe5baf2
2019-07-10 12:26:54 -07:00