itube-modern-player 0.3.1 → 0.4.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 +76 -1
- package/dist/core.cjs +3 -3
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +513 -353
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/itube-modern-player.iife.js +3 -3
- package/dist/itube-modern-player.iife.js.map +1 -1
- package/dist/{labels-AHLc5npk.js → labels-DZFT0XMa.js} +4 -1
- package/dist/labels-DZFT0XMa.js.map +1 -0
- package/dist/labels-y0IHe3i9.cjs +2 -0
- package/dist/labels-y0IHe3i9.cjs.map +1 -0
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +31 -1
- package/dist/locales.js.map +1 -1
- package/dist/player.d.ts +18 -1
- package/dist/style.css +1 -1
- package/dist/types.d.ts +53 -1
- package/dist/ui/controls.d.ts +16 -1
- package/dist/ui/menu.d.ts +15 -5
- package/dist/ui/overlays.d.ts +12 -0
- package/package.json +1 -1
- package/dist/labels-AHLc5npk.js.map +0 -1
- package/dist/labels-BVAa_H4n.cjs +0 -2
- package/dist/labels-BVAa_H4n.cjs.map +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -22,6 +22,21 @@ export interface Chapter {
|
|
|
22
22
|
/** Chapter title shown in the seek tooltip and the chapter label. */
|
|
23
23
|
title: string;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* A named breakdown of the video into scenes of one type (actors, locations,
|
|
27
|
+
* actions, …). Several groups can be attached to a source; the scene-type
|
|
28
|
+
* control switches the active one, rebuilding the timeline + scenes panel.
|
|
29
|
+
*/
|
|
30
|
+
export interface SceneGroup {
|
|
31
|
+
/** Stable id, e.g. `"actions"` / `"locations"`. */
|
|
32
|
+
id: string;
|
|
33
|
+
/** Label shown on the scene-type control and in its dropdown. */
|
|
34
|
+
title: string;
|
|
35
|
+
/** Icon for the control/dropdown: raw `<svg>` markup or an image URL. */
|
|
36
|
+
icon?: string;
|
|
37
|
+
/** Scenes (chapters) for this type. */
|
|
38
|
+
scenes: Chapter[];
|
|
39
|
+
}
|
|
25
40
|
/** An alternative quality rendition for progressive (non-HLS) sources. */
|
|
26
41
|
export interface QualityLevel {
|
|
27
42
|
/** Stream / file URL for this rendition. */
|
|
@@ -96,6 +111,13 @@ export interface VideoSource {
|
|
|
96
111
|
sponsor?: SponsorLink;
|
|
97
112
|
/** Chapters as an array, or a URL of a WebVTT chapters file. */
|
|
98
113
|
chapters?: Chapter[] | string;
|
|
114
|
+
/**
|
|
115
|
+
* Typed scene breakdowns (actors / locations / actions / …). When set, the
|
|
116
|
+
* scene-type control lets the viewer switch between them, and the active
|
|
117
|
+
* group's `scenes` drive the timeline segments + scenes panel (taking
|
|
118
|
+
* precedence over `chapters`).
|
|
119
|
+
*/
|
|
120
|
+
sceneGroups?: SceneGroup[];
|
|
99
121
|
/** Alternative renditions for progressive sources. Ignored for HLS (levels come from the manifest). */
|
|
100
122
|
qualities?: QualityLevel[];
|
|
101
123
|
/**
|
|
@@ -214,6 +236,13 @@ export interface ActionsOptions {
|
|
|
214
236
|
* - `false`: off. `true` is an alias for `"gear"`.
|
|
215
237
|
*/
|
|
216
238
|
export type SettingPlacement = boolean | 'gear' | 'bar';
|
|
239
|
+
/** Formats the seek-button caption. `seconds` is the step; `direction` the arrow. */
|
|
240
|
+
export type SeekLabelFormat = (seconds: number, direction: 'back' | 'forward') => string;
|
|
241
|
+
/**
|
|
242
|
+
* Stable keys of the right-cluster controls (for `controls.order`). Custom
|
|
243
|
+
* action buttons placed in the bar are addressed as `` `custom:${id}` ``.
|
|
244
|
+
*/
|
|
245
|
+
export type ControlBarItem = 'like' | 'dislike' | 'speed' | 'quality' | 'subtitles' | 'gear' | 'scenes' | 'sceneTypes' | 'playlist' | 'pip' | 'fullscreen' | `custom:${string}`;
|
|
217
246
|
/** What the "next video" hover preview shows. `true`/`false` toggle all of it. */
|
|
218
247
|
export interface NextPreviewOptions {
|
|
219
248
|
/** Thumbnail (next source's `poster`). Default true. */
|
|
@@ -240,14 +269,21 @@ export interface ControlsOptions {
|
|
|
240
269
|
quality?: SettingPlacement;
|
|
241
270
|
/** Scene list button — appears when the source has chapters. Default true. */
|
|
242
271
|
scenes?: boolean;
|
|
272
|
+
/** Scene-type selector (dropdown) — appears when the source has `sceneGroups`. Default true. */
|
|
273
|
+
sceneTypes?: boolean;
|
|
243
274
|
/** Popularity heatmap above the progress bar (needs `source.heatmap` data). Default true. */
|
|
244
275
|
heatmap?: boolean;
|
|
245
276
|
/** Subtitles. Default `"gear"` (inside the settings dropdown). */
|
|
246
277
|
subtitles?: SettingPlacement;
|
|
247
|
-
/**
|
|
278
|
+
/**
|
|
279
|
+
* Skip-back / skip-forward buttons. Pass an object to change the step (seconds)
|
|
280
|
+
* and/or the caption format. `label` is a formatter — the most flexible option
|
|
281
|
+
* (a regex matches, it doesn't format); default → `"−15s"` / `"+15s"`.
|
|
282
|
+
*/
|
|
248
283
|
seekButtons?: boolean | {
|
|
249
284
|
back?: number;
|
|
250
285
|
forward?: number;
|
|
286
|
+
label?: SeekLabelFormat;
|
|
251
287
|
};
|
|
252
288
|
/**
|
|
253
289
|
* Where the prev/seek/play/next cluster lives:
|
|
@@ -256,6 +292,12 @@ export interface ControlsOptions {
|
|
|
256
292
|
* over the video on mobile). This is the pre-0.3 desktop behaviour.
|
|
257
293
|
*/
|
|
258
294
|
seekPlacement?: 'overlay' | 'bar';
|
|
295
|
+
/**
|
|
296
|
+
* Left-to-right order of the right-cluster controls (gear, pip, playlist, …).
|
|
297
|
+
* Omit / empty → built-in order. Listed keys go first (in this order); any not
|
|
298
|
+
* listed keep their default position after them. The ⋯ menu stays last.
|
|
299
|
+
*/
|
|
300
|
+
order?: ControlBarItem[];
|
|
259
301
|
/** Previous / next / list buttons (only rendered when a playlist is present). */
|
|
260
302
|
playlist?: boolean;
|
|
261
303
|
/**
|
|
@@ -319,6 +361,12 @@ export interface PlayerLabels {
|
|
|
319
361
|
previous: string;
|
|
320
362
|
playlist: string;
|
|
321
363
|
scenes: string;
|
|
364
|
+
/** Header of the scene-type selector dropdown. */
|
|
365
|
+
sceneTypes: string;
|
|
366
|
+
/** Autoplay toggle in the settings dropdown. */
|
|
367
|
+
autoplay: string;
|
|
368
|
+
/** "Play next" button on the up-next end overlay. */
|
|
369
|
+
playNext: string;
|
|
322
370
|
shuffle: string;
|
|
323
371
|
repeat: string;
|
|
324
372
|
like: string;
|
|
@@ -465,6 +513,10 @@ export interface PlayerEventMap {
|
|
|
465
513
|
chapterchange: {
|
|
466
514
|
chapter: Chapter | null;
|
|
467
515
|
};
|
|
516
|
+
/** Fired when the active scene type (group) changes. */
|
|
517
|
+
scenetypechange: {
|
|
518
|
+
group: SceneGroup | null;
|
|
519
|
+
};
|
|
468
520
|
fullscreenchange: {
|
|
469
521
|
active: boolean;
|
|
470
522
|
};
|
package/dist/ui/controls.d.ts
CHANGED
|
@@ -18,6 +18,9 @@ export declare class Controls {
|
|
|
18
18
|
private fullscreenBtn;
|
|
19
19
|
private row;
|
|
20
20
|
private rightGroup;
|
|
21
|
+
private seekLabelFn?;
|
|
22
|
+
/** Right-cluster controls keyed for ordering; appended in `controls.order`. */
|
|
23
|
+
private rightItems;
|
|
21
24
|
private subtitlesBtn;
|
|
22
25
|
private settingsBtn;
|
|
23
26
|
private settingsMenu;
|
|
@@ -35,6 +38,8 @@ export declare class Controls {
|
|
|
35
38
|
private nextPreviewEl;
|
|
36
39
|
private nextPreviewOpts;
|
|
37
40
|
private scenesBtn;
|
|
41
|
+
private sceneTypeBtn;
|
|
42
|
+
private sceneTypeMenu;
|
|
38
43
|
private likeBtn;
|
|
39
44
|
private dislikeBtn;
|
|
40
45
|
private likeCountEl;
|
|
@@ -59,14 +64,24 @@ export declare class Controls {
|
|
|
59
64
|
constructor(player: Player);
|
|
60
65
|
private onWindowResize;
|
|
61
66
|
private registerCollapsible;
|
|
67
|
+
/**
|
|
68
|
+
* Append the right-cluster controls. Built-in order = creation order; if
|
|
69
|
+
* `controls.order` is set, its keys go first (in that order), then any
|
|
70
|
+
* unlisted controls keep their default position. (⋯ is appended separately.)
|
|
71
|
+
*/
|
|
72
|
+
private layoutRightCluster;
|
|
62
73
|
/** Center-cluster button — deliberately NOT `.imp-btn` (own sizing/look). */
|
|
63
74
|
private makeCenterButton;
|
|
64
|
-
/** Caption under the seek arrow
|
|
75
|
+
/** Caption under the seek arrow. Default "−15s"/"+15s"; overridable via `controls.seekButtons.label`. */
|
|
65
76
|
private addStepBadge;
|
|
66
77
|
/** Sections for the gear when overflowed into ⋯ (expanded, no drill-down). */
|
|
67
78
|
private gearSections;
|
|
68
79
|
/** Gear drill-down rows: one per setting, each showing its current value. */
|
|
69
80
|
private gearEntries;
|
|
81
|
+
/** Update the scene-type button to the active group's icon + title. */
|
|
82
|
+
private refreshSceneTypeButton;
|
|
83
|
+
private sceneTypeSection;
|
|
84
|
+
private toggleSceneTypeMenu;
|
|
70
85
|
private toggleGearMenu;
|
|
71
86
|
private setupNextPreview;
|
|
72
87
|
private bindNextPreview;
|
package/dist/ui/menu.d.ts
CHANGED
|
@@ -10,14 +10,22 @@ export interface MenuSection {
|
|
|
10
10
|
items: MenuItem[];
|
|
11
11
|
onSelect(value: string): void;
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* One row in the settings (gear) drill-down. Either a drill row (label + current
|
|
15
|
+
* value → options) or a toggle row (label + on/off switch).
|
|
16
|
+
*/
|
|
14
17
|
export interface SettingEntry {
|
|
15
18
|
key: string;
|
|
16
19
|
label: string;
|
|
17
|
-
/** Current value shown on
|
|
18
|
-
value
|
|
19
|
-
/** The options panel to drill into when
|
|
20
|
-
section(): MenuSection;
|
|
20
|
+
/** Current value shown on a drill row, e.g. "Auto", "1×", "Off". */
|
|
21
|
+
value?: string;
|
|
22
|
+
/** The options panel to drill into when a drill row is clicked. */
|
|
23
|
+
section?(): MenuSection;
|
|
24
|
+
/** Present → render a toggle switch instead of a drill row. */
|
|
25
|
+
toggle?: {
|
|
26
|
+
value: boolean;
|
|
27
|
+
onChange(next: boolean): void;
|
|
28
|
+
};
|
|
21
29
|
}
|
|
22
30
|
/**
|
|
23
31
|
* Popup menu anchored above a control button. One instance per button;
|
|
@@ -37,6 +45,8 @@ export declare class Menu {
|
|
|
37
45
|
toggleSettings(title: string, entries: SettingEntry[]): void;
|
|
38
46
|
showSettings(_title: string, entries: SettingEntry[]): void;
|
|
39
47
|
private renderSettingsRoot;
|
|
48
|
+
/** Toggle row: label + an on/off switch. Stays in the menu (no close). */
|
|
49
|
+
private buildToggleRow;
|
|
40
50
|
private renderSettingsDetail;
|
|
41
51
|
/** Build one option block (radio items) from a section. */
|
|
42
52
|
private renderSection;
|
package/dist/ui/overlays.d.ts
CHANGED
|
@@ -61,3 +61,15 @@ export declare class RelatedOverlay {
|
|
|
61
61
|
show(): void;
|
|
62
62
|
hide(): void;
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* End-of-video "up next" overlay shown when autoplay is OFF and a next item
|
|
66
|
+
* exists: a preview card of the next video + a "Play next" button.
|
|
67
|
+
*/
|
|
68
|
+
export declare class UpNextOverlay {
|
|
69
|
+
private player;
|
|
70
|
+
readonly root: HTMLElement;
|
|
71
|
+
constructor(player: Player);
|
|
72
|
+
get visible(): boolean;
|
|
73
|
+
show(): void;
|
|
74
|
+
hide(): void;
|
|
75
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "itube-modern-player",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Lightweight, framework-agnostic HTML5 video player: HLS streams, playlists, chapters, VTT subtitles, sprite previews, VAST ads. Ships with a Vue 3 wrapper.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"labels-AHLc5npk.js","sources":["../src/core/labels.ts"],"sourcesContent":["import type { PlayerLabels } from '../types'\n\nexport const defaultLabels: PlayerLabels = {\n play: 'Play',\n pause: 'Pause',\n replay: 'Replay',\n mute: 'Mute',\n unmute: 'Unmute',\n fullscreen: 'Fullscreen',\n exitFullscreen: 'Exit fullscreen',\n pip: 'Picture-in-picture',\n settings: 'Playback speed',\n scenes: 'Scenes',\n shuffle: 'Shuffle',\n repeat: 'Repeat',\n subtitles: 'Subtitles',\n subtitlesOff: 'Off',\n speed: 'Speed',\n quality: 'Quality',\n qualityAuto: 'Auto',\n next: 'Next',\n previous: 'Previous',\n playlist: 'Playlist',\n like: 'Like',\n dislike: 'Dislike',\n addTo: 'Save to…',\n share: 'Share',\n report: 'Report',\n more: 'More actions',\n seekForward: 'Seek forward',\n seekBack: 'Seek back',\n secondsShort: 's',\n live: 'LIVE',\n related: 'More videos',\n adLabel: 'Ad',\n skipAd: 'Skip ad',\n skipAdIn: 'Skip in',\n visitAdvertiser: 'Visit advertiser',\n sponsored: 'Sponsored',\n}\n"],"names":["defaultLabels"],"mappings":"AAEO,MAAMA,IAA8B;AAAA,EACzC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,KAAK;AAAA,EACL,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,cAAc;AAAA,EACd,OAAO;AAAA,EACP,SAAS;AAAA,EACT,aAAa;AAAA,EACb,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AAAA,EACV,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,aAAa;AAAA,EACb,UAAU;AAAA,EACV,cAAc;AAAA,EACd,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,iBAAiB;AAAA,EACjB,WAAW;AACb;"}
|
package/dist/labels-BVAa_H4n.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const e={play:"Play",pause:"Pause",replay:"Replay",mute:"Mute",unmute:"Unmute",fullscreen:"Fullscreen",exitFullscreen:"Exit fullscreen",pip:"Picture-in-picture",settings:"Playback speed",scenes:"Scenes",shuffle:"Shuffle",repeat:"Repeat",subtitles:"Subtitles",subtitlesOff:"Off",speed:"Speed",quality:"Quality",qualityAuto:"Auto",next:"Next",previous:"Previous",playlist:"Playlist",like:"Like",dislike:"Dislike",addTo:"Save to…",share:"Share",report:"Report",more:"More actions",seekForward:"Seek forward",seekBack:"Seek back",secondsShort:"s",live:"LIVE",related:"More videos",adLabel:"Ad",skipAd:"Skip ad",skipAdIn:"Skip in",visitAdvertiser:"Visit advertiser",sponsored:"Sponsored"};exports.defaultLabels=e;
|
|
2
|
-
//# sourceMappingURL=labels-BVAa_H4n.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"labels-BVAa_H4n.cjs","sources":["../src/core/labels.ts"],"sourcesContent":["import type { PlayerLabels } from '../types'\n\nexport const defaultLabels: PlayerLabels = {\n play: 'Play',\n pause: 'Pause',\n replay: 'Replay',\n mute: 'Mute',\n unmute: 'Unmute',\n fullscreen: 'Fullscreen',\n exitFullscreen: 'Exit fullscreen',\n pip: 'Picture-in-picture',\n settings: 'Playback speed',\n scenes: 'Scenes',\n shuffle: 'Shuffle',\n repeat: 'Repeat',\n subtitles: 'Subtitles',\n subtitlesOff: 'Off',\n speed: 'Speed',\n quality: 'Quality',\n qualityAuto: 'Auto',\n next: 'Next',\n previous: 'Previous',\n playlist: 'Playlist',\n like: 'Like',\n dislike: 'Dislike',\n addTo: 'Save to…',\n share: 'Share',\n report: 'Report',\n more: 'More actions',\n seekForward: 'Seek forward',\n seekBack: 'Seek back',\n secondsShort: 's',\n live: 'LIVE',\n related: 'More videos',\n adLabel: 'Ad',\n skipAd: 'Skip ad',\n skipAdIn: 'Skip in',\n visitAdvertiser: 'Visit advertiser',\n sponsored: 'Sponsored',\n}\n"],"names":["defaultLabels"],"mappings":"aAEO,MAAMA,EAA8B,CACzC,KAAM,OACN,MAAO,QACP,OAAQ,SACR,KAAM,OACN,OAAQ,SACR,WAAY,aACZ,eAAgB,kBAChB,IAAK,qBACL,SAAU,iBACV,OAAQ,SACR,QAAS,UACT,OAAQ,SACR,UAAW,YACX,aAAc,MACd,MAAO,QACP,QAAS,UACT,YAAa,OACb,KAAM,OACN,SAAU,WACV,SAAU,WACV,KAAM,OACN,QAAS,UACT,MAAO,WACP,MAAO,QACP,OAAQ,SACR,KAAM,eACN,YAAa,eACb,SAAU,YACV,aAAc,IACd,KAAM,OACN,QAAS,cACT,QAAS,KACT,OAAQ,UACR,SAAU,UACV,gBAAiB,mBACjB,UAAW,WACb"}
|