Commit Graph

353 Commits

Author SHA1 Message Date
Nbcl adc3502d55 feat(ui): Add quality selection for audio-only content (#3649)
Replaces resolution menu with audio quality menu when content is audio-only.

Fixes: #2071
2022-04-21 15:43:51 -07:00
Joey Parrish ac5acc80cb feat!: Remove deprecated features, update upgrade guides (#4089)
Below are the changelog entries for each deprecated feature removed by this commit.

-----

feat(config)!: `manifest.dash.defaultPresentationDelay` has been replaced by `manifest.defaultPresentationDelay` (deprecated in v3.0.0)

feat(config)!: Configuration of factories should be plain factory functions, not constructors; these will not be invoked with `new` (deprecated in v3.1.0)

feat(player)!: `shaka.Player.prototype.addTextTrack()` has been replaced by `addTextTrackAsync()`, which returns a `Promise` (deprecated in v3.1.0)

feat(ui)!: `shaka.ui.TrackLabelFormat` has been renamed to `shaka.ui.Overlay.TrackLabelFormat` (deprecated in v3.1.0)

feat(ui)!: `shaka.ui.FailReasonCode` has been renamed to `shaka.ui.Overlay.FailReasonCode` (deprecated in v3.1.0)

feat(offline)!: `shaka.offline.Storage.prototype.store()` returns `AbortableOperation` instead of `Promise` (deprecated in v3.0.0)

feat(offline)!: `shaka.offline.Storage.prototype.getStoreInProgress()` has been removed; concurrent operations are supported, so callers don't need to check this (deprecated in v3.0.0)

feat!: `shaka.util.Uint8ArrayUtils.equal` has been replaced by `shaka.util.BufferUtils.equal`, which can handle multiple types of buffers (deprecated in v3.0.0)

feat(manifest)!: `shaka.media.SegmentIndex.prototype.destroy()` has been replaced by `release()`, which is synchronous (deprecated in v3.0.0)

feat(manifest)!: `shaka.media.SegmentIterator.prototype.seek()`, which mutates the iterator, has been replaced by `shaka.media.SegmentIndex.getIteratorForTime()` (deprecated in v3.1.0)

feat(manifest)!: `shaka.media.SegmentIndex.prototype.merge()` has become private; use `mergeAndEvict()` instead (deprecated in v3.2.0)

feat(plugin)!: `AbrManager` plugins must implement the `playbackRateChanged()` method (deprecated in v3.0.0)

feat(plugin)!: `shaka.extern.Cue.prototype.spacer` has been replaced by the more clearly-named `lineBreak` (deprecated in v3.1.0)

feat(plugin)!: `IUIElement` plugins must have a `release()` method (not `destroy()`) (deprecated in v3.0.0)
2022-04-11 17:11:40 -07:00
Á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
Joey Parrish f1c1585afb fix: Add explicit release() for FakeEventTarget (#3950)
Before, we would count on all event listeners for FakeEventTargets to
be cleaned up by the object that listens.  Now, FakeEventTarget
implements IReleasable, so that all listeners are removed when owners
call release().

For objects extending FakeEventTarget and also implementing
IDestroyable, the destroy() methods will call out to super.release()
to clean up listeners then.  The owner should use destroy() in those
cases.

Issue #3949 (memory leak in DASH live streams with inband EventStream)
2022-02-15 12:06:26 -08:00
Álvaro Velad Galván 9f53d39427 fix(UI): Fix text UI not updating when text is disabled (#3867)
Closes #3728
2022-01-18 02:00:52 -08:00
Álvaro Velad Galván 8d1b5e6b07 feat(UI): Add video fullscreen support for iOS (#3853)
Closes #3832
2022-01-12 12:46:28 -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
Theodore Abshire 8aacdcf76c feat(UI): Adds singleClickForPlayAndPause config
Closes #3821

Change-Id: I94ba5a5e69e9934aff7b50d73a819b463bf9e8aa
2022-01-05 02:08:57 -08:00
Dador 3092063479 fix(ui): Fix Russian translation (#3751) 2021-11-11 10:09:07 -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
Theodore Abshire dd3748d599 fix: Enforce string-format of event data keys.
Previously, many events were being defined with a data dictionary
that used variable-type keys (e.g. {key: value}). This worked fine
in uncompiled mode, but in compiled mode it lead to those properties
being obfuscated.
This changes the FakeEvent constructor to take a map rather than an
object, so the compiler will force the keys to be strings.

Closes #3710

Change-Id: I67b1a391540a5ee21f0aaf940ae054d26f4c10a4
2021-10-25 12:40:32 -07:00
Álvaro Velad Galván 9c3bed3d60 feat(ads): Integrate with non-linear IMA CS ads (#3639)
Closes: #2596
2021-10-18 11:42:54 -07: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
Álvaro Velad Galván a7f4db7f18 fix: Account for server-side ad cue points in external text tracks. (#3617)
When an external subtitle track is added and you are using DAI, the external track does not take into account the ads that the video has, so this PR makes this internally take into account when generating the external track.
2021-09-13 15:39:06 -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 f65b093d40 feat(ui): Add configurable rates (#3579)
Adds configurable options for playback, fast forward and rewind rates.
Closes: #3443
2021-08-23 09:22:27 -07:00
Nico afb93106a7 feat(ui): Add right-click context menu, statistics button (#3548)
Closes #2607
2021-08-04 22:16:56 -07:00
Theodore Abshire 38cfc23048 Feat(UI): Exit PiP when destroying UI
The UI can open up Picture-in-Picture mode, through the PiP button,
but it does not automatically leave PiP mode when being destroyed.
This CL adds leaving PiP mode to the destroy process.

Closes #3553

Change-Id: I6830a7ceed7e4ca4fbd0e7d36b8257d564e0226c
2021-07-27 14:31:36 -07:00
Nico 481b378a4b feat(ui): Add Quality, Language, Playback, Captions buttons to control panel (#3465) 2021-07-23 12:12:16 -07:00
Álvaro Velad Galván 8b418bb13c Fix(UI): Update Play icon after seeking from end (#3515)
We change the "play" button icon to become "rewind" when the video ends.
However, previously we did not update the icon again when seeking.
This would lead to the icon still looking like a "rewind" button if
the user seeks back from the end of the video.
This fixes that, by making the button listen to "seeking" events.
2021-07-10 02:46:00 -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
Álvaro Velad Galván 2dedd9f3f5 Fix: Fix ARIA label on replay button (#3513)
Close: #3512
2021-07-08 15:17:16 -07:00
Álvaro Velad Galván 3b2f7dba04 Fix(UI): Stop using setAttribute for ARIA (#3489)
* Stop using setAttribute for ARIA
* Remove references to shaka.ui.Constants.ARIA_LABEL
2021-07-07 12:30:32 -07:00
Theodore Abshire 0146ccd69d Fix (UI): Don't show AirPlay button if unavailable
Fixes #3471

Change-Id: Ifafab8710456000888068b31d05c5dc00b059594
2021-06-18 19:51:38 +00:00
Theodore Abshire a25fde5dff Fix (UI): Check fullscreenEnabled in dblclick
Our "double tap on the video to enter fullscreen" functionality was
not checking to see if fullscreen was enabled or not first, which
would lead to the player erroring if the user double-clicks the
video on a platform that does not support fullscreen.

Fixes #3441

Change-Id: Id96f783a265e0e05fba93cae2da3904bf1747c9b
2021-06-01 09:19:03 -07:00
Theodore Abshire 6c528c8f4a fix(UI): Fixed details on failure to load.
When switching from using document.createEvent to using the CustomEvent
constructor, we accidentally broke the "shaka-ui-load-failed" event
such that it no longer had a detail object. The detail object is meant
to be provided, not by itself, but as a member variable inside a custom
dictionary.
This fixes the syntax on the constructor.

Issue #3388

Change-Id: I16dc025c21c8f0a012b5854bbbc56e8b110b2300
2021-05-05 21:06:15 +00:00
Joey Parrish 895c841be9 build: Fix XSS conformance checks internal to Google
Some internal Google tools that are meant to find XSS vulnerabilities
complain about some parts of Shaka Player.  In particular:

 - Using setAttribute instead of a src property
 - Using setAttribute with a variable key
 - Using URL.createObjectURL

This resolves these internal XSS checks.  As far as I can tell, there
are no serious XSS risks from any of these, as the complaining checks
are meant to catch things that could be executed as scripts.  None of
these user-controlled inputs are treated as such, but it seems that
the compiler involved can't tell that.

This goes part of the way toward solving #3378.

Change-Id: I302b9eb56a374854c9b8525b21960ef64fd386f1
2021-04-30 01:00:56 +00:00
Michelle Zhuo 95ba28b5af refactor: Remove IE 11 support
Issue #2339

Change-Id: I80ffa7b04f7afd943aa0f881d2a494dd35def732
2021-04-29 17:47:07 +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
Álvaro Velad Galván 80bdb5a476 feat(ui)Update icon doesn't work for 'muted' attribute. (#3307)
* Update icon doesn't work for 'muted' attribute.

* Fix comment

* Update PR
2021-04-05 11:18:32 -07:00
Michelle Zhuo 9e2a5855e6 fix(ui): Play video with the previous speed after pause
When we change the video play rate via UI, and pause and play the
video, it resumes playing at 1. That's caused by 'cancelTrickPlay'.

We can set the defaultPlaybackRate when changing the play rate, and
use that value when we resume playing.

Closes #3261

Change-Id: Ifc200697ea956e3257ae3371886bbb5c9c03338f
2021-04-02 09:35:55 -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
Suraj kumar (sk) e933c368b8 fix(ui): Fix holding keyboard controls (#3267) 2021-03-24 10:09:38 -07:00
Amila Sampath 9fb637d82f feat(UI): Display cursors as pointers on overflow menu buttons(#3218) 2021-03-23 08:51:42 -07:00
Suraj kumar (sk) 0943c80ce8 fix: Fix tracking of pressed keys in the UI (#3259)
In 77054d21, we made some changes to UI keyboard events that introduced a new bug.  It broke our tracking of pressed keys in the UI, which allows us to observe keyboard navigation through the UI and maintain focus when tabbing through overflow menus.

This fixes the tracking of pressed keys by properly removing them from the set on keyup, not keydown events.
2021-03-21 18:58:49 -07:00
Shaka Player BuildBot ac6232051e Merge remote-tracking branch 'github/master' 2021-03-19 13:40:14 -07:00
Adit Mehta ba98641046 fix(ui): Show replay icon instead of play when video ends (#3253)
Fixes #3247

Co-authored-by: aditmehta9 <aditmehta9@gmail.com>
2021-03-19 13:38:14 -07:00
Michelle Zhuo 99314b733f fix(doc): Update @event and @link in UI
After some research, I found the right way to use @event in JsDoc:
1. An event definition should be: @event className@eventName
2. The link to the event should be:
   @link className#event:eventName

Reference: https://groups.google.com/g/jsdoc-users/c/-1Qle3ww8Rk/m/UjiibrcSkoUJ

Change-Id: I09ed999f44df815c2f9f558f7ddbfd2f4c7df426
2021-03-19 13:38:12 -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
Joey Parrish 77054d2177 fix: Fix rapid keyboard-based seeking
Seeking rapidly with the keyboard controls now leverages the existing
logic for handling rapid mouse-based seeking.  A new method
(changeTo()) has been added to manage this.

This also moves the keyboard control handling from keyup to keydown
events, to handle holding down the key.  Previously, holding down the
key triggered the native key handling of the input element.

When you hold down a key, you get multiple keydown events.  When you
release it, you get a single keyup event.  So when the user holds down
the left arrow, we weren't actually doing anything.  Instead, the
keydown handler built into the input element was handling the event.

By switching to keydown events, we get those multiple events when the
key is held, and we get to handle them the way we want, instead of
letting the input element handle them in a way we can't control.

Finally, since we already had a keydown handler on the window to
manage tab navigation, this renames the two handlers to make it clear
which keydown events they handle (on which target).

Closes #3234

Change-Id: I862159adb238436dac7df6451a0f3e3c3f912360
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
ismena 23fe712849 fix(ads): Hide the ad container when ads aren't playing.
The ad container intervened with native browser controls in Chrome.

Closes #3121

Change-Id: I620d3318c8f9e5bed0a83c3de66f746d20c6703e
2021-03-05 18:08:47 +00:00
Joey Parrish 562a2d567b chore: Strictly require jsdoc
This enables the eslint rule requiring jsdocs on all class
declarations, function declarations, and methods.

Unfortunately, there are two problems with this:

1. We don't use class _declarations_, we use class _expressions_,
which are not covered by this rule.  So it does not enforce jsdoc at
the class level.
2. We tend to document a class at the class-level, rather than at the
constructor.  But a constructor counts as a method for eslint, so it
requires docs on the constructor.  There is no way to configure it to
make an exception for trivial constructors.

So for all trivial (no-argument) constructors, we add empty jsdocs:
  /** */
  constructor() {

This was quicker and easier than setting up some alternative plugin in
eslint to make an exception for us.

The good news is that this rule caught several undocumented parameters
and places where the jsdoc comment was malformed.  So fixing those
also improves the compiler's ability to enforce types.

Change-Id: Icbc46ed690c94e53d354648a883119524f8fca45
2021-01-09 02:00:31 +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