Commit Graph

96 Commits

Author SHA1 Message Date
Álvaro Velad Galván 33e84009dc fix(UI): Add cursor pointer to range elements (#4059)
Since range elements are special input elements, they must reflect user
interaction, so when the user hovers over the range element, the cursor must be a pointer.

Issue #3220
2022-03-23 09:56:13 -07:00
Joey Parrish 9029d0677e feat: Public release of Sindarin (sjn) translation easter egg (#4033)
This has been secretly in our demo on appspot since April 2019, but it
was being inserted on-the-fly by our appspot code on the server-side.

Now that we are transitioning all of our infrastructure into GitHub
Actions, we're simplifying things by making this public and adding it
to the repo for the first time.

Enjoy!

https://shaka-player-demo.appspot.com/demo/#uilang=sjn
2022-03-18 14:11:18 -07:00
Joey Parrish a5e9ed61eb build: Upgrade CSS linter (#3991)
The new version requires additional configuration for less syntax, and
has new default rules we were out of compliance with.

I disabled rules about avoiding explicit vendor prefixes (such as
"-webkit") because we are not using any auto-prefixer tools.  Other
violations have been fixed:

 - kebab-case for element ids
 - quotes around URLs
 - double quotes instead of single quotes
 - disable class selector pattern matching for MDL (external)
 - use modern rgb/rgba syntax
 - no quotes on font families
 - no long-hand when short-hand will do

This brings our NPM audit vulnerabilities from 20 down to 10.
2022-02-22 14:16:22 -08:00
Joey Parrish a67cb6ed00 build: Downgrade less (#3982)
Downgrade less to v3.  v4 is failing on macOS for some reason.  See
less/less.js#3693

This also makes some less/CSS changes that are useful for future
upgrades:

 - wrap all calculations in calc(), which is required in less v4
 - remove unneeded @transparent variable

Finally, this fixes an erroneous error message that said "extern
generation failed" instead of "CSS compilation failed".

Closes #3981
2022-02-22 08:46:54 -08:00
Álvaro Velad Galván 680ab22aca Fix(UI): Fix time element height on Safari (#3809)
Closes #3739
2022-01-06 21:26:35 -08:00
Jacob Trimble cdeffbb9e6 fix(ui): Fix styling of UI text cues
First, the positioning of cues was incorrect.  We need to explicitly
set all the position attributes when we position elements with the
"absolute" position.

Second, if we position a text <span> manually, the background will fill
the whole region.  So to keep the background wrapping the text, we need
to add another <span> for the text.

Third, the background and font color should not be set on every <span>
element since it won't allow parent cues to set the inherited value.
So this moves the defaults to the top-level text element and allows
parent cue elements to override this.  It also would make app CSS
easier to override.  Because background color isn't inherited through
CSS, the default is set in JavaScript instead.

Fixes #3521
Fixes #3600
Closes #3713

Change-Id: I45fc88dcac4a0a062e1474087f24c80d98eef619
2021-11-03 17:31:25 +00:00
Álvaro Velad Galván 34958c81b9 feat(ui): Added Loop and PIP to context menu, and Statistics to overflow menu (#3578) 2021-10-12 01:00:51 -07:00
Nico c55ce6c11b fix(ui): Control panel alignment (#3650)
Fixes the alignment of buttons inside the control panel.
2021-09-27 09:26:24 -07:00
Nico d5769eeda4 feat(ui): Add tooltips to control panel buttons (#3572)
Adds configurable tooltips that display the function of buttons in the control panel.
Closes: #3269
2021-08-23 10:00:43 -07:00
Nico afb93106a7 feat(ui): Add right-click context menu, statistics button (#3548)
Closes #2607
2021-08-04 22:16:56 -07:00
Nico 481b378a4b feat(ui): Add Quality, Language, Playback, Captions buttons to control panel (#3465) 2021-07-23 12:12:16 -07:00
Joey Parrish 2250324a4a fix: Fix enforcement of cue alignment styles
This uses flexbox once again to get proper positioning of cues.  To
compensate for the issues that originally made us remove flexbox, this
adds a wrapper span inside the flexbox element.

Summary of screenshot changes:
 - slight change to background sizing
   - ui-basic-cue
   - ui-cue-with-controls
   - ui-duplicate-cues
   - ui-end-time-edge-case
   - ui-flat-cue-bg
   - ui-two-basic-cues
 - background fills block with literal newline in text
   - ui-cue-with-newline
 - region anchored without padding
   - ui-region-position
 - new screenshots
   - *-nested-cues-with-linebreak
   - *-region-with-display-alignment  (regression test for this issue)

Closes #3379

Change-Id: I8c678721d96662e0f8940cda12df4f5b5e5baf1e
2021-07-09 17:19:42 +00:00
Michelle Zhuo a59559f719 fix(UI): Fix spinner display
'stroke-dasharray' and 'stroke-dashoffset' are not supported in IE11,
and we deleted those styles for spinner by accident in PR #3309.
Adding them back to fix the Spinner display.

Change-Id: I5127b1d05d25b9869b7e29f9daf8ce1c6f9b55f2
2021-04-20 22:35:33 +00:00
Álvaro Velad Galván 463b1b6886 Remove support for IE 11 (#3309)
Issue #2339
2021-04-16 13:59:35 -07:00
mariocynicys 78e181db38 fix(ads): Fix the skip ad button not being clickable #3284 (#3326) 2021-04-14 11:32:21 -07:00
Nico 4f0ded7e37 feat(ui): Add Loop, PIP, Cast, AirPlay buttons to control panel (#3255)
These menu items are now available to be placed in the control panel of the UI.

Issue #2676
2021-03-30 15:44:44 -07:00
Amila Sampath 9fb637d82f feat(UI): Display cursors as pointers on overflow menu buttons(#3218) 2021-03-23 08:51:42 -07:00
Joey Parrish f676fed569 fix(ui): Fix cross-browser focus outline
It turns out that `-webkit-focus-ring-color` is no longer working
across platforms in Chrome.  It works on Mac, but not anywhere else.

Removing it creates a consistent focus outline across browsers and
platforms.  It was only being used on Safari and Chrome anyway,
neither of which seem to need it.

Closes #2863

Change-Id: Ic6df1a10f14a0907558595e53bef80ac349e6b9d
2021-03-18 21:15:41 +00:00
Jacob Trimble 9c2315e69d fix(text): Don't use flex layout in subtitles.
Using flex layout causes problems with the positioning of elements and
causes the borders to be wrapped over the whole parent.  This changes
to use block/inline layouts instead.

This also removes any padding around the cue lines, hugging the
background around the text.  This is a bit more consistent with other
renderers by having a gap between lines.  This also changes a bit of
the nested cues padding.

The deeply nested cue test is different because the `background-color`
CSS attribute isn't inherited, so the default in our CSS sets the
background to black.

Fixes #3013

Change-Id: I3e4b63b1b4de1f12e69fce2460d142e0a69bfcd9
2021-03-17 18:57:30 +00:00
Joey Parrish fdc7ccf692 fix(ads): Fix clicking in interactive client-side ads
Click events in an ad were previously received by shaka-text-container
and shaka-controls-container. shaka-text-container now ignores all
pointer events, because there is nothing interactive in this layer.
shaka-controls-container ignores pointer events only while an ad is
showing, with the exception that the bottom controls are still
clickable even during an ad.

Closes #3053

Change-Id: I07834c75c29315dc76afbdf886517437be5b85ff
2020-12-22 00:29:12 +00:00
Theodore Abshire 655493f441 Fix(ads): Fix bug w/ configuring UI during CS ads
Previously, the client-side ad container was put inside the controls
container, which was cleared when the UI was configured. This meant
that re-configuring the UI made client-side ads go away, basically.
This moves client-side ads to go into their own container, which
is never re-made or uprooted, even when the DOM is recreated, in
order to not break the IMA SDK.
This has the side-effect of fixing a bug where client-side ads were
not always cleared upon loading a new asset, and could show up
unexpectedly in future playbacks.

Fixes #2869
Fixes #2943

Change-Id: I3cf67b0b278764c10c6ff2f678316dc9cc85929e
2020-12-16 14:26:09 -08:00
Joey Parrish abd8b3b43a fix(ui): Make submenu CSS apply to all submenus
Without listing them individually, the controls CSS now applies the
correct styles to all submenus.  This makes it easier for apps to
subclass SettingsMenu without needing to add explicit CSS to achieve
the same styling as the built-in menus.

Closes #2925

Change-Id: Ie1e1536dc4806576d7ed22dfc8feb17abaa72152
2020-10-20 15:51:43 +00:00
Álvaro Velad Galván 59ee6baff4 fix(text): Make UITextDisplayer CSS-independent (#2819)
Closes #2817
2020-09-23 09:41:41 -07:00
Theodore Abshire de478295ca fix: Prepare to adopt newest version of StyleLint
Previously, StyleLint had a problem that was preventing us from
using their library in our buildbot tests. To get around this, we
made a custom branch of their library.
Recently, they almost fixed the issue. There's just one minor change
left before we can use their master branch. In the meantime, this
CL changes Shaka Player to use a new fork of StyleLint that is based
on their current master branch, and makes the LESS modifications
that the newest versions ask for.

Change-Id: I78624b3d366e6c22c577ca6707f5a3311f8e808e
2020-09-02 14:32:57 -07:00
Joey Parrish 565bb7d880 feat(text): Clarify and clean up text Cue contract
Changes:
 - Update comments on shaka.extern.Cue to clarify how fields should be
   used and interpreted
 - Add support for arbitrarily-deep nested cues in both text
   displayers
 - Stop adding whitespace between nested cues (parsers should emit
   exactly what they want displayed) and update tests to match
 - Remove obscure special cases from UITextDisplayer styles and make
   styling consistent with the Cue docs
 - Fix rendering for single line break (cue.spacer) elements
 - Add a layout test for deeply-nested cues
 - Remove reundant and identical set of UITextDisplayer unit tests
 - Update layout test for backgrounds to reflect the clarified rules
 - Update remaining UITextDisplayer unit tests to look for div instead
   of span for top-level cues
 - Updates screenshots for region-position, which changed slightly in
   appearance due to changes in whitespace rules
 - Updates screenshots for nested-cue-bg, to reflect simplified rules
   for applying backgrounds

TODO:
 - Temporarily breaks TTML output until the TTML parser can be updated
   to conform to the clarified rules in the Cue docs
 - Still more special cases around regions in UITextDisplayer
 - Rendering for multiple line break elements in UITextDisplayer
 - Support bold, italic, and underline in SimpleTextDisplayer
 - None of the displayers will honor the wrapLine field yet

Closes #2762 (extra vertical space seen for line breaks)
Issue #2761 (deeply-nested cues)

Change-Id: I02ac8213e4de67a65fb38d596d2c59536f3722ee
2020-08-11 14:30:40 +00:00
Joey Parrish 6c85c8cbfc fix: Fix rendering of TTML nested cues and spacers
TTML nested cues are meant to be displayed horizontally as inline
elements.  This fixes the rendering of these nested cues in both
SimpleTextDisplayer and UITextDisplayer.

In UITextDisplayer, the styles have been adjusted to lay out the
nested cues horizontally rather than vertically.

In SimpleTextDisplayer, the nested cues were being displayed as if
they were top-level cues.  This change concatenates the nested cues
into a single cue displayed in the browser.

This also improves comments on the poorly-named "spacer" property,
which represents a line break in TTML.

This fixes the rendering of "spacer" in SimpleTextDisplayer by
inserting an actual newline character into the collapsed nested cues.

Finally, this fixes and clarifies names used internally in
UITextDisplayer.  For example, there is a difference between a nested
cue and leaf cue.  A nested cue and a top-level cue without nested
cues are both "leaf" cues, but a top-level cue is never a "nested"
cue, since it is at the top level.  The conflation of these names
before this fix made it difficult to understand and fix the code in
the first place.

Closes #2760

Change-Id: I89633761d12704e253371d17e2e786c5b2ed67a7
2020-07-30 11:29:55 -07: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 c1b109aabc fix: Correct license headers in CSS/LESS
This corrects/normalizes the license headers in CSS and LESS files.
The LESS tool respects the same "/*!" syntax for forcing the inclusion
of a license header, but will not dedup these licenses.  So the LESS
files generally will not use this syntax.  Instead, the build system
prepends a license header after compilation.

The exception is for our SVG spinner, which is based on third-party
CSS from codepen.  The copyright header for this is forced into the
output to give proper credit to the original author.

Issue #2638

Change-Id: I4c58e2b082f2d5e550a6f0a30feaaf9ebf82a53a
2020-06-09 16:19:38 -07:00
Joey Parrish f76afcc853 fix(ui): Set an explicit font size for icons
We depended on this font size being set in the font server's CSS, but
did not realize we had this implicit dependency.  This makes our
desired font size explicit.

This protects us from applications which happen to use the same font
and class name with a different default size.  Note that applications
which intend to change our icon size can still do so explicitly in
their own styles.  This is meant only to protect against accidental
conflicts.

Closes #2633

Change-Id: I0a2993c8b2e39596b47eb59b7e1a4a6373633c0b
2020-06-09 19:16:23 +00: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 ac2a7039b4 Make the controls background gradient proportional
Rather than making the gradient 92px tall, make it 15% of the size of
the video container.  This is consistent with the size of the controls
and the position of the subtitles when the controls are shown.

In this way, the size of the gradient is now proportional and
responsive to the size of the video container.

This was spotted while developing screenshot-based layout tests using
relatively small containers.

Change-Id: I304d99a26be90b9eefa50dc179b924da15dc601d
2020-05-21 16:19:58 +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
Theodore Abshire 697a565051 Change positioning of line-positioned subtitles.
Previously, we were positioning subtitles relative to the video,
but this lead to problems with subtitles that were manually positioned
(via the line attribute) to be low (85% or lower); they would overlap
with the controls bar, and thus be hidden.

This changes cues to be positioned relative to the text-usable area of
the screen (e.g. the space above the controls bar). In addition, the
less values have been changed to not trim cues that extend out of the
container, so that if they do overlap with the controls, they aren't
clipped in an ugly way.
Examining the Chrome native controls, this appears to be closer to how
they render captions.

Fixes #2524

Change-Id: I4500b8f637f3f43f48d019d14ef527e75d960fec
2020-05-01 20:31:55 +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 d55ef50159 Minor formatting cleanup
This fixes syntax highlighting of this file in Vim.

Change-Id: I415b6d4855d5b05d9473e474ef2f057bcfb2c8c4
2020-03-27 15:49:37 +00:00
Joey Parrish 7a42c09477 Fix cursor style on skip-ad button
Without this, you can't tell that the button is clickable when you
mouse over it.

Change-Id: I571803d0ac3bd9416282de96eb20bce478770546
2020-03-26 21:02:49 +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
michellezhuo cfe1f89171 Add playback speed selection to UI
Closes #2362
Closes #1676

Change-Id: I10184dccab301be7382940e35e36d66dc7a5e2ad
2020-02-12 20:24:03 +00:00
Jacob Trimble 326f5cd02a Use short license in more files.
Some of the files still used the old long license.  This increased the
size of the compiled bundle since it had both versions.

Change-Id: Iec137f71547f91369a563145f870eb26ddc96a96
2020-02-11 19:09:44 +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
Joey Parrish b0217f5e6f Work around Material Icons font bug
This works around google/material-design-icons#958 by switching from
the default "solid" style to the "rounded" icon style.

Change-Id: Iea29ed3732d252bd2d089c802c478a97cbda163d
2020-02-10 23:14:16 +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 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 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 4c1a122b18 Fix showing of local controls while casting
This was broken during recent ads work, when we refactored how
controls are shown/hidden in CSS.  When we transitioned from
showing/hiding the container to showing/hiding individual controls,
the override behavior for casting was lost.  This restores it.

Change-Id: I81df8e4d3ff14ded0fe431f5f1b66fa821610e02
2020-01-14 03:04:45 +00: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
Sandra Lokshina 648a589252 Adjust overflow menu width depending on content width.
Closes #2249.

Change-Id: Ic4c5676857b9be8dcb492099bf45951ace1f5640
2019-11-21 13:48:33 -08:00
Sandra Lokshina 64e42fa9b6 Integrate skip button into ad experience.
Change-Id: I49e78c56c178bab47b3773f01f06c171bb422cb8
2019-11-21 18:59:24 +00:00
Sandra Lokshina 8d45673c2b Change ad controls CSS according to designer's feedback.
Change-Id: I1233b7bf0a59662d4b31d9671fb63271d61f24ff
2019-10-31 17:09:38 +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