@scarlett-player/embed 1.7.0 → 1.8.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 +62 -5
- package/dist/create-embed.d.ts +67 -0
- package/dist/create-embed.d.ts.map +1 -0
- package/dist/{hls2.js → embed.audio.index.js} +1 -1
- package/dist/embed.audio.index.js.map +1 -0
- package/dist/embed.audio.js +666 -45
- package/dist/embed.audio.js.map +1 -1
- package/dist/embed.audio.umd.cjs +1 -1
- package/dist/embed.audio.umd.cjs.map +1 -1
- package/dist/embed.js +1956 -78
- package/dist/embed.js.map +1 -1
- package/dist/embed.umd.cjs +1 -1
- package/dist/embed.umd.cjs.map +1 -1
- package/dist/embed.video.js +1938 -66
- package/dist/embed.video.js.map +1 -1
- package/dist/embed.video.umd.cjs +1 -1
- package/dist/embed.video.umd.cjs.map +1 -1
- package/dist/hls.light.js +21849 -0
- package/dist/hls.light.js.map +1 -0
- package/dist/index-audio.d.ts +21 -0
- package/dist/index-audio.d.ts.map +1 -0
- package/dist/index-video.d.ts +19 -0
- package/dist/index-video.d.ts.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/parser.d.ts +15 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/types.d.ts +156 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/version.d.ts +6 -0
- package/dist/version.d.ts.map +1 -0
- package/iframe.html +35 -13
- package/package.json +19 -17
- package/dist/hls2.js.map +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scarlett Player - Audio Only Build
|
|
3
|
+
*
|
|
4
|
+
* Audio player with:
|
|
5
|
+
* - Audio UI (full + mini layouts)
|
|
6
|
+
* - HLS streaming (hls.js/light)
|
|
7
|
+
* - Native progressive playback (MP3, AAC, M4A, WAV, ...)
|
|
8
|
+
* - Playlist management
|
|
9
|
+
* - Media Session (lock screen controls)
|
|
10
|
+
*
|
|
11
|
+
* Does NOT include: Video UI, Analytics
|
|
12
|
+
* Use embed.js for full features or embed.video.js for video.
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
*/
|
|
16
|
+
import type { ScarlettPlayerGlobal } from './types';
|
|
17
|
+
export type { EmbedConfig, EmbedPlayerOptions, ScarlettPlayerGlobal, PlayerType } from './types';
|
|
18
|
+
export { parseDataAttributes, applyContainerStyles, aspectRatioToPercent } from './parser';
|
|
19
|
+
declare const ScarlettPlayerAPI: ScarlettPlayerGlobal;
|
|
20
|
+
export default ScarlettPlayerAPI;
|
|
21
|
+
//# sourceMappingURL=index-audio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-audio.d.ts","sourceRoot":"","sources":["../src/index-audio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,OAAO,KAAK,EAAE,oBAAoB,EAAc,MAAM,SAAS,CAAC;AAKhE,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAiB3F,QAAA,MAAM,iBAAiB,EAAE,oBAIxB,CAAC;AASF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scarlett Player - Video Only Build
|
|
3
|
+
*
|
|
4
|
+
* Lightweight video player with:
|
|
5
|
+
* - Video UI (full video player controls)
|
|
6
|
+
* - HLS streaming
|
|
7
|
+
* - Native progressive playback (MP4, WebM, MOV, ...)
|
|
8
|
+
*
|
|
9
|
+
* Does NOT include: Audio UI, Analytics, Playlist, Media Session
|
|
10
|
+
* Use embed.js for full features or embed.audio.js for audio.
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
*/
|
|
14
|
+
import type { ScarlettPlayerGlobal } from './types';
|
|
15
|
+
export type { EmbedConfig, EmbedPlayerOptions, ScarlettPlayerGlobal, PlayerType } from './types';
|
|
16
|
+
export { parseDataAttributes, applyContainerStyles, aspectRatioToPercent } from './parser';
|
|
17
|
+
declare const ScarlettPlayerAPI: ScarlettPlayerGlobal;
|
|
18
|
+
export default ScarlettPlayerAPI;
|
|
19
|
+
//# sourceMappingURL=index-video.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-video.d.ts","sourceRoot":"","sources":["../src/index-video.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH,OAAO,KAAK,EAAE,oBAAoB,EAAc,MAAM,SAAS,CAAC;AAKhE,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAoB3F,QAAA,MAAM,iBAAiB,EAAE,oBAIxB,CAAC;AASF,eAAe,iBAAiB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scarlett Player - Full Embed Build
|
|
3
|
+
*
|
|
4
|
+
* Complete player with all features:
|
|
5
|
+
* - Video UI (full video player controls)
|
|
6
|
+
* - Audio UI (full + mini audio player)
|
|
7
|
+
* - HLS streaming
|
|
8
|
+
* - Native progressive playback (MP4, WebM, MP3, ...)
|
|
9
|
+
* - Analytics
|
|
10
|
+
* - Playlist management
|
|
11
|
+
* - Media Session (lock screen controls)
|
|
12
|
+
*
|
|
13
|
+
* @packageDocumentation
|
|
14
|
+
*/
|
|
15
|
+
import type { ScarlettPlayerGlobal } from './types';
|
|
16
|
+
export type { EmbedConfig, EmbedPlayerOptions, ScarlettPlayerGlobal, PlayerType } from './types';
|
|
17
|
+
export { parseDataAttributes, applyContainerStyles, aspectRatioToPercent } from './parser';
|
|
18
|
+
declare const ScarlettPlayerAPI: ScarlettPlayerGlobal;
|
|
19
|
+
export default ScarlettPlayerAPI;
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAYH,OAAO,KAAK,EAAE,oBAAoB,EAAc,MAAM,SAAS,CAAC;AAKhE,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAoB3F,QAAA,MAAM,iBAAiB,EAAE,oBAIxB,CAAC;AASF,eAAe,iBAAiB,CAAC"}
|
package/dist/parser.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { EmbedConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Parse data attributes from an element into EmbedConfig
|
|
4
|
+
* Supports multiple attribute naming conventions for flexibility
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseDataAttributes(element: HTMLElement): Partial<EmbedConfig>;
|
|
7
|
+
/**
|
|
8
|
+
* Convert aspect ratio string (e.g., "16:9") to percentage
|
|
9
|
+
*/
|
|
10
|
+
export declare function aspectRatioToPercent(ratio: string): number;
|
|
11
|
+
/**
|
|
12
|
+
* Apply container styles based on config and player type
|
|
13
|
+
*/
|
|
14
|
+
export declare function applyContainerStyles(container: HTMLElement, config: Partial<EmbedConfig>): void;
|
|
15
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAc,MAAM,SAAS,CAAC;AAcvD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAwK9E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ1D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,WAAW,EACtB,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,GAC3B,IAAI,CAiCN"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Player type determines which UI to use
|
|
3
|
+
*/
|
|
4
|
+
export type PlayerType = 'video' | 'audio' | 'audio-mini';
|
|
5
|
+
/**
|
|
6
|
+
* Configuration options that can be set via data attributes
|
|
7
|
+
*/
|
|
8
|
+
export interface EmbedConfig {
|
|
9
|
+
/** Video/audio source URL (required) */
|
|
10
|
+
src: string;
|
|
11
|
+
/** Player type: 'video' (default), 'audio', or 'audio-mini' */
|
|
12
|
+
type?: PlayerType;
|
|
13
|
+
/** Autoplay the media */
|
|
14
|
+
autoplay?: boolean;
|
|
15
|
+
/** Mute the media */
|
|
16
|
+
muted?: boolean;
|
|
17
|
+
/** Poster/artwork image URL */
|
|
18
|
+
poster?: string;
|
|
19
|
+
/** Show/hide UI controls */
|
|
20
|
+
controls?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Show the centred big play button over the poster (video only, default:
|
|
23
|
+
* true).
|
|
24
|
+
*
|
|
25
|
+
* Mirrors `UIPluginConfig.bigPlayButton` in `@scarlett-player/ui`, which is
|
|
26
|
+
* where the default lives: the embed forwards this to the video UI plugin
|
|
27
|
+
* only when it is set, so leaving it out keeps the plugin's own default
|
|
28
|
+
* rather than pinning a second copy of it here. Set it to `false` when the
|
|
29
|
+
* host page draws its own play affordance over the player. The audio UIs
|
|
30
|
+
* have no such control and ignore it.
|
|
31
|
+
*/
|
|
32
|
+
bigPlayButton?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Touch gestures on the video surface (video only, default: true).
|
|
35
|
+
*
|
|
36
|
+
* Double-tap the right of the picture to jump forward, the left to jump
|
|
37
|
+
* back, and tap once to toggle the controls. Touch only, decided by input
|
|
38
|
+
* type rather than user agent, so a mouse or pen never triggers any of it,
|
|
39
|
+
* and seeking is suppressed while casting and on live without a DVR window.
|
|
40
|
+
*
|
|
41
|
+
* Set it to `false` on a third-party page that owns those gestures itself.
|
|
42
|
+
*/
|
|
43
|
+
gestures?: boolean;
|
|
44
|
+
/** Brand/accent color for the player UI */
|
|
45
|
+
brandColor?: string;
|
|
46
|
+
/** Primary color for UI elements */
|
|
47
|
+
primaryColor?: string;
|
|
48
|
+
/** Background color for controls */
|
|
49
|
+
backgroundColor?: string;
|
|
50
|
+
/** Auto-hide controls delay in milliseconds */
|
|
51
|
+
hideDelay?: number;
|
|
52
|
+
/** Player width (CSS value) */
|
|
53
|
+
width?: string;
|
|
54
|
+
/** Player height (CSS value) */
|
|
55
|
+
height?: string;
|
|
56
|
+
/** Aspect ratio (e.g., "16:9", "4:3") - video only */
|
|
57
|
+
aspectRatio?: string;
|
|
58
|
+
/** Enable/disable keyboard shortcuts */
|
|
59
|
+
keyboard?: boolean;
|
|
60
|
+
/** Loop the media */
|
|
61
|
+
loop?: boolean;
|
|
62
|
+
/** Playback rate (speed) */
|
|
63
|
+
playbackRate?: number;
|
|
64
|
+
/** Start time in seconds */
|
|
65
|
+
startTime?: number;
|
|
66
|
+
/** Custom class name for the container */
|
|
67
|
+
className?: string;
|
|
68
|
+
/** Media title (for audio/media session) */
|
|
69
|
+
title?: string;
|
|
70
|
+
/** Artist name (for audio/media session) */
|
|
71
|
+
artist?: string;
|
|
72
|
+
/** Album name (for audio/media session) */
|
|
73
|
+
album?: string;
|
|
74
|
+
/** Artwork URL (alias for poster, for audio) */
|
|
75
|
+
artwork?: string;
|
|
76
|
+
/** Playlist items */
|
|
77
|
+
playlist?: PlaylistItem[];
|
|
78
|
+
/** Analytics configuration */
|
|
79
|
+
analytics?: AnalyticsConfig;
|
|
80
|
+
/** Watermark configuration */
|
|
81
|
+
watermark?: WatermarkConfig;
|
|
82
|
+
/** Captions configuration */
|
|
83
|
+
captions?: CaptionsConfig;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Playlist item configuration
|
|
87
|
+
*/
|
|
88
|
+
export interface PlaylistItem {
|
|
89
|
+
src: string;
|
|
90
|
+
title?: string;
|
|
91
|
+
artist?: string;
|
|
92
|
+
poster?: string;
|
|
93
|
+
artwork?: string;
|
|
94
|
+
duration?: number;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Analytics configuration
|
|
98
|
+
*/
|
|
99
|
+
export interface AnalyticsConfig {
|
|
100
|
+
beaconUrl?: string;
|
|
101
|
+
apiKey?: string;
|
|
102
|
+
videoId?: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Watermark configuration for embed
|
|
106
|
+
*/
|
|
107
|
+
export interface WatermarkConfig {
|
|
108
|
+
text?: string;
|
|
109
|
+
imageUrl?: string;
|
|
110
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center';
|
|
111
|
+
opacity?: number;
|
|
112
|
+
fontSize?: number;
|
|
113
|
+
dynamic?: boolean;
|
|
114
|
+
dynamicInterval?: number;
|
|
115
|
+
showDelay?: number;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Captions configuration for embed
|
|
119
|
+
*/
|
|
120
|
+
export interface CaptionsConfig {
|
|
121
|
+
sources?: Array<{
|
|
122
|
+
language: string;
|
|
123
|
+
label: string;
|
|
124
|
+
src: string;
|
|
125
|
+
kind?: 'subtitles' | 'captions';
|
|
126
|
+
}>;
|
|
127
|
+
extractFromHLS?: boolean;
|
|
128
|
+
autoSelect?: boolean;
|
|
129
|
+
defaultLanguage?: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Programmatic API options
|
|
133
|
+
*/
|
|
134
|
+
export interface EmbedPlayerOptions extends Partial<EmbedConfig> {
|
|
135
|
+
/** Target container element or selector */
|
|
136
|
+
container: string | HTMLElement;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Global ScarlettPlayer API exposed on window
|
|
140
|
+
*/
|
|
141
|
+
export interface ScarlettPlayerGlobal {
|
|
142
|
+
/** Create a new player instance programmatically */
|
|
143
|
+
create(options: EmbedPlayerOptions): Promise<any>;
|
|
144
|
+
/** Initialize all players with data-scarlett-player attribute */
|
|
145
|
+
initAll(): Promise<void>;
|
|
146
|
+
/** Version of the embed package */
|
|
147
|
+
version: string;
|
|
148
|
+
/** Available player types in this build */
|
|
149
|
+
availableTypes: PlayerType[];
|
|
150
|
+
}
|
|
151
|
+
declare global {
|
|
152
|
+
interface Window {
|
|
153
|
+
ScarlettPlayer: ScarlettPlayerGlobal;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,YAAY,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,+DAA+D;IAC/D,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACn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AAC,IAAI,CAAC,CAAC;IACzB,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,cAAc,EAAE,UAAU,EAAE,CAAC;CAC9B;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,cAAc,EAAE,oBAAoB,CAAC;KACtC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAmBA;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,MAC8C,CAAC"}
|
package/iframe.html
CHANGED
|
@@ -45,6 +45,15 @@
|
|
|
45
45
|
loop: params.get('loop') === 'true' || params.get('loop') === '1',
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
// Centred play button over the poster. Set only when the parameter is
|
|
49
|
+
// present: an untouched iframe URL must keep the ui plugin's default
|
|
50
|
+
// (shown), not pin a copy of it here. '0' counts as off alongside
|
|
51
|
+
// 'false', matching the controls parameter above.
|
|
52
|
+
const bigPlayButton = params.get('bigPlayButton') ?? params.get('big-play-button');
|
|
53
|
+
if (bigPlayButton !== null) {
|
|
54
|
+
config.bigPlayButton = bigPlayButton !== 'false' && bigPlayButton !== '0';
|
|
55
|
+
}
|
|
56
|
+
|
|
48
57
|
// Parse numeric params
|
|
49
58
|
const hideDelay = params.get('hideDelay') || params.get('hide-delay');
|
|
50
59
|
if (hideDelay) {
|
|
@@ -61,15 +70,6 @@
|
|
|
61
70
|
config.startTime = parseFloat(startTime);
|
|
62
71
|
}
|
|
63
72
|
|
|
64
|
-
// The page this embed lives on. Inside an iframe, window.location.href is
|
|
65
|
-
// this player page, and cross-origin rules block reading the parent - so
|
|
66
|
-
// without being told, a share from here would link to the bare player
|
|
67
|
-
// rather than to the page the viewer is actually watching.
|
|
68
|
-
const shareUrl = params.get('shareUrl') || params.get('share-url');
|
|
69
|
-
if (shareUrl) {
|
|
70
|
-
config.shareUrl = shareUrl;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
73
|
// Validate src
|
|
74
74
|
if (!config.src) {
|
|
75
75
|
document.body.innerHTML = `
|
|
@@ -84,11 +84,33 @@
|
|
|
84
84
|
</div>
|
|
85
85
|
`;
|
|
86
86
|
} else {
|
|
87
|
-
// Import and initialize player
|
|
88
|
-
|
|
87
|
+
// Import and initialize player.
|
|
88
|
+
//
|
|
89
|
+
// Two layouts ship this page and the bundle sits in a different place in
|
|
90
|
+
// each. scripts/upload-cdn.sh puts iframe.html BESIDE the bundles, so on
|
|
91
|
+
// the CDN the page is latest/iframe.html and the bundle is
|
|
92
|
+
// latest/embed.js; in the npm tarball the page is at the package root
|
|
93
|
+
// and the bundle is under dist/. The flat layout is tried first because
|
|
94
|
+
// it is the deployed one: './dist/embed.js' has been the only path here
|
|
95
|
+
// since the initial release (2b8fd69, 2025-12-14), and it 404s on the
|
|
96
|
+
// CDN, so this page has never worked there.
|
|
97
|
+
import('./embed.js')
|
|
98
|
+
.catch(() => import('./dist/embed.js'))
|
|
89
99
|
.then((module) => {
|
|
90
|
-
|
|
91
|
-
|
|
100
|
+
// The API object is the bundle's DEFAULT export: the ES build ends
|
|
101
|
+
// in `export { applyContainerStyles, aspectRatioToPercent,
|
|
102
|
+
// ScarlettPlayerAPI as default, parseDataAttributes }`, so
|
|
103
|
+
// `module.create` is undefined and `module.default.create` is the
|
|
104
|
+
// function. Loading the module also assigns the same object to
|
|
105
|
+
// window.ScarlettPlayer as a side effect.
|
|
106
|
+
//
|
|
107
|
+
// create() is async, so the null it returns for a missing container
|
|
108
|
+
// or an empty src arrives on the next tick; awaiting it here also
|
|
109
|
+
// routes a failed player creation into the catch below, which is
|
|
110
|
+
// where the viewer-facing error lives.
|
|
111
|
+
return module.default.create(config);
|
|
112
|
+
})
|
|
113
|
+
.then((player) => {
|
|
92
114
|
if (!player) {
|
|
93
115
|
console.error('Failed to create player');
|
|
94
116
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scarlett-player/embed",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Standalone CDN-ready embed package for Scarlett Player",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/embed.umd.cjs",
|
|
@@ -8,19 +8,19 @@
|
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
11
12
|
"import": "./dist/embed.js",
|
|
12
|
-
"require": "./dist/embed.umd.cjs"
|
|
13
|
-
"types": "./dist/index.d.ts"
|
|
13
|
+
"require": "./dist/embed.umd.cjs"
|
|
14
14
|
},
|
|
15
15
|
"./video": {
|
|
16
|
+
"types": "./dist/index-video.d.ts",
|
|
16
17
|
"import": "./dist/embed.video.js",
|
|
17
|
-
"require": "./dist/embed.video.umd.cjs"
|
|
18
|
-
"types": "./dist/index-video.d.ts"
|
|
18
|
+
"require": "./dist/embed.video.umd.cjs"
|
|
19
19
|
},
|
|
20
20
|
"./audio": {
|
|
21
|
+
"types": "./dist/index-audio.d.ts",
|
|
21
22
|
"import": "./dist/embed.audio.js",
|
|
22
|
-
"require": "./dist/embed.audio.umd.cjs"
|
|
23
|
-
"types": "./dist/index-audio.d.ts"
|
|
23
|
+
"require": "./dist/embed.audio.umd.cjs"
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
@@ -50,15 +50,17 @@
|
|
|
50
50
|
"homepage": "https://scarlettplayer.com",
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"hls.js": "^1.6.0",
|
|
53
|
-
"@scarlett-player/core": "1.
|
|
54
|
-
"@scarlett-player/
|
|
55
|
-
"@scarlett-player/
|
|
56
|
-
"@scarlett-player/hls": "1.
|
|
57
|
-
"@scarlett-player/
|
|
58
|
-
"@scarlett-player/
|
|
59
|
-
"@scarlett-player/
|
|
60
|
-
"@scarlett-player/
|
|
61
|
-
"@scarlett-player/
|
|
53
|
+
"@scarlett-player/core": "1.8.0",
|
|
54
|
+
"@scarlett-player/native": "1.8.0",
|
|
55
|
+
"@scarlett-player/audio-ui": "1.8.0",
|
|
56
|
+
"@scarlett-player/hls": "1.8.0",
|
|
57
|
+
"@scarlett-player/analytics": "1.8.0",
|
|
58
|
+
"@scarlett-player/ui": "1.8.0",
|
|
59
|
+
"@scarlett-player/playlist": "1.8.0",
|
|
60
|
+
"@scarlett-player/media-session": "1.8.0",
|
|
61
|
+
"@scarlett-player/watermark": "1.8.0",
|
|
62
|
+
"@scarlett-player/captions": "1.8.0",
|
|
63
|
+
"@scarlett-player/gestures": "1.8.0"
|
|
62
64
|
},
|
|
63
65
|
"devDependencies": {
|
|
64
66
|
"@types/node": "^20.0.0",
|
|
@@ -71,7 +73,7 @@
|
|
|
71
73
|
},
|
|
72
74
|
"scripts": {
|
|
73
75
|
"dev": "vite",
|
|
74
|
-
"build": "tsc && vite build && BUILD_VIDEO=true vite build && BUILD_AUDIO=true vite build",
|
|
76
|
+
"build": "rimraf dist tsconfig.tsbuildinfo && tsc && vite build && BUILD_VIDEO=true vite build && BUILD_AUDIO=true vite build",
|
|
75
77
|
"preview": "vite preview",
|
|
76
78
|
"test": "vitest run",
|
|
77
79
|
"test:watch": "vitest",
|