Commit Graph

72 Commits

Author SHA1 Message Date
Álvaro Velad Galván c433bcb68b feat(UI): Support Document PiP for audio-only playback (#10136) 2026-05-28 10:43:50 +02:00
Youssef Bennour Sahli bb18838b28 feat(UI): Support customizing resolution menu labels via customTrackLabel (#10096)
This PR introduces a UI configuration callback for customizing video
track labels in the resolution selection menu, resolving #9517

The callback receives the default label and the video track; returning a
falsy value keeps the default.
2026-05-19 19:27:43 +02:00
Aditya Mishra 415ebdc52e feat(UI): Add live subtitle style preview on hover (#10077) 2026-05-12 13:24:17 +02:00
Álvaro Velad Galván 68499d3c8d test: Fix UI tests on some devices (#10061) 2026-05-06 13:02:26 +02:00
Andy(김규회) f1c0468f70 feat(UI): Improve shaka player UI accessibility (#10023)
### ARIA attributes
  - Add `aria-hidden="true"` to all decorative SVG icons (`icon.js`)
- Implement missing `aria-label` for ad controls (`skip_ad_button.js`,
`ad_info.js`)
- Add `aria-pressed` to toggle buttons (mute, fullscreen, pip, loop,
statistics, remote, stereoscopic)
- Remove incorrect `aria-pressed` from one-shot action button
(`recenter_vr.js`)
- Add `role="menu"`, `aria-haspopup`, `aria-expanded` to menus
(`overflow_menu.js`, `settings_menu.js`, `context_menu.js`)
- Add `role="menuitemradio"` and `aria-checked` to selection menus
(resolution, language, text, playback rate, etc.)
- Add `role="toolbar"` to control panel (`controls.js`)
- Add `role="heading"` to content title (`content_title.js`)
  
### Focus management
- Restore focus to trigger button when menus close
  - Maintain focus on fullscreen button after toggle     

 ### CSS
- Add `forced-colors` media query for Windows high contrast mode
  ### Other
- Add `alt=""` to seek bar thumbnail image
- Add `aria-hidden="true"` to watermark canvas
  - Add accessibility unit tests for ARIA attributes
- Remove redundant `aria-hidden` from checkmark icon (`ui_utils.js`)
  - Add ARIA terms to project spell-check dictionary  

Issue https://github.com/shaka-project/shaka-player/issues/3146
2026-04-23 14:53:23 +02:00
Álvaro Velad Galván c200219fa2 test: Fix UI tests on SmartTVs (#9660)
Tests fixed:

```
  UI Customization
    ✗ big buttons only created when configured [Safari 3.0 (Tizen 3.0)]
	Error: Expected 1 to be 0.
	    at <Jasmine>
	    at Function.confirmElementMissing (test/test/util/ui_utils.js:70:29 <- test/test/util/ui_utils.js:139:31)
	    at _callee6$ (test/ui/ui_customization_unit.js:86:13 <- test/ui/ui_customization_unit.js:152:21)
	    at tryCatch (node_modules/@babel/polyfill/dist/polyfill.js:6473:40)
  UI
    controls
      controls-button-panel
        ✗ has default elements [Safari 3.0 (Tizen 3.0)]
	Error: Expected 1 to be 0.
	    at <Jasmine>
	    at Function.confirmElementMissing (test/test/util/ui_utils.js:70:29 <- test/test/util/ui_utils.js:139:31)
	    at _callee15$ (test/ui/ui_unit.js:425:19 <- test/ui/ui_unit.js:506:27)
	    at tryCatch (node_modules/@babel/polyfill/dist/polyfill.js:6473:40)

```
2026-02-05 07:09:13 +01:00
Álvaro Velad Galván 3fd73ce941 feat(UI)!: Add bigButtons config and remove addBigPlayButton config (#9636)
- The following buttons are registered: play_pause, mute, fullscreen,
rewind, fast_forward, picture_in_picture, remote, loop, skip_next,
skip_previous
- SmallPlayButton and BigPlayButton are removed
- The following buttons are used by default on mobile: skip_previous,
play_pause, skip_next
2026-02-02 09:56:43 +01:00
Álvaro Velad Galván 0c0c2ffe29 feat(UI)!: Enable customContextMenu by default on desktop browsers (#9635)
statistics and ad_statistics are added by default to context menu only
on debug builds
2026-01-30 12:03:26 +01:00
Álvaro Velad Galván 2d02ae3f6d feat(UI): Allow all items registered in overflow to be in the context menu (#9527) 2025-12-19 09:23:07 +01:00
Álvaro Velad Galván 0f4e849acf fix(UI): Fix position of sub menus (#9485)
Now the submenus are rendered within the overflow menu
2025-12-10 13:28:40 +01:00
Álvaro Velad Galván 9a180db1e9 test: Fix tests on Cast devices (#9275) 2025-10-23 21:01:01 +02:00
Álvaro Velad Galván becf5d329f feat(UI): Use Mbps notation in resolution selector (#8779) 2025-06-23 09:22:15 +02:00
Wojciech Tyczyński 970d7756ea feat: Add Device API (#8210)
The goal is to simplify and abstract feature logic detection. Currently
lots of places depend on various calls to `shaka.util.Platform` and
mainteinance of this is hard & not easy to read.

By introducing device API ideally rest of the player logic would look
into device features instead of directly checking platform. Additionally
we can more easily cache needed values, so we won't have to parse user
agent several times anymore.

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2025-06-02 13:46:40 +02:00
Álvaro Velad Galván 99a6f25bc7 feat: Create a new simple API for Video (#8454)
Co-authored-by: Wojciech Tyczyński <tykus160@gmail.com>
2025-04-15 12:08:25 +02:00
Álvaro Velad Galván fa81625dfa test: Fix UI tests on lab (#8435) 2025-04-09 16:57:16 +02:00
Álvaro Velad Galván 1c8539698c feat(UI): Modernization of the UI (#8409)
Changes:
- The look has been changed to make it more similar to YouTube:
  - The main background color is now black, and the font is white.
  - Presentation time has been moved to the bottom.
  - Cast and airplay buttons are now more accessible.
  - Tooltips have been enabled except on mobile platforms.
- The ad information has been moved to appear in the same position as
the presentation time when the ad is present.
- A mark indicating the current quality has been added (e.g.: HD, 2K,
4K, 8K)
- The spinner has been replaced with one that works well on Smart TVs
and is very similar to the current one. The animation is included in the
SVG element itself rather than through CSS.
- More LESS variables have been added to make customization easier in
forks.
- The maximum size of the menus is dynamically calculated so that they
never extend outside the video container.
- The size of the subtitle container when the UI appears is now
calculated dynamically.
- The Demo has been updated to show the seekbar when trickplays are
enabled.
- UI performance on Smart TVs has been improved (Tested on Tizen 5.0)
- Many offsets that were hardcoded have been removed, but not all (in
CSS).

Close https://github.com/shaka-project/shaka-player/issues/8406
2025-04-08 13:46:23 +02:00
Álvaro Velad Galván 4c6c576492 feat: Retain segment in memory on QuotaExceededError (#7954)
Closes #1352

Segment prefetch keeps the segments until the position of the segment to
be requested changes, which is exactly what happens when the
QuotaExceededError error occurs. So enabling this by default with a
value of 1 solves this problem.
2025-01-28 11:42:15 +01:00
Wojciech Tyczyński 6e55a3b21b build: Forbid using dot in generic types (#7904)
Fixes #2643

Happy reviewing!
2025-01-20 09:39:51 +01:00
Álvaro Velad Galván 4e6e37c0ce feat(UI): Add close button to statistics panel (#7482) 2024-10-23 21:31:36 +02:00
Joey Parrish 072fe75e69 test: Fix DOM autosetup test flake (#7448)
The promise for DOM auto setup tests doesn't guarantee that load() is
complete, only that we started it. So checking video duration causes
flake, in particular on slow devices like Tizen. Instead, check for the
player to have an asset URI.
2024-10-21 09:05:16 +02:00
Joey Parrish 0f2ee89df9 fix(UI): Fix auto-load with source tags (#7430)
In 4425dca2, we broke auto-loading content with `<source>` tags or
`src=` in the UI, such that we tried to load content before we had
attached a video element. That was almost a year ago. Oops!

This also adds an appropriate unit test.
2024-10-18 10:00:15 +02:00
Joey Parrish ddabe93eaf test: Fix Fuchsia background-video errors (#6579)
In some cases, Fuchsia Chromecast tests will fail with the error: "The
play() request was interrupted because video-only background media was
paused to save power."

This resolves the issue by ensuring tests run un-muted on that platform,
based on this Chrome code, which indicates the "paused to save power"
logic does not activate when sound is playing:
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/media/web_media_player_impl.cc;l=3535;drc=d23075f3

This also fixes two places in our tests where the `createVideoElement()`
was bypassed. This should always be used, because it is a central place
to apply workarounds such as this.
2024-05-10 23:21:37 -07:00
Joey Parrish 975235beb1 ci: Add additional lab Chromecast devices (#6563)
Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2024-05-09 12:01:22 +02:00
theodab 4425dca283 chore: Remove state engine (#5752)
The state engine mechanism, designed for the player class, was
over-engineered. The structure of the class makes debugging player
errors unnecessarily annoying, by obfuscating the code-path the error
followed, and in general
has created a significant amount of technical debt.
This changes the player to use an async-await setup for the top-level
operations, laying things out much more cleanly
and linearly.

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2023-10-30 23:59:08 -07:00
Dave Nicholas 0078137d1b feat: Enable codec switching (#5470)
Closes: https://github.com/shaka-project/shaka-player/issues/1528
Closes: https://github.com/shaka-project/shaka-player/issues/1567
Closes: https://github.com/shaka-project/shaka-player/issues/4379
Closes: https://github.com/shaka-project/shaka-player/issues/5306

---------

Co-authored-by: Álvaro Velad Galván <ladvan91@hotmail.com>
2023-10-04 08:37:14 +02:00
Julian Domingo 5987458e44 feat: add listenable events for playback stall detection and gap jumping (#4249)
An event `stalldetected` can be dispatched when Shaka Player detects a stall based on the value of stallThreshold through [StreamingConfiguration](https://shaka-player-demo.appspot.com/docs/api/externs_shaka_player.js.html#line920).

A second event `gapjumped` could also be dispatched when Shaka performs a jump in a media gap.

Related to issue #4227
2022-06-02 13:07:17 -07:00
Joey Parrish 1aed3f18c7 build: Fix linter error introduced by #3649 (#4147) 2022-04-21 16:09:13 -07:00
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 fbbd63d96b test: Late load tests, fix Chromecast test flake (#4115)
This change fixes tests on Chromecast by loading tests later in the process.  Test scripts are now dynamically inserted by boot.js, rather than loaded by Karma.  The bootstrapping code then awaits the completion of that before starting the Karma frameworks (Jasmine) to run the tests.

This also removes the use of goog.provide/goog.require in tests and test utils.  We don't need to load test utils or library sources dynamically in each test, and this gives us more explicit control over script loading and ordering.

Closes #4094
2022-04-11 15:47:48 -07:00
Álvaro Velad Galván 57c73241a0 fix(performance): Eliminate use of ES6 generators (#4092)
See: https://github.com/shaka-project/shaka-player/issues/4062#issuecomment-1077826210

Co-authored-by: @joeyparrish

Issue #4062
2022-04-04 10:58:16 -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 9674e1cd71 test: Skip fullscreen test on Tizen
This test requires fullscreen support, which is not available on
Tizen.  We should skip the test on any such platform.

This test was passing before the check for fullscreen support was
added to the library to fix #3441.

Change-Id: I6560a919257290540af3ce6a2b3da1a355da9ab9
2021-06-08 12:13:18 -07:00
michellezhuo 648e12e9c1 build: add goog.require for compiler upgrade (Part 4)
Change-Id: I6b4a7209c7a3a9f6069351377dac32f22222c0fb
2020-10-12 16:54:08 +00:00
Joey Parrish 7e6a0f38ff fix: Correct license headers in misc. files
This corrects/normalizes license headers in misc. files, such as
config files, docs, build tools, tests, and externs.  This does not
affect the compiled output, and is only done for consistency.

Issue #2638

Change-Id: I9d8da2de55243b08d7df2b743aac73c6f15e858a
2020-06-09 16:13:56 -07:00
Joey Parrish 4eefaa44cb Correct type info in tests
In many places in the tests, we used "Object" or "*" or just no type
at all for various fakes.  These were all flagged by the new Closure
Compiler version we are adopting.

In some other places, we mixed up similar types or had the wrong
nullability on a type.

In still others, types were missing fields.

These issues were caught by a compiler upgrade.

Issue #2528

Change-Id: I324e0b28f7e30a4102aa26ec2c9901fa9732211b
2020-04-30 16:00:17 +00:00
Joey Parrish 99de217c23 Remove periods from manifest structure
This removes periods from the internal manifest structure and cleans
up code and tests accordingly.  This leaves us unable to play
multi-period DASH & offline streams until the main period-flattening
algorithm is completed in shaka.util.Periods.

Three test cases have been disabled for the moment.

Multi-period playback will be restored in a smaller, more focused
follow-up commit, with disabled tests re-enabled.

Issue #1339 (flatten periods)
Issue #1698 (rapid period transitions issue)
Issue #856 (audio change causes bitrate change)
Closes #892 (refactor StreamingEngine)

Change-Id: I0cbf3b56bfdb51add15229df323b902f0b2e643a
2020-04-09 19:22:16 +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
Jacob Trimble bc45564721 Remove deprecated ability to pass factories to load.
Player.load and Storage.store used to accept the manifest parser factory
directly.  But now they should only accept the MIME type string.  This
removes the deprecated functionality in preparation for v2.6.

Change-Id: I1b4c5a4a9f0b6edbea909d18111ddc87a39da331
2020-02-20 23:44:51 +00: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
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
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
Joey Parrish a48f8792a9 Move test-only method to test utils
This method should probably never have been in the library, since it
creates a fixed-sized, muted element.

Change-Id: I53b474305465bef34d43ce40ec5e7dedceb20a25
2020-01-06 18:57:28 +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
Jacob Trimble c0e7a9b62a Use callbacks for ManifestGenerator.
This allows us to avoid suppressing the indentation rules and ensures
we have correct indentation.  It also makes it harder to make mistakes
since the variables are only accessible within the callback and you
can't accidentally contaminate another object with an incorrect call.

Closes #1692

Change-Id: Ic38b5cd57a2587dfc8c115ba782656c15565b655
2019-09-04 22:51:12 +00:00
Sandra Lokshina 827e5d813f Support setting source through HTML
Issue #2088.

Change-Id: Ib0ee45e4b5e6b0f6bcdd8b76f26ddd0cfa972a03
2019-08-28 18:34:51 +00:00
Jacob Trimble e2103d236a Fix resolution test on Chromecast.
We filter out tracks that aren't supported on the platform.  For
Chromecast, we filter out high resolution tracks and 6-channel audio
(MediaSource reports no support).  This caused our UI resolution test
to fail since the tracks no longer existed.

Change-Id: Ib56ab1ade09a491011d499587b355bcd3a5183da
Fixes: 139733198
2019-08-20 22:51:53 +00:00
Jacob Trimble d44430e66e Fix duplicate resolution entries in UI menu.
Closes #2085

Change-Id: Idfdcd0cf89f43bd6a624afbb88e504d7653c9ae3
2019-08-16 18:32:28 +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 fd0dc8a5cc Add utility for looping from 0 to n.
Closes #1518

Change-Id: I865f7a0311516d04ae84532dab873e1aaa31eb24
2019-07-10 21:23:22 +00:00