@v360-tech/v360-player 1.4.15 → 1.7.2
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 +26 -13
- package/dist/types/common/constants.d.ts +4 -0
- package/dist/types/components/V360Player.d.ts +61 -0
- package/dist/types/icons/index.d.ts +11 -0
- package/dist/types/main.d.ts +3 -0
- package/dist/types/styles/progressBar.d.ts +13 -0
- package/dist/v360-player.browser.js +118 -77
- package/dist/v360-player.js +322 -181
- package/package.json +10 -9
- package/dist/index.html +0 -0
package/README.md
CHANGED
|
@@ -6,12 +6,13 @@ A lightweight, customizable HLS video player web component with built-in control
|
|
|
6
6
|
|
|
7
7
|
- HLS (HTTP Live Streaming) video playback
|
|
8
8
|
- Built-in controls with optimized icons
|
|
9
|
-
- Responsive design
|
|
9
|
+
- Responsive design
|
|
10
10
|
- Dynamic controls handling based on video background color (dark or light)
|
|
11
11
|
- Customizable playback speeds
|
|
12
12
|
- Time display options
|
|
13
13
|
- Progress bar with seek functionality
|
|
14
14
|
- Fullscreen support
|
|
15
|
+
- Optional auto-hiding controls that appear on mouse movement or tap, and stay up while paused
|
|
15
16
|
- Cross-browser compatibility with native HLS fallback for Safari
|
|
16
17
|
|
|
17
18
|
## Installation & Usage
|
|
@@ -20,7 +21,7 @@ A lightweight, customizable HLS video player web component with built-in control
|
|
|
20
21
|
|
|
21
22
|
```bash
|
|
22
23
|
# Install the package and its peer dependencies
|
|
23
|
-
|
|
24
|
+
yarn add @v360-tech/v360-player hls.js jquery
|
|
24
25
|
```
|
|
25
26
|
|
|
26
27
|
```typescript
|
|
@@ -43,9 +44,9 @@ import "@v360-tech/v360-player";
|
|
|
43
44
|
|
|
44
45
|
```html
|
|
45
46
|
<!-- Include from CDN (all dependencies bundled) -->
|
|
46
|
-
<script src="https://unpkg.com/@v360-tech/v360-player@1.
|
|
47
|
+
<script src="https://unpkg.com/@v360-tech/v360-player@1.7.1/dist/v360-player.browser.js"></script>
|
|
47
48
|
<!-- OR -->
|
|
48
|
-
<script src="https://cdn.jsdelivr.net/npm/@v360-tech/v360-player@1.
|
|
49
|
+
<script src="https://cdn.jsdelivr.net/npm/@v360-tech/v360-player@1.7.1/dist/v360-player.browser.js"></script>
|
|
49
50
|
|
|
50
51
|
<!-- Use immediately -->
|
|
51
52
|
<v360-player
|
|
@@ -70,8 +71,9 @@ import "@v360-tech/v360-player";
|
|
|
70
71
|
show-speed-control
|
|
71
72
|
playback-speeds="0.5,1,1.5,2"
|
|
72
73
|
default-speed="1"
|
|
73
|
-
progress-bar-style="
|
|
74
|
+
progress-bar-style="dual-layer"
|
|
74
75
|
background="dark"
|
|
76
|
+
auto-hide-controls
|
|
75
77
|
>
|
|
76
78
|
</v360-player>
|
|
77
79
|
```
|
|
@@ -83,14 +85,26 @@ import "@v360-tech/v360-player";
|
|
|
83
85
|
| `video-src` | string | required | URL to the HLS (.m3u8) video stream | Any valid URL |
|
|
84
86
|
| `poster-src` | string | `""` | URL to the poster image | Any valid URL |
|
|
85
87
|
| `width` | string | `"100%"` | Width of the video player | CSS width value (e.g., `"100%"`, `"800px"`) |
|
|
86
|
-
| `auto-play` | boolean | `false` | Enable autoplay |
|
|
87
|
-
| `show-time-display` | boolean | `false` | Show current time and duration |
|
|
88
|
-
| `show-speed-control` | boolean | `false` | Show playback speed control |
|
|
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) |
|
|
89
91
|
| `playback-speeds` | string | `"0.25,0.5,0.75,1,1.25,1.5,2"` | Comma-separated list of speeds | Comma-separated numbers |
|
|
90
|
-
| `default-speed` | string | `"1"` | Default playback speed
|
|
92
|
+
| `default-speed` | string | `"1"` | Default playback speed (see below) | One of the values from `playback-speeds` |
|
|
91
93
|
| `default-quality` | string | `"-1"` | Default HLS quality (-1 for auto) | `-1` or positive integer |
|
|
92
94
|
| `progress-bar-style` | string | `"none"` | Progress bar style variant | `"none"`, `"dual-layer"`, `"segments"`, `"minimal-wave"` |
|
|
93
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) |
|
|
98
|
+
|
|
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.
|
|
100
|
+
|
|
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.
|
|
102
|
+
|
|
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.
|
|
104
|
+
|
|
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.
|
|
106
|
+
|
|
107
|
+
`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.
|
|
94
108
|
|
|
95
109
|
## Build Types
|
|
96
110
|
|
|
@@ -250,19 +264,19 @@ cd v360-player
|
|
|
250
264
|
2. Install dependencies
|
|
251
265
|
|
|
252
266
|
```bash
|
|
253
|
-
|
|
267
|
+
yarn install
|
|
254
268
|
```
|
|
255
269
|
|
|
256
270
|
3. Start development server
|
|
257
271
|
|
|
258
272
|
```bash
|
|
259
|
-
|
|
273
|
+
yarn dev
|
|
260
274
|
```
|
|
261
275
|
|
|
262
276
|
4. Build for production
|
|
263
277
|
|
|
264
278
|
```bash
|
|
265
|
-
|
|
279
|
+
yarn build
|
|
266
280
|
```
|
|
267
281
|
|
|
268
282
|
## Technical Details
|
|
@@ -277,7 +291,6 @@ The player uses:
|
|
|
277
291
|
- Progress bar with seek functionality
|
|
278
292
|
- Fullscreen mode support
|
|
279
293
|
- Dynamic controls handling based on video background color (dark or light)
|
|
280
|
-
- Dynamic aspect ratio handling
|
|
281
294
|
|
|
282
295
|
## License
|
|
283
296
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export declare class V360Player extends HTMLElement {
|
|
2
|
+
private progressBarStyle;
|
|
3
|
+
private _hls?;
|
|
4
|
+
private _videoPlayer?;
|
|
5
|
+
private background;
|
|
6
|
+
private _autoPlay;
|
|
7
|
+
private _streamLoaded;
|
|
8
|
+
private _startLevel;
|
|
9
|
+
private _hideControlsTimer?;
|
|
10
|
+
private _pointerOverControls;
|
|
11
|
+
private readonly controlsHideDelay;
|
|
12
|
+
private static readonly defaultSpeeds;
|
|
13
|
+
private static readonly minSpeed;
|
|
14
|
+
private static readonly maxSpeed;
|
|
15
|
+
private _failed;
|
|
16
|
+
private _manifestParsed;
|
|
17
|
+
private _networkRetried;
|
|
18
|
+
private _mediaRecoveries;
|
|
19
|
+
private _listenersStarted;
|
|
20
|
+
private isValidProgressBarStyle;
|
|
21
|
+
private readonly svgIcons;
|
|
22
|
+
constructor();
|
|
23
|
+
private static readonly booleanProperties;
|
|
24
|
+
get autoPlay(): boolean;
|
|
25
|
+
set autoPlay(value: boolean);
|
|
26
|
+
get showTimeDisplay(): boolean;
|
|
27
|
+
set showTimeDisplay(value: boolean);
|
|
28
|
+
get showSpeedControl(): boolean;
|
|
29
|
+
set showSpeedControl(value: boolean);
|
|
30
|
+
get autoHideControls(): boolean;
|
|
31
|
+
set autoHideControls(value: boolean);
|
|
32
|
+
get debug(): boolean;
|
|
33
|
+
set debug(value: boolean);
|
|
34
|
+
private log;
|
|
35
|
+
private fail;
|
|
36
|
+
private upgradeProperties;
|
|
37
|
+
private setupAutoHide;
|
|
38
|
+
private showControls;
|
|
39
|
+
private scheduleControlsHide;
|
|
40
|
+
private hideControls;
|
|
41
|
+
static get observedAttributes(): string[];
|
|
42
|
+
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
43
|
+
connectedCallback(): Promise<void>;
|
|
44
|
+
private renderProgressBar;
|
|
45
|
+
private render;
|
|
46
|
+
private initializePlayer;
|
|
47
|
+
private initializeHls;
|
|
48
|
+
private autoplay;
|
|
49
|
+
private startListeners;
|
|
50
|
+
private play;
|
|
51
|
+
private pause;
|
|
52
|
+
private forward;
|
|
53
|
+
private backward;
|
|
54
|
+
private toggleFullscreen;
|
|
55
|
+
private parseSpeeds;
|
|
56
|
+
private updatePlayPauseButton;
|
|
57
|
+
private renderSpeedLabel;
|
|
58
|
+
private formatTime;
|
|
59
|
+
private updateControlsColor;
|
|
60
|
+
disconnectedCallback(): void;
|
|
61
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const ProgressBarStyle: {
|
|
2
|
+
readonly None: "none";
|
|
3
|
+
readonly DualLayer: "dual-layer";
|
|
4
|
+
readonly Segments: "segments";
|
|
5
|
+
readonly MinimalWave: "minimal-wave";
|
|
6
|
+
};
|
|
7
|
+
export type ProgressBarStyle = typeof ProgressBarStyle[keyof typeof ProgressBarStyle];
|
|
8
|
+
export declare const progressBarStyles: {
|
|
9
|
+
none: string;
|
|
10
|
+
"dual-layer": string;
|
|
11
|
+
segments: string;
|
|
12
|
+
"minimal-wave": string;
|
|
13
|
+
};
|