@scarlett-player/ui 0.5.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2498,6 +2498,39 @@ var CaptionsButton = class {
2498
2498
  }
2499
2499
  };
2500
2500
 
2501
+ // src/controls/BandwidthIndicator.ts
2502
+ var ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.55a11 11 0 0 1 14.08 0"/><path d="M1.42 9a16 16 0 0 1 21.16 0"/><path d="M8.53 16.11a6 6 0 0 1 6.95 0"/><line x1="12" y1="20" x2="12.01" y2="20"/><line x1="2" y1="2" x2="22" y2="22" stroke="currentColor" stroke-width="2"/></svg>`;
2503
+ var BandwidthIndicator = class {
2504
+ constructor(api) {
2505
+ this.api = api;
2506
+ this.el = createElement("div", { className: "sp-bandwidth-indicator" });
2507
+ this.el.innerHTML = ICON_SVG;
2508
+ this.el.setAttribute("aria-label", "Bandwidth is limiting video quality");
2509
+ this.el.setAttribute("title", "Bandwidth is limiting video quality");
2510
+ this.el.style.display = "none";
2511
+ }
2512
+ render() {
2513
+ return this.el;
2514
+ }
2515
+ update() {
2516
+ const bandwidth = this.api.getState("bandwidth");
2517
+ const qualities = this.api.getState("qualities");
2518
+ if (!bandwidth || !qualities || qualities.length === 0) {
2519
+ this.el.style.display = "none";
2520
+ return;
2521
+ }
2522
+ const highestBitrate = Math.max(...qualities.map((q) => q.bitrate));
2523
+ if (highestBitrate > 0 && bandwidth < highestBitrate) {
2524
+ this.el.style.display = "";
2525
+ } else {
2526
+ this.el.style.display = "none";
2527
+ }
2528
+ }
2529
+ destroy() {
2530
+ this.el.remove();
2531
+ }
2532
+ };
2533
+
2501
2534
  // src/index.ts
2502
2535
  var DEFAULT_LAYOUT = [
2503
2536
  "play",
@@ -2506,6 +2539,7 @@ var DEFAULT_LAYOUT = [
2506
2539
  "volume",
2507
2540
  "time",
2508
2541
  "live-indicator",
2542
+ "bandwidth-indicator",
2509
2543
  "spacer",
2510
2544
  "settings",
2511
2545
  "captions",
@@ -2546,6 +2580,8 @@ function uiPlugin(config = {}) {
2546
2580
  return new TimeDisplay(api);
2547
2581
  case "live-indicator":
2548
2582
  return new LiveIndicator(api);
2583
+ case "bandwidth-indicator":
2584
+ return new BandwidthIndicator(api);
2549
2585
  case "quality":
2550
2586
  return new QualityMenu(api);
2551
2587
  case "settings":
package/dist/index.d.cts CHANGED
@@ -7,7 +7,7 @@ import { Plugin } from '@scarlett-player/core';
7
7
  /**
8
8
  * Available control slot identifiers.
9
9
  */
10
- type ControlSlot = 'play' | 'skip-backward' | 'skip-forward' | 'volume' | 'progress' | 'time' | 'live-indicator' | 'quality' | 'settings' | 'captions' | 'airplay' | 'chromecast' | 'pip' | 'fullscreen' | 'spacer';
10
+ type ControlSlot = 'play' | 'skip-backward' | 'skip-forward' | 'volume' | 'progress' | 'time' | 'live-indicator' | 'quality' | 'settings' | 'captions' | 'airplay' | 'chromecast' | 'pip' | 'fullscreen' | 'spacer' | 'bandwidth-indicator';
11
11
  /**
12
12
  * Layout configuration for the control bar.
13
13
  */
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import { Plugin } from '@scarlett-player/core';
7
7
  /**
8
8
  * Available control slot identifiers.
9
9
  */
10
- type ControlSlot = 'play' | 'skip-backward' | 'skip-forward' | 'volume' | 'progress' | 'time' | 'live-indicator' | 'quality' | 'settings' | 'captions' | 'airplay' | 'chromecast' | 'pip' | 'fullscreen' | 'spacer';
10
+ type ControlSlot = 'play' | 'skip-backward' | 'skip-forward' | 'volume' | 'progress' | 'time' | 'live-indicator' | 'quality' | 'settings' | 'captions' | 'airplay' | 'chromecast' | 'pip' | 'fullscreen' | 'spacer' | 'bandwidth-indicator';
11
11
  /**
12
12
  * Layout configuration for the control bar.
13
13
  */
package/dist/index.js CHANGED
@@ -2467,6 +2467,39 @@ var CaptionsButton = class {
2467
2467
  }
2468
2468
  };
2469
2469
 
2470
+ // src/controls/BandwidthIndicator.ts
2471
+ var ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12.55a11 11 0 0 1 14.08 0"/><path d="M1.42 9a16 16 0 0 1 21.16 0"/><path d="M8.53 16.11a6 6 0 0 1 6.95 0"/><line x1="12" y1="20" x2="12.01" y2="20"/><line x1="2" y1="2" x2="22" y2="22" stroke="currentColor" stroke-width="2"/></svg>`;
2472
+ var BandwidthIndicator = class {
2473
+ constructor(api) {
2474
+ this.api = api;
2475
+ this.el = createElement("div", { className: "sp-bandwidth-indicator" });
2476
+ this.el.innerHTML = ICON_SVG;
2477
+ this.el.setAttribute("aria-label", "Bandwidth is limiting video quality");
2478
+ this.el.setAttribute("title", "Bandwidth is limiting video quality");
2479
+ this.el.style.display = "none";
2480
+ }
2481
+ render() {
2482
+ return this.el;
2483
+ }
2484
+ update() {
2485
+ const bandwidth = this.api.getState("bandwidth");
2486
+ const qualities = this.api.getState("qualities");
2487
+ if (!bandwidth || !qualities || qualities.length === 0) {
2488
+ this.el.style.display = "none";
2489
+ return;
2490
+ }
2491
+ const highestBitrate = Math.max(...qualities.map((q) => q.bitrate));
2492
+ if (highestBitrate > 0 && bandwidth < highestBitrate) {
2493
+ this.el.style.display = "";
2494
+ } else {
2495
+ this.el.style.display = "none";
2496
+ }
2497
+ }
2498
+ destroy() {
2499
+ this.el.remove();
2500
+ }
2501
+ };
2502
+
2470
2503
  // src/index.ts
2471
2504
  var DEFAULT_LAYOUT = [
2472
2505
  "play",
@@ -2475,6 +2508,7 @@ var DEFAULT_LAYOUT = [
2475
2508
  "volume",
2476
2509
  "time",
2477
2510
  "live-indicator",
2511
+ "bandwidth-indicator",
2478
2512
  "spacer",
2479
2513
  "settings",
2480
2514
  "captions",
@@ -2515,6 +2549,8 @@ function uiPlugin(config = {}) {
2515
2549
  return new TimeDisplay(api);
2516
2550
  case "live-indicator":
2517
2551
  return new LiveIndicator(api);
2552
+ case "bandwidth-indicator":
2553
+ return new BandwidthIndicator(api);
2518
2554
  case "quality":
2519
2555
  return new QualityMenu(api);
2520
2556
  case "settings":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scarlett-player/ui",
3
- "version": "0.5.3",
3
+ "version": "1.0.0",
4
4
  "description": "UI Controls Plugin for Scarlett Player",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -22,14 +22,14 @@
22
22
  "dist"
23
23
  ],
24
24
  "peerDependencies": {
25
- "@scarlett-player/core": "^0.5.3"
25
+ "@scarlett-player/core": "^1.0.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "tsup": "^8.0.0",
29
29
  "typescript": "^5.3.0",
30
30
  "vitest": "^1.6.0",
31
31
  "jsdom": "^24.0.0",
32
- "@scarlett-player/core": "0.5.3"
32
+ "@scarlett-player/core": "1.0.0"
33
33
  },
34
34
  "keywords": [
35
35
  "video",