@v360-tech/v360-player 1.8.0 → 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 +119 -70
- package/dist/types/components/v360-player.d.ts +34 -15
- package/dist/types/player/playback-rates.d.ts +4 -0
- package/dist/types/player/stream-controller.d.ts +1 -1
- package/dist/types/player/styles.d.ts +1 -1
- package/dist/v360-player.browser.js +14 -17
- package/dist/v360-player.js +220 -141
- package/package.json +1 -1
- package/dist/types/player/speeds.d.ts +0 -4
package/README.md
CHANGED
|
@@ -7,13 +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
|
-
-
|
|
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
14
|
- Fullscreen of the whole player, controls included, with an overlay slot for a logo
|
|
15
|
-
- Optional mute/volume control; muted autoplay
|
|
16
|
-
- Attributes can change at any time, for example `
|
|
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
|
|
17
17
|
- Optional auto-hiding controls that appear on mouse movement or tap, and stay up while paused
|
|
18
18
|
- Cross-browser compatibility with native HLS fallback for Safari
|
|
19
19
|
|
|
@@ -34,8 +34,8 @@ import "@v360-tech/v360-player";
|
|
|
34
34
|
```html
|
|
35
35
|
<!-- Use in your HTML -->
|
|
36
36
|
<v360-player
|
|
37
|
-
|
|
38
|
-
poster
|
|
37
|
+
src="path/to/video.m3u8"
|
|
38
|
+
poster="path/to/poster.jpg"
|
|
39
39
|
show-time-display
|
|
40
40
|
show-speed-control
|
|
41
41
|
>
|
|
@@ -46,14 +46,14 @@ import "@v360-tech/v360-player";
|
|
|
46
46
|
|
|
47
47
|
```html
|
|
48
48
|
<!-- Include from CDN (all dependencies bundled) -->
|
|
49
|
-
<script src="https://unpkg.com/@v360-tech/v360-player@
|
|
49
|
+
<script src="https://unpkg.com/@v360-tech/v360-player@2.0.0/dist/v360-player.browser.js"></script>
|
|
50
50
|
<!-- OR -->
|
|
51
|
-
<script src="https://cdn.jsdelivr.net/npm/@v360-tech/v360-player@
|
|
51
|
+
<script src="https://cdn.jsdelivr.net/npm/@v360-tech/v360-player@2.0.0/dist/v360-player.browser.js"></script>
|
|
52
52
|
|
|
53
53
|
<!-- Use immediately -->
|
|
54
54
|
<v360-player
|
|
55
|
-
|
|
56
|
-
poster
|
|
55
|
+
src="path/to/video.m3u8"
|
|
56
|
+
poster="path/to/poster.jpg"
|
|
57
57
|
show-time-display
|
|
58
58
|
show-speed-control
|
|
59
59
|
>
|
|
@@ -65,63 +65,77 @@ import "@v360-tech/v360-player";
|
|
|
65
65
|
```html
|
|
66
66
|
<!-- Full-featured player -->
|
|
67
67
|
<v360-player
|
|
68
|
-
|
|
69
|
-
poster
|
|
68
|
+
src="path/to/video.m3u8"
|
|
69
|
+
poster="path/to/poster.jpg"
|
|
70
70
|
width="720px"
|
|
71
|
-
|
|
71
|
+
autoplay
|
|
72
72
|
show-time-display
|
|
73
73
|
show-speed-control
|
|
74
|
-
playback-
|
|
75
|
-
default-
|
|
74
|
+
playback-rates="0.5,1,1.5,2"
|
|
75
|
+
default-playback-rate="1"
|
|
76
76
|
progress-bar-style="dual-layer"
|
|
77
|
-
|
|
77
|
+
theme="dark"
|
|
78
78
|
auto-hide-controls
|
|
79
79
|
show-volume-control
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
muted
|
|
81
|
+
loop
|
|
82
82
|
>
|
|
83
83
|
<img slot="overlay" src="path/to/logo.png" alt="" class="player-logo" />
|
|
84
84
|
</v360-player>
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
###
|
|
88
|
-
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
| `
|
|
92
|
-
| `poster
|
|
93
|
-
| `width`
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `show-
|
|
98
|
-
| `
|
|
99
|
-
| `
|
|
100
|
-
| `hide-fullscreen`
|
|
101
|
-
| `playback-
|
|
102
|
-
| `default-
|
|
103
|
-
| `default-quality`
|
|
104
|
-
| `progress-bar-style`
|
|
105
|
-
| `
|
|
106
|
-
| `auto-hide-controls`
|
|
107
|
-
| `debug`
|
|
108
|
-
|
|
109
|
-
Boolean attributes are enabled by being present, for example `<v360-player
|
|
110
|
-
|
|
111
|
-
|
|
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.
|
|
112
126
|
|
|
113
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.
|
|
114
128
|
|
|
115
|
-
Invalid entries in `playback-
|
|
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.
|
|
116
130
|
|
|
117
131
|
### Changing attributes
|
|
118
132
|
|
|
119
133
|
Attributes can be changed after the player is on the page; there's no need to remove and re-add it.
|
|
120
134
|
|
|
121
|
-
- `
|
|
122
|
-
- `poster
|
|
123
|
-
- `playback-
|
|
124
|
-
- `
|
|
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.
|
|
125
139
|
|
|
126
140
|
### Fullscreen
|
|
127
141
|
|
|
@@ -135,7 +149,7 @@ The fullscreen button makes the whole player fullscreen, so the controls and the
|
|
|
135
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:
|
|
136
150
|
|
|
137
151
|
```html
|
|
138
|
-
<v360-player
|
|
152
|
+
<v360-player src="video.m3u8">
|
|
139
153
|
<img slot="overlay" src="logo.png" alt="" class="player-logo" />
|
|
140
154
|
</v360-player>
|
|
141
155
|
|
|
@@ -153,16 +167,51 @@ Clicks pass through the overlay to the player. Give the slotted element `pointer
|
|
|
153
167
|
|
|
154
168
|
### Sound and autoplay
|
|
155
169
|
|
|
156
|
-
|
|
170
|
+
Like `<video>`, the player starts with sound unless `muted` is set.
|
|
157
171
|
|
|
158
|
-
-
|
|
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.
|
|
159
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.
|
|
160
|
-
- `
|
|
174
|
+
- `loop` restarts the video when it ends; by default it plays once.
|
|
161
175
|
|
|
162
176
|
### Debugging
|
|
163
177
|
|
|
164
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.
|
|
165
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
|
+
|
|
166
215
|
## Build Types
|
|
167
216
|
|
|
168
217
|
This package provides two optimized builds:
|
|
@@ -190,8 +239,8 @@ import "@v360-tech/v360-player";
|
|
|
190
239
|
export default function VideoPlayer() {
|
|
191
240
|
return (
|
|
192
241
|
<v360-player
|
|
193
|
-
|
|
194
|
-
poster
|
|
242
|
+
src="video.m3u8"
|
|
243
|
+
poster="poster.jpg"
|
|
195
244
|
show-time-display
|
|
196
245
|
show-speed-control
|
|
197
246
|
/>
|
|
@@ -204,8 +253,8 @@ export default function VideoPlayer() {
|
|
|
204
253
|
```vue
|
|
205
254
|
<template>
|
|
206
255
|
<v360-player
|
|
207
|
-
|
|
208
|
-
poster
|
|
256
|
+
src="video.m3u8"
|
|
257
|
+
poster="poster.jpg"
|
|
209
258
|
show-time-display
|
|
210
259
|
show-speed-control
|
|
211
260
|
/>
|
|
@@ -224,8 +273,8 @@ import "@v360-tech/v360-player";
|
|
|
224
273
|
</script>
|
|
225
274
|
|
|
226
275
|
<v360-player
|
|
227
|
-
|
|
228
|
-
poster
|
|
276
|
+
src="video.m3u8"
|
|
277
|
+
poster="poster.jpg"
|
|
229
278
|
show-time-display
|
|
230
279
|
show-speed-control
|
|
231
280
|
/>
|
|
@@ -234,27 +283,27 @@ import "@v360-tech/v360-player";
|
|
|
234
283
|
### Minimal Player
|
|
235
284
|
|
|
236
285
|
```html
|
|
237
|
-
<v360-player
|
|
286
|
+
<v360-player src="video.m3u8"></v360-player>
|
|
238
287
|
```
|
|
239
288
|
|
|
240
289
|
### With Time Display
|
|
241
290
|
|
|
242
291
|
```html
|
|
243
|
-
<v360-player
|
|
292
|
+
<v360-player src="video.m3u8" show-time-display> </v360-player>
|
|
244
293
|
```
|
|
245
294
|
|
|
246
295
|
### Full-Featured Player
|
|
247
296
|
|
|
248
297
|
```html
|
|
249
298
|
<v360-player
|
|
250
|
-
|
|
251
|
-
poster
|
|
299
|
+
src="video.m3u8"
|
|
300
|
+
poster="poster.jpg"
|
|
252
301
|
width="800px"
|
|
253
|
-
|
|
302
|
+
autoplay
|
|
254
303
|
show-time-display
|
|
255
304
|
show-speed-control
|
|
256
|
-
playback-
|
|
257
|
-
default-
|
|
305
|
+
playback-rates="0.5,1,1.5,2"
|
|
306
|
+
default-playback-rate="1"
|
|
258
307
|
progress-bar-style="dual-layer"
|
|
259
308
|
>
|
|
260
309
|
</v360-player>
|
|
@@ -266,10 +315,10 @@ The player offers different progress bar styles through the `progress-bar-style`
|
|
|
266
315
|
|
|
267
316
|
#### none (default)
|
|
268
317
|
|
|
269
|
-
|
|
318
|
+
No progress bar.
|
|
270
319
|
|
|
271
320
|
```html
|
|
272
|
-
<v360-player
|
|
321
|
+
<v360-player src="video.m3u8" progress-bar-style="none"></v360-player>
|
|
273
322
|
```
|
|
274
323
|
|
|
275
324
|
#### dual-layer
|
|
@@ -278,7 +327,7 @@ Shows buffer progress and includes a draggable handle.
|
|
|
278
327
|
|
|
279
328
|
```html
|
|
280
329
|
<v360-player
|
|
281
|
-
|
|
330
|
+
src="video.m3u8"
|
|
282
331
|
progress-bar-style="dual-layer"
|
|
283
332
|
></v360-player>
|
|
284
333
|
```
|
|
@@ -288,7 +337,7 @@ Shows buffer progress and includes a draggable handle.
|
|
|
288
337
|
Divides the progress into clickable segments.
|
|
289
338
|
|
|
290
339
|
```html
|
|
291
|
-
<v360-player
|
|
340
|
+
<v360-player src="video.m3u8" progress-bar-style="segments"></v360-player>
|
|
292
341
|
```
|
|
293
342
|
|
|
294
343
|
#### minimal-wave
|
|
@@ -297,7 +346,7 @@ Clean style with an animated wave indicator.
|
|
|
297
346
|
|
|
298
347
|
```html
|
|
299
348
|
<v360-player
|
|
300
|
-
|
|
349
|
+
src="video.m3u8"
|
|
301
350
|
progress-bar-style="minimal-wave"
|
|
302
351
|
></v360-player>
|
|
303
352
|
```
|
|
@@ -347,7 +396,7 @@ The player uses:
|
|
|
347
396
|
- Custom controls with playback speed adjustment
|
|
348
397
|
- Progress bar with seek functionality
|
|
349
398
|
- Fullscreen mode support
|
|
350
|
-
-
|
|
399
|
+
- Dark and light themes for the player background and controls
|
|
351
400
|
|
|
352
401
|
## License
|
|
353
402
|
|
|
@@ -1,14 +1,36 @@
|
|
|
1
|
+
import { ProgressBarStyle } from '../styles/progress-bar';
|
|
1
2
|
export declare class V360Player extends HTMLElement {
|
|
2
3
|
private readonly autoHide;
|
|
3
4
|
private _video?;
|
|
4
5
|
private _stream?;
|
|
5
|
-
private
|
|
6
|
-
private
|
|
6
|
+
private _playbackRates;
|
|
7
|
+
private _playbackRateIndex;
|
|
7
8
|
private _fullscreenMode;
|
|
8
9
|
constructor();
|
|
9
|
-
private static readonly
|
|
10
|
-
|
|
11
|
-
|
|
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);
|
|
12
34
|
get showTimeDisplay(): boolean;
|
|
13
35
|
set showTimeDisplay(value: boolean);
|
|
14
36
|
get showSpeedControl(): boolean;
|
|
@@ -19,29 +41,26 @@ export declare class V360Player extends HTMLElement {
|
|
|
19
41
|
set autoHideControls(value: boolean);
|
|
20
42
|
get hideFullscreen(): boolean;
|
|
21
43
|
set hideFullscreen(value: boolean);
|
|
22
|
-
get unmuted(): boolean;
|
|
23
|
-
set unmuted(value: boolean);
|
|
24
|
-
get noLoop(): boolean;
|
|
25
|
-
set noLoop(value: boolean);
|
|
26
44
|
get debug(): boolean;
|
|
27
45
|
set debug(value: boolean);
|
|
28
|
-
private get progressBarStyle();
|
|
29
46
|
private log;
|
|
30
47
|
private fail;
|
|
31
48
|
private clearError;
|
|
32
49
|
private upgradeProperties;
|
|
33
50
|
static get observedAttributes(): string[];
|
|
34
51
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
52
|
+
private static readonly legacyAttributes;
|
|
53
|
+
private warnLegacyAttributes;
|
|
35
54
|
connectedCallback(): void;
|
|
36
55
|
disconnectedCallback(): void;
|
|
37
56
|
private render;
|
|
38
|
-
private
|
|
57
|
+
private loadSrc;
|
|
39
58
|
private applyPoster;
|
|
40
59
|
private applyWidth;
|
|
41
60
|
private applyTheme;
|
|
42
61
|
private applyMuted;
|
|
43
|
-
private
|
|
44
|
-
private
|
|
62
|
+
private applyPlaybackRates;
|
|
63
|
+
private setPlaybackRate;
|
|
45
64
|
private renderControlBar;
|
|
46
65
|
private renderProgressBar;
|
|
47
66
|
private applyProgressStyles;
|
|
@@ -51,7 +70,7 @@ export declare class V360Player extends HTMLElement {
|
|
|
51
70
|
private pause;
|
|
52
71
|
private step;
|
|
53
72
|
private seek;
|
|
54
|
-
private
|
|
73
|
+
private nextPlaybackRate;
|
|
55
74
|
private toggleMute;
|
|
56
75
|
private toggleFullscreen;
|
|
57
76
|
private updatePlayPauseButton;
|
|
@@ -59,5 +78,5 @@ export declare class V360Player extends HTMLElement {
|
|
|
59
78
|
private updateDuration;
|
|
60
79
|
private updateSpeedButton;
|
|
61
80
|
private updateVolumeControl;
|
|
62
|
-
private
|
|
81
|
+
private updateFullscreenButton;
|
|
63
82
|
}
|
|
@@ -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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const baseStyles = "\n :host {\n display: block;\n }\n .video-container {\n position: relative;\n width: 100%;\n background: var(--player-
|
|
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";
|