@v360-tech/v360-player 1.7.2 → 2.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/README.md CHANGED
@@ -7,11 +7,13 @@ A lightweight, customizable HLS video player web component with built-in control
7
7
  - HLS (HTTP Live Streaming) video playback
8
8
  - Built-in controls with optimized icons
9
9
  - Responsive design
10
- - Dynamic controls handling based on video background color (dark or light)
10
+ - Dark and light themes for the player background and controls
11
11
  - Customizable playback speeds
12
12
  - Time display options
13
13
  - Progress bar with seek functionality
14
- - Fullscreen support
14
+ - Fullscreen of the whole player, controls included, with an overlay slot for a logo
15
+ - Optional mute/volume control; falls back to muted autoplay when sound is blocked
16
+ - Attributes can change at any time, for example `src` to switch videos
15
17
  - Optional auto-hiding controls that appear on mouse movement or tap, and stay up while paused
16
18
  - Cross-browser compatibility with native HLS fallback for Safari
17
19
 
@@ -21,7 +23,7 @@ A lightweight, customizable HLS video player web component with built-in control
21
23
 
22
24
  ```bash
23
25
  # Install the package and its peer dependencies
24
- yarn add @v360-tech/v360-player hls.js jquery
26
+ yarn add @v360-tech/v360-player hls.js
25
27
  ```
26
28
 
27
29
  ```typescript
@@ -32,8 +34,8 @@ import "@v360-tech/v360-player";
32
34
  ```html
33
35
  <!-- Use in your HTML -->
34
36
  <v360-player
35
- video-src="path/to/video.m3u8"
36
- poster-src="path/to/poster.jpg"
37
+ src="path/to/video.m3u8"
38
+ poster="path/to/poster.jpg"
37
39
  show-time-display
38
40
  show-speed-control
39
41
  >
@@ -44,14 +46,14 @@ import "@v360-tech/v360-player";
44
46
 
45
47
  ```html
46
48
  <!-- Include from CDN (all dependencies bundled) -->
47
- <script src="https://unpkg.com/@v360-tech/v360-player@1.7.1/dist/v360-player.browser.js"></script>
49
+ <script src="https://unpkg.com/@v360-tech/v360-player@2.0.0/dist/v360-player.browser.js"></script>
48
50
  <!-- OR -->
49
- <script src="https://cdn.jsdelivr.net/npm/@v360-tech/v360-player@1.7.1/dist/v360-player.browser.js"></script>
51
+ <script src="https://cdn.jsdelivr.net/npm/@v360-tech/v360-player@2.0.0/dist/v360-player.browser.js"></script>
50
52
 
51
53
  <!-- Use immediately -->
52
54
  <v360-player
53
- video-src="path/to/video.m3u8"
54
- poster-src="path/to/poster.jpg"
55
+ src="path/to/video.m3u8"
56
+ poster="path/to/poster.jpg"
55
57
  show-time-display
56
58
  show-speed-control
57
59
  >
@@ -63,56 +65,160 @@ import "@v360-tech/v360-player";
63
65
  ```html
64
66
  <!-- Full-featured player -->
65
67
  <v360-player
66
- video-src="path/to/video.m3u8"
67
- poster-src="path/to/poster.jpg"
68
+ src="path/to/video.m3u8"
69
+ poster="path/to/poster.jpg"
68
70
  width="720px"
69
- auto-play
71
+ autoplay
70
72
  show-time-display
71
73
  show-speed-control
72
- playback-speeds="0.5,1,1.5,2"
73
- default-speed="1"
74
+ playback-rates="0.5,1,1.5,2"
75
+ default-playback-rate="1"
74
76
  progress-bar-style="dual-layer"
75
- background="dark"
77
+ theme="dark"
76
78
  auto-hide-controls
79
+ show-volume-control
80
+ muted
81
+ loop
77
82
  >
83
+ <img slot="overlay" src="path/to/logo.png" alt="" class="player-logo" />
78
84
  </v360-player>
79
85
  ```
80
86
 
81
- ### Properties
87
+ ### Attributes
88
+
89
+ | Attribute | Type | Default | Description | Possible Values |
90
+ | ----------------------- | ------- | ------------------------------ | ----------------------------------- | -------------------------------------------------------- |
91
+ | `src` | string | required | URL to the HLS (.m3u8) video stream | Any valid URL |
92
+ | `poster` | string | `""` | URL to the poster image | Any valid URL |
93
+ | `width` | string | `"100%"` | Maximum width of the player | CSS width (`"100%"`, `"800px"`) or pixels (`"800"`) |
94
+ | `autoplay` | boolean | `false` | Start playing on load (see below) | Present to enable (no value) |
95
+ | `muted` | boolean | `false` | Start without sound (see below) | Present to enable (no value) |
96
+ | `loop` | boolean | `false` | Restart the video when it ends | Present to enable (no value) |
97
+ | `show-time-display` | boolean | `false` | Show current time and duration | Present to enable (no value) |
98
+ | `show-speed-control` | boolean | `false` | Show playback speed control | Present to enable (no value) |
99
+ | `show-volume-control` | boolean | `false` | Show mute button and volume slider | Present to enable (no value) |
100
+ | `hide-fullscreen` | boolean | `false` | Hide the fullscreen button | Present to enable (no value) |
101
+ | `playback-rates` | string | `"0.25,0.5,0.75,1,1.25,1.5,2"` | Comma-separated list of speeds | Comma-separated numbers |
102
+ | `default-playback-rate` | number | `1` | Starting playback speed (see below) | One of the values from `playback-rates` |
103
+ | `default-quality` | number | `-1` | Starting HLS quality (-1 for auto) | `-1` or an HLS level index (0, 1, …) |
104
+ | `progress-bar-style` | string | `"none"` | Progress bar style variant | `"none"`, `"dual-layer"`, `"segments"`, `"minimal-wave"` |
105
+ | `theme` | string | `"dark"` | Player background and control colors | `"dark"`, `"light"` |
106
+ | `auto-hide-controls` | boolean | `false` | Auto-hide controls (see below) | Present to enable (no value) |
107
+ | `debug` | boolean | `false` | Log diagnostics (see below) | Present to enable (no value) |
108
+
109
+ Boolean attributes are enabled by being present, for example `<v360-player autoplay>`. Any value, including `"false"`, still enables them; remove the attribute to disable.
110
+
111
+ ### JS properties
112
+
113
+ Each attribute has a JS property that reads and changes it, as on `<video>`. The property name is the attribute name in camelCase: `src`, `poster`, `width`, `autoplay`, `muted`, `loop`, `showTimeDisplay`, `showSpeedControl`, `showVolumeControl`, `hideFullscreen`, `playbackRates`, `defaultPlaybackRate`, `defaultQuality`, `progressBarStyle`, `theme`, `autoHideControls` and `debug`.
114
+
115
+ ```js
116
+ const player = document.querySelector("v360-player");
117
+ player.src = "path/to/other.m3u8"; // loads the new video
118
+ player.loop = true;
119
+ player.theme = "light";
120
+ ```
121
+
122
+ - Boolean properties add or remove the attribute. In a framework, bind the property, or pass `null`/`undefined` to leave the attribute out. Binding `false` to the attribute renders `="false"`, which enables it.
123
+ - Setting a string property to `null` or `undefined` removes the attribute.
124
+ - `muted` reads the attribute, like `video.defaultMuted`, not whether the video is muted right now. It stays `false` after the viewer mutes or the player falls back to muted autoplay.
125
+ - `theme` and `progressBarStyle` read back the value in use, so an invalid value reads as `"dark"` or `"none"`. `defaultPlaybackRate` and `defaultQuality` read back numbers.
82
126
 
83
- | Property | Type | Default | Description | Possible Values |
84
- | -------------------- | ------- | ------------------------------ | ----------------------------------- | -------------------------------------------------------- |
85
- | `video-src` | string | required | URL to the HLS (.m3u8) video stream | Any valid URL |
86
- | `poster-src` | string | `""` | URL to the poster image | Any valid URL |
87
- | `width` | string | `"100%"` | Width of the video player | CSS width value (e.g., `"100%"`, `"800px"`) |
88
- | `auto-play` | boolean | `false` | Enable autoplay | Present to enable (no value) |
89
- | `show-time-display` | boolean | `false` | Show current time and duration | Present to enable (no value) |
90
- | `show-speed-control` | boolean | `false` | Show playback speed control | Present to enable (no value) |
91
- | `playback-speeds` | string | `"0.25,0.5,0.75,1,1.25,1.5,2"` | Comma-separated list of speeds | Comma-separated numbers |
92
- | `default-speed` | string | `"1"` | Default playback speed (see below) | One of the values from `playback-speeds` |
93
- | `default-quality` | string | `"-1"` | Default HLS quality (-1 for auto) | `-1` or positive integer |
94
- | `progress-bar-style` | string | `"none"` | Progress bar style variant | `"none"`, `"dual-layer"`, `"segments"`, `"minimal-wave"` |
95
- | `background` | string | `dark` | Video background | `dark`, `light` |
96
- | `auto-hide-controls` | boolean | `false` | Auto-hide controls (see below) | Present to enable (no value) |
97
- | `debug` | boolean | `false` | Log diagnostics (see below) | Present to enable (no value) |
127
+ With `auto-hide-controls`, the controls are hidden until the mouse moves over the player and hide again after 3 seconds without movement or when the mouse leaves. On touch devices, a tap shows them for 3 seconds. They stay visible while the video is paused, while the mouse rests on them, and while a control has keyboard focus.
98
128
 
99
- Boolean attributes are enabled by being present, for example `<v360-player auto-play>`. Any value, including `"false"`, still enables them; remove the attribute to disable.
129
+ Invalid entries in `playback-rates` are ignored. If `default-playback-rate` is not one of the listed speeds, the player starts at 1x, or at the first listed speed when 1x is not listed.
100
130
 
101
- Each boolean attribute also has a JS property that adds or removes it: `autoPlay`, `showTimeDisplay`, `showSpeedControl`, `autoHideControls` and `debug`, for example `player.autoHideControls = false`. In a framework, bind the property, or pass `null`/`undefined` to leave the attribute out. Binding `false` to the attribute renders `="false"`, which enables it.
131
+ ### Changing attributes
102
132
 
103
- With `auto-hide-controls`, the controls are hidden until the mouse moves over the player and hide again after 3 seconds without movement or when the mouse leaves. On touch devices, a tap shows them for 3 seconds. They stay visible while the video is paused, while the mouse rests on them, and while a control has keyboard focus.
133
+ Attributes can be changed after the player is on the page; there's no need to remove and re-add it.
134
+
135
+ - `src` loads the new video into the same player. If a video was playing, or `autoplay` is set, the new one starts playing.
136
+ - `poster`, `width`, `theme`, `progress-bar-style`, `muted`, `loop` and the control attributes (`show-time-display`, `show-speed-control`, `show-volume-control`, `hide-fullscreen`) apply immediately, without interrupting playback.
137
+ - `playback-rates` and `default-playback-rate` apply immediately and reset the speed to the default.
138
+ - `autoplay` and `default-quality` apply to the next `src` load.
139
+
140
+ ### Fullscreen
141
+
142
+ The fullscreen button makes the whole player fullscreen, so the controls and the overlay stay visible.
143
+
144
+ - On iPhone, which can only show the video itself fullscreen, the button opens the native iOS player; the player's own controls and overlay aren't shown there.
145
+ - The button is hidden where fullscreen isn't allowed, such as in a cross-origin iframe without `allow="fullscreen"`. Add `hide-fullscreen` to hide it everywhere.
146
+
147
+ ### Overlay
148
+
149
+ Content in the `overlay` slot is shown over the video, below the controls, and stays visible in fullscreen. Position it with your own CSS:
150
+
151
+ ```html
152
+ <v360-player src="video.m3u8">
153
+ <img slot="overlay" src="logo.png" alt="" class="player-logo" />
154
+ </v360-player>
155
+
156
+ <style>
157
+ .player-logo {
158
+ position: absolute;
159
+ top: 12px;
160
+ right: 12px;
161
+ width: 64px;
162
+ }
163
+ </style>
164
+ ```
165
+
166
+ Clicks pass through the overlay to the player. Give the slotted element `pointer-events: auto` to make it clickable, for example a link.
104
167
 
105
- Invalid entries in `playback-speeds` are ignored. If `default-speed` is not one of the listed speeds, the player starts at 1x, or at the first listed speed when 1x is not listed.
168
+ ### Sound and autoplay
169
+
170
+ Like `<video>`, the player starts with sound unless `muted` is set.
171
+
172
+ - Browsers usually block autoplay with sound. With `autoplay` and without `muted`, the player then plays muted instead; with `show-volume-control`, the button shows as muted so the viewer can tap it. Add `muted` to start muted on purpose. Without `autoplay`, the viewer's click on play allows sound.
173
+ - `show-volume-control` adds a mute/unmute button and a volume slider. iOS doesn't let pages change the volume, so there's only the button.
174
+ - `loop` restarts the video when it ends; by default it plays once.
175
+
176
+ ### Debugging
106
177
 
107
178
  `debug` is off by default. When on, the player logs its startup, HLS events, recovery attempts and autoplay results with `console.debug`. Without it, the player logs only one `console.error`, when playback finally fails; the player then shows "Video unavailable" over the poster.
108
179
 
180
+ ### Styling
181
+
182
+ Set `--v360-player-background` on the player to change the color behind the video (default `#000`, or `#fff` with `theme="light"`):
183
+
184
+ ```css
185
+ v360-player {
186
+ --v360-player-background: #111;
187
+ }
188
+ ```
189
+
190
+ ## Migrating from 1.x
191
+
192
+ 2.0 renames attributes to match `<video>`. The old names no longer work.
193
+
194
+ | 1.x | 2.0 |
195
+ | ------------------------- | ------------------------- |
196
+ | `video-src` | `src` |
197
+ | `poster-src` | `poster` |
198
+ | `auto-play` / `autoPlay` | `autoplay` / `autoplay` |
199
+ | `unmuted` / `unmuted` | remove it; add `muted` / `muted` to start muted |
200
+ | `no-loop` / `noLoop` | remove it; add `loop` / `loop` to loop |
201
+ | `background` | `theme` |
202
+ | `playback-speeds` | `playback-rates` |
203
+ | `default-speed` | `default-playback-rate` |
204
+ | `--player-bg` (CSS) | `--v360-player-background` |
205
+
206
+ The player logs a `console.warn` for each 1.x attribute it finds.
207
+
208
+ The undocumented `--control-bg` and `--control-color` CSS variables were removed.
209
+
210
+ Two defaults changed:
211
+
212
+ - **Sound:** the player now starts with sound. Add `muted` to keep 1.x behavior. Autoplay still works without it, because the player falls back to muted playback when the browser blocks sound.
213
+ - **Looping:** the player now plays once. Add `loop` to keep 1.x behavior.
214
+
109
215
  ## Build Types
110
216
 
111
217
  This package provides two optimized builds:
112
218
 
113
219
  1. **ES Module Build** (`v360-player.js`):
114
220
  - For use with modern bundlers (Vite, Webpack, Rollup, etc.)
115
- - External dependencies (hls.js, jquery) for better tree-shaking
221
+ - External dependency (hls.js) for better tree-shaking
116
222
  - Smaller bundle size when used with bundlers
117
223
 
118
224
  2. **Browser Build** (`v360-player.browser.js`):
@@ -133,8 +239,8 @@ import "@v360-tech/v360-player";
133
239
  export default function VideoPlayer() {
134
240
  return (
135
241
  <v360-player
136
- video-src="video.m3u8"
137
- poster-src="poster.jpg"
242
+ src="video.m3u8"
243
+ poster="poster.jpg"
138
244
  show-time-display
139
245
  show-speed-control
140
246
  />
@@ -147,8 +253,8 @@ export default function VideoPlayer() {
147
253
  ```vue
148
254
  <template>
149
255
  <v360-player
150
- video-src="video.m3u8"
151
- poster-src="poster.jpg"
256
+ src="video.m3u8"
257
+ poster="poster.jpg"
152
258
  show-time-display
153
259
  show-speed-control
154
260
  />
@@ -167,8 +273,8 @@ import "@v360-tech/v360-player";
167
273
  </script>
168
274
 
169
275
  <v360-player
170
- video-src="video.m3u8"
171
- poster-src="poster.jpg"
276
+ src="video.m3u8"
277
+ poster="poster.jpg"
172
278
  show-time-display
173
279
  show-speed-control
174
280
  />
@@ -177,27 +283,27 @@ import "@v360-tech/v360-player";
177
283
  ### Minimal Player
178
284
 
179
285
  ```html
180
- <v360-player video-src="video.m3u8"></v360-player>
286
+ <v360-player src="video.m3u8"></v360-player>
181
287
  ```
182
288
 
183
289
  ### With Time Display
184
290
 
185
291
  ```html
186
- <v360-player video-src="video.m3u8" show-time-display> </v360-player>
292
+ <v360-player src="video.m3u8" show-time-display> </v360-player>
187
293
  ```
188
294
 
189
295
  ### Full-Featured Player
190
296
 
191
297
  ```html
192
298
  <v360-player
193
- video-src="video.m3u8"
194
- poster-src="poster.jpg"
299
+ src="video.m3u8"
300
+ poster="poster.jpg"
195
301
  width="800px"
196
- auto-play
302
+ autoplay
197
303
  show-time-display
198
304
  show-speed-control
199
- playback-speeds="0.5,1,1.5,2"
200
- default-speed="1"
305
+ playback-rates="0.5,1,1.5,2"
306
+ default-playback-rate="1"
201
307
  progress-bar-style="dual-layer"
202
308
  >
203
309
  </v360-player>
@@ -209,10 +315,10 @@ The player offers different progress bar styles through the `progress-bar-style`
209
315
 
210
316
  #### none (default)
211
317
 
212
- Basic progress bar with simple fill indicator.
318
+ No progress bar.
213
319
 
214
320
  ```html
215
- <v360-player video-src="video.m3u8" progress-bar-style="none"></v360-player>
321
+ <v360-player src="video.m3u8" progress-bar-style="none"></v360-player>
216
322
  ```
217
323
 
218
324
  #### dual-layer
@@ -221,7 +327,7 @@ Shows buffer progress and includes a draggable handle.
221
327
 
222
328
  ```html
223
329
  <v360-player
224
- video-src="video.m3u8"
330
+ src="video.m3u8"
225
331
  progress-bar-style="dual-layer"
226
332
  ></v360-player>
227
333
  ```
@@ -231,7 +337,7 @@ Shows buffer progress and includes a draggable handle.
231
337
  Divides the progress into clickable segments.
232
338
 
233
339
  ```html
234
- <v360-player video-src="video.m3u8" progress-bar-style="segments"></v360-player>
340
+ <v360-player src="video.m3u8" progress-bar-style="segments"></v360-player>
235
341
  ```
236
342
 
237
343
  #### minimal-wave
@@ -240,7 +346,7 @@ Clean style with an animated wave indicator.
240
346
 
241
347
  ```html
242
348
  <v360-player
243
- video-src="video.m3u8"
349
+ src="video.m3u8"
244
350
  progress-bar-style="minimal-wave"
245
351
  ></v360-player>
246
352
  ```
@@ -290,7 +396,7 @@ The player uses:
290
396
  - Custom controls with playback speed adjustment
291
397
  - Progress bar with seek functionality
292
398
  - Fullscreen mode support
293
- - Dynamic controls handling based on video background color (dark or light)
399
+ - Dark and light themes for the player background and controls
294
400
 
295
401
  ## License
296
402
 
@@ -0,0 +1,82 @@
1
+ import { ProgressBarStyle } from '../styles/progress-bar';
2
+ export declare class V360Player extends HTMLElement {
3
+ private readonly autoHide;
4
+ private _video?;
5
+ private _stream?;
6
+ private _playbackRates;
7
+ private _playbackRateIndex;
8
+ private _fullscreenMode;
9
+ constructor();
10
+ private static readonly reflectedProperties;
11
+ private reflect;
12
+ get src(): string;
13
+ set src(value: string | null | undefined);
14
+ get poster(): string;
15
+ set poster(value: string | null | undefined);
16
+ get width(): string;
17
+ set width(value: string | null | undefined);
18
+ get theme(): 'dark' | 'light';
19
+ set theme(value: string | null | undefined);
20
+ get playbackRates(): string;
21
+ set playbackRates(value: string | null | undefined);
22
+ get defaultPlaybackRate(): number;
23
+ set defaultPlaybackRate(value: number | string | null | undefined);
24
+ get defaultQuality(): number;
25
+ set defaultQuality(value: number | string | null | undefined);
26
+ get progressBarStyle(): ProgressBarStyle;
27
+ set progressBarStyle(value: string | null | undefined);
28
+ get autoplay(): boolean;
29
+ set autoplay(value: boolean);
30
+ get muted(): boolean;
31
+ set muted(value: boolean);
32
+ get loop(): boolean;
33
+ set loop(value: boolean);
34
+ get showTimeDisplay(): boolean;
35
+ set showTimeDisplay(value: boolean);
36
+ get showSpeedControl(): boolean;
37
+ set showSpeedControl(value: boolean);
38
+ get showVolumeControl(): boolean;
39
+ set showVolumeControl(value: boolean);
40
+ get autoHideControls(): boolean;
41
+ set autoHideControls(value: boolean);
42
+ get hideFullscreen(): boolean;
43
+ set hideFullscreen(value: boolean);
44
+ get debug(): boolean;
45
+ set debug(value: boolean);
46
+ private log;
47
+ private fail;
48
+ private clearError;
49
+ private upgradeProperties;
50
+ static get observedAttributes(): string[];
51
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
52
+ private static readonly legacyAttributes;
53
+ private warnLegacyAttributes;
54
+ connectedCallback(): void;
55
+ disconnectedCallback(): void;
56
+ private render;
57
+ private loadSrc;
58
+ private applyPoster;
59
+ private applyWidth;
60
+ private applyTheme;
61
+ private applyMuted;
62
+ private applyPlaybackRates;
63
+ private setPlaybackRate;
64
+ private renderControlBar;
65
+ private renderProgressBar;
66
+ private applyProgressStyles;
67
+ private listenToVideo;
68
+ private listenToControls;
69
+ private play;
70
+ private pause;
71
+ private step;
72
+ private seek;
73
+ private nextPlaybackRate;
74
+ private toggleMute;
75
+ private toggleFullscreen;
76
+ private updatePlayPauseButton;
77
+ private updateProgress;
78
+ private updateDuration;
79
+ private updateSpeedButton;
80
+ private updateVolumeControl;
81
+ private updateFullscreenButton;
82
+ }
@@ -4,6 +4,9 @@ export declare const icons: {
4
4
  forward: string;
5
5
  backward: string;
6
6
  fullscreen: string;
7
+ exitFullscreen: string;
8
+ volume: string;
9
+ volumeMuted: string;
7
10
  'speed-0.50': string;
8
11
  'speed-1.00': string;
9
12
  'speed-1.50': string;
@@ -1,3 +1,3 @@
1
1
  import './style.css';
2
- import './components/V360Player';
3
- export { V360Player } from './components/V360Player';
2
+ import './components/v360-player';
3
+ export { V360Player } from './components/v360-player';
@@ -0,0 +1,17 @@
1
+ export interface AutoHideOptions {
2
+ enabled: () => boolean;
3
+ paused: () => boolean;
4
+ }
5
+ export declare class AutoHideController {
6
+ private static readonly hideDelay;
7
+ private readonly root;
8
+ private readonly options;
9
+ private timer?;
10
+ private pointerOverControls;
11
+ constructor(root: ShadowRoot, options: AutoHideOptions);
12
+ show(): void;
13
+ schedule(): void;
14
+ hide(): void;
15
+ cancel(): void;
16
+ private container;
17
+ }
@@ -0,0 +1 @@
1
+ export declare function formatTime(seconds: number): string;
@@ -0,0 +1,4 @@
1
+ export type FullscreenMode = 'element' | 'video' | 'none';
2
+ export declare function fullscreenMode(host: HTMLElement, video: HTMLVideoElement): FullscreenMode;
3
+ export declare function isFullscreen(host: HTMLElement): boolean;
4
+ export declare function toggleFullscreen(host: HTMLElement, video: HTMLVideoElement, mode: FullscreenMode): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import type { Logger } from './types';
2
+ export declare const defaultPlaybackRates: number[];
3
+ export declare function parsePlaybackRates(attr: string | null, log: Logger): number[];
4
+ export declare function defaultPlaybackRateIndex(rates: number[], defaultRate: number): number;
@@ -0,0 +1,29 @@
1
+ import type { Logger } from './types';
2
+ export interface StreamOptions {
3
+ autoplay: boolean;
4
+ startLevel: number;
5
+ }
6
+ export interface StreamCallbacks {
7
+ log: Logger;
8
+ onFail: (reason: string) => void;
9
+ }
10
+ export declare class StreamController {
11
+ private readonly video;
12
+ private readonly callbacks;
13
+ private options;
14
+ private hls?;
15
+ private loadId;
16
+ private failed;
17
+ private manifestParsed;
18
+ private networkRetried;
19
+ private mediaRecoveries;
20
+ private streamLoaded;
21
+ constructor(video: HTMLVideoElement, callbacks: StreamCallbacks);
22
+ load(src: string, options: StreamOptions): void;
23
+ unload(): void;
24
+ startLoad(): void;
25
+ destroy(): void;
26
+ autoplay(): void;
27
+ private fail;
28
+ private loadHls;
29
+ }
@@ -0,0 +1 @@
1
+ export declare const baseStyles = "\n :host {\n display: block;\n }\n .video-container {\n position: relative;\n width: 100%;\n background: var(--v360-player-background, #000);\n overflow: hidden;\n margin: 0 auto;\n }\n /* Always in the accessibility tree (no display: none) so the role=\"alert\" text\n set by fail() is announced. Empty and transparent until then. */\n .error-message {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 16px;\n text-align: center;\n color: #fff;\n font-family: system-ui, -apple-system, sans-serif;\n font-size: 16px;\n z-index: 2;\n pointer-events: none;\n }\n /* Holds the overlay slot (e.g. a logo) above the video and below the controls.\n Clicks pass through unless the slotted element sets pointer-events itself. */\n .overlay {\n position: absolute;\n inset: 0;\n z-index: 1;\n pointer-events: none;\n }\n /* The whole player is the fullscreen element, so the controls and overlay stay.\n The prefixed rule is separate: a selector list with an unknown pseudo-class is dropped. */\n :host(:fullscreen) .video-container {\n max-width: none !important;\n height: 100%;\n }\n :host(:-webkit-full-screen) .video-container {\n max-width: none !important;\n height: 100%;\n }\n .video-container.has-error .error-message {\n background: rgba(0, 0, 0, 0.6);\n }\n .video-container.has-error #control-bar {\n display: none;\n }\n .video-container svg {\n fill: #fff;\n }\n .video-container img {\n filter: invert(1) brightness(100);\n }\n .video-container.light-theme {\n background: var(--v360-player-background, #fff);\n }\n .video-container.light-theme svg {\n fill: #000;\n }\n .video-container.light-theme img {\n filter: none;\n }\n .video-container.light-theme #control-bar {\n background: linear-gradient(transparent, rgba(255, 255, 255, 0.7));\n }\n .video-container:not(.light-theme) #control-bar {\n background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));\n }\n video {\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n #control-bar {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n display: flex;\n flex-direction: column;\n padding: 10px;\n gap: 10px;\n z-index: 1;\n transition: opacity 0.3s ease, transform 0.3s ease;\n }\n /* opacity + pointer-events (not visibility: hidden) so the buttons stay\n keyboard-focusable and :focus-visible can reveal the bar. */\n :host([auto-hide-controls]) #control-bar {\n opacity: 0;\n pointer-events: none;\n transform: translateY(8px);\n }\n /* .controls-visible is toggled by setupAutoHide() for mouse movement and taps. */\n :host([auto-hide-controls]) .video-container.controls-visible #control-bar {\n opacity: 1;\n pointer-events: auto;\n transform: none;\n }\n /* Kept in its own rule: browsers without :has() drop the whole selector list,\n which would also disable the rule above.\n :focus-visible (not :focus-within) so a mouse click on a button doesn't pin the bar open. */\n :host([auto-hide-controls]) .video-container:has(:focus-visible) #control-bar {\n opacity: 1;\n pointer-events: auto;\n transform: none;\n }\n @media (prefers-reduced-motion: reduce) {\n #control-bar {\n transform: none !important;\n }\n }\n #progress-row {\n display: flex;\n align-items: center;\n gap: 10px;\n width: 100%;\n font-size: 14px;\n }\n /* Wrapper so the progress bar can be redrawn alone; display: contents keeps\n .progress-bar a flex item of #progress-row. */\n .progress-track {\n display: contents;\n }\n #controls-row {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n }\n .button {\n background: transparent;\n border: none;\n cursor: pointer;\n padding: 5px;\n display: flex;\n align-items: center;\n }\n .button svg {\n width: 24px;\n height: 24px;\n display: block;\n }\n .button:hover {\n opacity: 0.8;\n }\n .time-display {\n color: #fff;\n font-size: 14px;\n font-family: system-ui, -apple-system, sans-serif;\n opacity: 0.9;\n }\n .light-theme .time-display {\n color: #000;\n }\n .video-controls {\n display: flex;\n align-items: center;\n gap: 8px;\n }\n .speed-control {\n justify-content: center;\n min-width: 34px;\n min-height: 34px;\n border-radius: 4px;\n color: #fff;\n font-size: 14px;\n font-family: system-ui, -apple-system, sans-serif;\n }\n .light-theme .speed-control {\n color: #000;\n }\n .speed-control img,\n .speed-control svg {\n width: 24px;\n height: 24px;\n display: block;\n transition: opacity 0.2s;\n }\n .speed-control:hover img,\n .speed-control:hover svg {\n opacity: 0.7;\n }\n .volume-control {\n display: flex;\n align-items: center;\n gap: 4px;\n }\n .volume-slider {\n width: 80px;\n margin: 0;\n accent-color: #0A84FF;\n cursor: pointer;\n }\n";
@@ -0,0 +1,12 @@
1
+ import { ProgressBarStyle } from '../styles/progress-bar';
2
+ export declare function progressBarTemplate(style: ProgressBarStyle): string;
3
+ export interface ControlBarOptions {
4
+ progressBarStyle: ProgressBarStyle;
5
+ showTimeDisplay: boolean;
6
+ showSpeedControl: boolean;
7
+ showVolumeControl: boolean;
8
+ showVolumeSlider: boolean;
9
+ showFullscreen: boolean;
10
+ }
11
+ export declare function controlBarTemplate(options: ControlBarOptions): string;
12
+ export declare function shellTemplate(): string;
@@ -0,0 +1 @@
1
+ export type Logger = (...args: unknown[]) => void;
@@ -0,0 +1 @@
1
+ export declare function canAdjustVolume(): boolean;