@v360-tech/v360-player 1.4.14 → 1.7.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 +16 -10
- package/dist/types/common/constants.d.ts +4 -0
- package/dist/types/components/V360Player.d.ts +47 -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 +72 -52
- package/dist/v360-player.js +129 -36
- package/package.json +10 -9
- package/dist/index.html +0 -0
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ A lightweight, customizable HLS video player web component with built-in control
|
|
|
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
|
|
@@ -72,7 +73,7 @@ import "@v360-tech/v360-player";
|
|
|
72
73
|
default-speed="1"
|
|
73
74
|
progress-bar-style="DualLayer"
|
|
74
75
|
background="dark"
|
|
75
|
-
|
|
76
|
+
auto-hide-controls
|
|
76
77
|
>
|
|
77
78
|
</v360-player>
|
|
78
79
|
```
|
|
@@ -84,22 +85,27 @@ import "@v360-tech/v360-player";
|
|
|
84
85
|
| `video-src` | string | required | URL to the HLS (.m3u8) video stream | Any valid URL |
|
|
85
86
|
| `poster-src` | string | `""` | URL to the poster image | Any valid URL |
|
|
86
87
|
| `width` | string | `"100%"` | Width of the video player | CSS width value (e.g., `"100%"`, `"800px"`) |
|
|
87
|
-
| `auto-play` | boolean | `false` | Enable autoplay |
|
|
88
|
-
| `show-time-display` | boolean | `false` | Show current time and duration |
|
|
89
|
-
| `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) |
|
|
90
91
|
| `playback-speeds` | string | `"0.25,0.5,0.75,1,1.25,1.5,2"` | Comma-separated list of speeds | Comma-separated numbers |
|
|
91
92
|
| `default-speed` | string | `"1"` | Default playback speed | One of the values from `playback-speeds` |
|
|
92
93
|
| `default-quality` | string | `"-1"` | Default HLS quality (-1 for auto) | `-1` or positive integer |
|
|
93
94
|
| `progress-bar-style` | string | `"none"` | Progress bar style variant | `"none"`, `"dual-layer"`, `"segments"`, `"minimal-wave"` |
|
|
94
95
|
| `background` | string | `dark` | Video background | `dark`, `light` |
|
|
95
|
-
| `
|
|
96
|
+
| `auto-hide-controls` | boolean | `false` | Auto-hide controls (see below) | Present to enable (no value) |
|
|
97
|
+
|
|
98
|
+
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.
|
|
99
|
+
|
|
100
|
+
Each boolean attribute also has a JS property that adds or removes it: `autoPlay`, `showTimeDisplay`, `showSpeedControl` and `autoHideControls`, 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.
|
|
101
|
+
|
|
102
|
+
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.
|
|
96
103
|
|
|
97
104
|
## Build Types
|
|
98
105
|
|
|
99
106
|
This package provides two optimized builds:
|
|
100
107
|
|
|
101
108
|
1. **ES Module Build** (`v360-player.js`):
|
|
102
|
-
|
|
103
109
|
- For use with modern bundlers (Vite, Webpack, Rollup, etc.)
|
|
104
110
|
- External dependencies (hls.js, jquery) for better tree-shaking
|
|
105
111
|
- Smaller bundle size when used with bundlers
|
|
@@ -253,19 +259,19 @@ cd v360-player
|
|
|
253
259
|
2. Install dependencies
|
|
254
260
|
|
|
255
261
|
```bash
|
|
256
|
-
|
|
262
|
+
yarn install
|
|
257
263
|
```
|
|
258
264
|
|
|
259
265
|
3. Start development server
|
|
260
266
|
|
|
261
267
|
```bash
|
|
262
|
-
|
|
268
|
+
yarn dev
|
|
263
269
|
```
|
|
264
270
|
|
|
265
271
|
4. Build for production
|
|
266
272
|
|
|
267
273
|
```bash
|
|
268
|
-
|
|
274
|
+
yarn build
|
|
269
275
|
```
|
|
270
276
|
|
|
271
277
|
## Technical Details
|
|
@@ -0,0 +1,47 @@
|
|
|
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 isValidProgressBarStyle;
|
|
13
|
+
private readonly svgIcons;
|
|
14
|
+
constructor();
|
|
15
|
+
private static readonly booleanProperties;
|
|
16
|
+
get autoPlay(): boolean;
|
|
17
|
+
set autoPlay(value: boolean);
|
|
18
|
+
get showTimeDisplay(): boolean;
|
|
19
|
+
set showTimeDisplay(value: boolean);
|
|
20
|
+
get showSpeedControl(): boolean;
|
|
21
|
+
set showSpeedControl(value: boolean);
|
|
22
|
+
get autoHideControls(): boolean;
|
|
23
|
+
set autoHideControls(value: boolean);
|
|
24
|
+
private upgradeProperties;
|
|
25
|
+
private setupAutoHide;
|
|
26
|
+
private showControls;
|
|
27
|
+
private scheduleControlsHide;
|
|
28
|
+
private hideControls;
|
|
29
|
+
static get observedAttributes(): string[];
|
|
30
|
+
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
31
|
+
connectedCallback(): Promise<void>;
|
|
32
|
+
private setupProgressBarInteractions;
|
|
33
|
+
private renderProgressBar;
|
|
34
|
+
private render;
|
|
35
|
+
private initializePlayer;
|
|
36
|
+
private initializeHls;
|
|
37
|
+
private startListeners;
|
|
38
|
+
private play;
|
|
39
|
+
private pause;
|
|
40
|
+
private forward;
|
|
41
|
+
private backward;
|
|
42
|
+
private toggleFullscreen;
|
|
43
|
+
private getSpeedIcon;
|
|
44
|
+
private formatTime;
|
|
45
|
+
private updateControlsColor;
|
|
46
|
+
disconnectedCallback(): void;
|
|
47
|
+
}
|
|
@@ -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
|
+
};
|