@sweet-player/core 0.2.1 → 0.3.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 +24 -6
- package/dist/index.cjs +264 -46
- package/dist/index.d.cts +24 -4
- package/dist/index.d.ts +24 -4
- package/dist/index.js +263 -46
- package/dist/sweet-player.global.js +156 -24
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -17,6 +17,8 @@ interface LongSeekOptions {
|
|
|
17
17
|
/** 每隔多少毫秒升一档,默认 2000 */
|
|
18
18
|
stepUpInterval?: number;
|
|
19
19
|
}
|
|
20
|
+
/** 可通过 hiddenControls 隐藏的 UI 功能名(只影响显示,不影响 API 与快捷键) */
|
|
21
|
+
type ControlName = 'prev' | 'seekBack' | 'play' | 'seekForward' | 'next' | 'time' | 'rate' | 'quality' | 'ratio' | 'audioTrack' | 'volume' | 'pip' | 'fullscreen' | 'title' | 'progress' | 'contextMenu';
|
|
20
22
|
/** 播放器插件:apply 在实例化末尾调用,可返回清理函数(destroy 时执行) */
|
|
21
23
|
interface SweetPlayerPlugin {
|
|
22
24
|
name: string;
|
|
@@ -66,6 +68,8 @@ interface SweetPlayerOptions {
|
|
|
66
68
|
locale?: string;
|
|
67
69
|
/** 覆盖部分 UI 文案 */
|
|
68
70
|
localeStrings?: Record<string, string>;
|
|
71
|
+
/** 不显示的 UI 功能集合,默认全部显示(只影响显示,不影响 API 与快捷键) */
|
|
72
|
+
hiddenControls?: ControlName[];
|
|
69
73
|
/** 插件列表,实例化末尾依次 apply */
|
|
70
74
|
plugins?: SweetPlayerPlugin[];
|
|
71
75
|
/** 透传给 hls.js 的配置 */
|
|
@@ -107,6 +111,7 @@ interface PlayerEventMap {
|
|
|
107
111
|
type PlayerEventName = keyof PlayerEventMap;
|
|
108
112
|
|
|
109
113
|
declare class SweetPlayer {
|
|
114
|
+
static readonly version: string;
|
|
110
115
|
readonly container: HTMLElement;
|
|
111
116
|
readonly video: HTMLVideoElement;
|
|
112
117
|
private emitter;
|
|
@@ -116,14 +121,14 @@ declare class SweetPlayer {
|
|
|
116
121
|
private controls;
|
|
117
122
|
private osd;
|
|
118
123
|
private stats;
|
|
124
|
+
private shortcutsPanel;
|
|
119
125
|
private state;
|
|
126
|
+
private contextMenu;
|
|
120
127
|
private i18n;
|
|
121
128
|
private options;
|
|
122
129
|
private hideTimer;
|
|
123
130
|
private clickTimer;
|
|
124
131
|
private progressTimer;
|
|
125
|
-
private titleClicks;
|
|
126
|
-
private lastTitleClick;
|
|
127
132
|
private currentRatio;
|
|
128
133
|
/** 画质/音轨菜单当前是否由 hls.js 自动接管(业务 setQualities 会关闭) */
|
|
129
134
|
private hlsManagedQuality;
|
|
@@ -165,7 +170,6 @@ declare class SweetPlayer {
|
|
|
165
170
|
private bindPersistence;
|
|
166
171
|
private bindProgressMemory;
|
|
167
172
|
private saveProgressNow;
|
|
168
|
-
private handleTitleClick;
|
|
169
173
|
private bindMediaEvents;
|
|
170
174
|
private showErrorState;
|
|
171
175
|
private showErrorStateUi;
|
|
@@ -175,6 +179,8 @@ declare class SweetPlayer {
|
|
|
175
179
|
private bindActivityTracking;
|
|
176
180
|
}
|
|
177
181
|
|
|
182
|
+
declare const VERSION: string;
|
|
183
|
+
|
|
178
184
|
interface LocaleStrings {
|
|
179
185
|
play: string;
|
|
180
186
|
pause: string;
|
|
@@ -203,9 +209,23 @@ interface LocaleStrings {
|
|
|
203
209
|
cancel: string;
|
|
204
210
|
loadError: string;
|
|
205
211
|
retry: string;
|
|
212
|
+
changelog: string;
|
|
213
|
+
videoInfo: string;
|
|
214
|
+
shortcuts: string;
|
|
215
|
+
close: string;
|
|
216
|
+
scKeySpace: string;
|
|
217
|
+
scKeyHold: string;
|
|
218
|
+
scPlayPause: string;
|
|
219
|
+
scSeek: string;
|
|
220
|
+
scLongSeek: string;
|
|
221
|
+
scVolume: string;
|
|
222
|
+
scFullscreen: string;
|
|
223
|
+
scMute: string;
|
|
224
|
+
copyLog: string;
|
|
225
|
+
logCopied: string;
|
|
206
226
|
}
|
|
207
227
|
type LocaleName = 'zh-CN' | 'en' | (string & {});
|
|
208
228
|
/** 注册自定义语言包(全局) */
|
|
209
229
|
declare function registerLocale(name: string, strings: LocaleStrings): void;
|
|
210
230
|
|
|
211
|
-
export { type AspectRatio, type AudioTrackInfo, type LocaleName, type LocaleStrings, type LongSeekOptions, type PlayerEventMap, type PlayerEventName, type QualityLevel, SweetPlayer, type SweetPlayerLike, type SweetPlayerOptions, type SweetPlayerPlugin, registerLocale };
|
|
231
|
+
export { type AspectRatio, type AudioTrackInfo, type ControlName, type LocaleName, type LocaleStrings, type LongSeekOptions, type PlayerEventMap, type PlayerEventName, type QualityLevel, SweetPlayer, type SweetPlayerLike, type SweetPlayerOptions, type SweetPlayerPlugin, VERSION, registerLocale };
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ interface LongSeekOptions {
|
|
|
17
17
|
/** 每隔多少毫秒升一档,默认 2000 */
|
|
18
18
|
stepUpInterval?: number;
|
|
19
19
|
}
|
|
20
|
+
/** 可通过 hiddenControls 隐藏的 UI 功能名(只影响显示,不影响 API 与快捷键) */
|
|
21
|
+
type ControlName = 'prev' | 'seekBack' | 'play' | 'seekForward' | 'next' | 'time' | 'rate' | 'quality' | 'ratio' | 'audioTrack' | 'volume' | 'pip' | 'fullscreen' | 'title' | 'progress' | 'contextMenu';
|
|
20
22
|
/** 播放器插件:apply 在实例化末尾调用,可返回清理函数(destroy 时执行) */
|
|
21
23
|
interface SweetPlayerPlugin {
|
|
22
24
|
name: string;
|
|
@@ -66,6 +68,8 @@ interface SweetPlayerOptions {
|
|
|
66
68
|
locale?: string;
|
|
67
69
|
/** 覆盖部分 UI 文案 */
|
|
68
70
|
localeStrings?: Record<string, string>;
|
|
71
|
+
/** 不显示的 UI 功能集合,默认全部显示(只影响显示,不影响 API 与快捷键) */
|
|
72
|
+
hiddenControls?: ControlName[];
|
|
69
73
|
/** 插件列表,实例化末尾依次 apply */
|
|
70
74
|
plugins?: SweetPlayerPlugin[];
|
|
71
75
|
/** 透传给 hls.js 的配置 */
|
|
@@ -107,6 +111,7 @@ interface PlayerEventMap {
|
|
|
107
111
|
type PlayerEventName = keyof PlayerEventMap;
|
|
108
112
|
|
|
109
113
|
declare class SweetPlayer {
|
|
114
|
+
static readonly version: string;
|
|
110
115
|
readonly container: HTMLElement;
|
|
111
116
|
readonly video: HTMLVideoElement;
|
|
112
117
|
private emitter;
|
|
@@ -116,14 +121,14 @@ declare class SweetPlayer {
|
|
|
116
121
|
private controls;
|
|
117
122
|
private osd;
|
|
118
123
|
private stats;
|
|
124
|
+
private shortcutsPanel;
|
|
119
125
|
private state;
|
|
126
|
+
private contextMenu;
|
|
120
127
|
private i18n;
|
|
121
128
|
private options;
|
|
122
129
|
private hideTimer;
|
|
123
130
|
private clickTimer;
|
|
124
131
|
private progressTimer;
|
|
125
|
-
private titleClicks;
|
|
126
|
-
private lastTitleClick;
|
|
127
132
|
private currentRatio;
|
|
128
133
|
/** 画质/音轨菜单当前是否由 hls.js 自动接管(业务 setQualities 会关闭) */
|
|
129
134
|
private hlsManagedQuality;
|
|
@@ -165,7 +170,6 @@ declare class SweetPlayer {
|
|
|
165
170
|
private bindPersistence;
|
|
166
171
|
private bindProgressMemory;
|
|
167
172
|
private saveProgressNow;
|
|
168
|
-
private handleTitleClick;
|
|
169
173
|
private bindMediaEvents;
|
|
170
174
|
private showErrorState;
|
|
171
175
|
private showErrorStateUi;
|
|
@@ -175,6 +179,8 @@ declare class SweetPlayer {
|
|
|
175
179
|
private bindActivityTracking;
|
|
176
180
|
}
|
|
177
181
|
|
|
182
|
+
declare const VERSION: string;
|
|
183
|
+
|
|
178
184
|
interface LocaleStrings {
|
|
179
185
|
play: string;
|
|
180
186
|
pause: string;
|
|
@@ -203,9 +209,23 @@ interface LocaleStrings {
|
|
|
203
209
|
cancel: string;
|
|
204
210
|
loadError: string;
|
|
205
211
|
retry: string;
|
|
212
|
+
changelog: string;
|
|
213
|
+
videoInfo: string;
|
|
214
|
+
shortcuts: string;
|
|
215
|
+
close: string;
|
|
216
|
+
scKeySpace: string;
|
|
217
|
+
scKeyHold: string;
|
|
218
|
+
scPlayPause: string;
|
|
219
|
+
scSeek: string;
|
|
220
|
+
scLongSeek: string;
|
|
221
|
+
scVolume: string;
|
|
222
|
+
scFullscreen: string;
|
|
223
|
+
scMute: string;
|
|
224
|
+
copyLog: string;
|
|
225
|
+
logCopied: string;
|
|
206
226
|
}
|
|
207
227
|
type LocaleName = 'zh-CN' | 'en' | (string & {});
|
|
208
228
|
/** 注册自定义语言包(全局) */
|
|
209
229
|
declare function registerLocale(name: string, strings: LocaleStrings): void;
|
|
210
230
|
|
|
211
|
-
export { type AspectRatio, type AudioTrackInfo, type LocaleName, type LocaleStrings, type LongSeekOptions, type PlayerEventMap, type PlayerEventName, type QualityLevel, SweetPlayer, type SweetPlayerLike, type SweetPlayerOptions, type SweetPlayerPlugin, registerLocale };
|
|
231
|
+
export { type AspectRatio, type AudioTrackInfo, type ControlName, type LocaleName, type LocaleStrings, type LongSeekOptions, type PlayerEventMap, type PlayerEventName, type QualityLevel, SweetPlayer, type SweetPlayerLike, type SweetPlayerOptions, type SweetPlayerPlugin, VERSION, registerLocale };
|