|
1 | 1 | import { VNode } from 'vue';
|
2 | 2 |
|
3 |
| -declare global { |
4 |
| - namespace APlayer { |
5 |
| - export interface InstallOptions { |
6 |
| - defaultCover?: string; |
7 |
| - productionTip?: boolean; |
8 |
| - } |
| 3 | +export interface InstallOptions { |
| 4 | + defaultCover?: string; |
| 5 | + productionTip?: boolean; |
| 6 | +} |
9 | 7 |
|
10 |
| - export type LoopMode = 'all' | 'one' | 'none'; |
11 |
| - export type OrderMode = 'list' | 'random'; |
12 |
| - export type Preload = 'none' | 'metadata' | 'auto'; |
13 |
| - export type AudioType = 'auto' | 'hls' | 'normal'; |
| 8 | +export type LoopMode = 'all' | 'one' | 'none'; |
| 9 | +export type OrderMode = 'list' | 'random'; |
| 10 | +export type Preload = 'none' | 'metadata' | 'auto'; |
| 11 | +export type AudioType = 'auto' | 'hls' | 'normal'; |
14 | 12 |
|
15 |
| - export enum LrcType { |
16 |
| - file = 3, |
17 |
| - html = 2, // not support |
18 |
| - string = 1, |
19 |
| - disabled = 0, |
20 |
| - } |
| 13 | +export enum LrcType { |
| 14 | + file = 3, |
| 15 | + html = 2, // not support |
| 16 | + string = 1, |
| 17 | + disabled = 0, |
| 18 | +} |
21 | 19 |
|
22 |
| - export interface Audio { |
23 |
| - [index: number]: this; |
| 20 | +export interface Audio { |
| 21 | + [index: number]: this; |
24 | 22 |
|
25 |
| - id?: number; |
26 |
| - name: string | VNode; // eslint-disable-line no-restricted-globals |
27 |
| - artist: string | VNode; |
28 |
| - url: string; |
29 |
| - cover?: string; |
30 |
| - lrc?: string; |
31 |
| - theme?: string; |
32 |
| - type?: AudioType; |
33 |
| - speed?: number; |
34 |
| - } |
| 23 | + id?: number; |
| 24 | + name: string | VNode; // eslint-disable-line no-restricted-globals |
| 25 | + artist: string | VNode; |
| 26 | + url: string; |
| 27 | + cover?: string; |
| 28 | + lrc?: string; |
| 29 | + theme?: string; |
| 30 | + type?: AudioType; |
| 31 | + speed?: number; |
| 32 | +} |
35 | 33 |
|
36 |
| - export interface Options { |
37 |
| - fixed?: boolean; |
38 |
| - mini?: boolean; |
39 |
| - autoplay?: boolean; |
40 |
| - theme?: string; |
41 |
| - loop?: LoopMode; |
42 |
| - order?: OrderMode; |
43 |
| - preload?: Preload; |
44 |
| - volume?: number; |
45 |
| - audio: Audio | Audio[]; |
46 |
| - customAudioType?: any; |
47 |
| - mutex?: boolean; |
48 |
| - lrcType?: LrcType; |
49 |
| - listFolded?: boolean; |
50 |
| - listMaxHeight?: number; |
51 |
| - storageName?: string; |
52 |
| - } |
| 34 | +export interface Options { |
| 35 | + fixed?: boolean; |
| 36 | + mini?: boolean; |
| 37 | + autoplay?: boolean; |
| 38 | + theme?: string; |
| 39 | + loop?: LoopMode; |
| 40 | + order?: OrderMode; |
| 41 | + preload?: Preload; |
| 42 | + volume?: number; |
| 43 | + audio: Audio | Audio[]; |
| 44 | + customAudioType?: any; |
| 45 | + mutex?: boolean; |
| 46 | + lrcType?: LrcType; |
| 47 | + listFolded?: boolean; |
| 48 | + listMaxHeight?: number; |
| 49 | + storageName?: string; |
| 50 | +} |
53 | 51 |
|
54 |
| - export interface Events { |
55 |
| - onAbort: Event; |
56 |
| - onCanplay: Event; |
57 |
| - onCanplaythrough: Event; |
58 |
| - onDurationchange: Event; |
59 |
| - onEmptied: Event; |
60 |
| - onEnded: Event; |
61 |
| - onError: Event; |
62 |
| - onLoadeddata: Event; |
63 |
| - onLoadedmetadata: Event; |
64 |
| - onLoadstart: Event; |
65 |
| - onPause: Event; |
66 |
| - onPlay: Event; |
67 |
| - onPlaying: Event; |
68 |
| - onProgress: Event; |
69 |
| - onRatechange: Event; |
70 |
| - onReadystatechange: Event; |
71 |
| - onSeeked: Event; |
72 |
| - onSeeking: Event; |
73 |
| - onStalled: Event; |
74 |
| - onSuspend: Event; |
75 |
| - onTimeupdate: Event; |
76 |
| - onVolumechange: Event; |
77 |
| - onWaiting: Event; |
| 52 | +export interface Events { |
| 53 | + onAbort: Event; |
| 54 | + onCanplay: Event; |
| 55 | + onCanplaythrough: Event; |
| 56 | + onDurationchange: Event; |
| 57 | + onEmptied: Event; |
| 58 | + onEnded: Event; |
| 59 | + onError: Event; |
| 60 | + onLoadeddata: Event; |
| 61 | + onLoadedmetadata: Event; |
| 62 | + onLoadstart: Event; |
| 63 | + onPause: Event; |
| 64 | + onPlay: Event; |
| 65 | + onPlaying: Event; |
| 66 | + onProgress: Event; |
| 67 | + onRatechange: Event; |
| 68 | + onReadystatechange: Event; |
| 69 | + onSeeked: Event; |
| 70 | + onSeeking: Event; |
| 71 | + onStalled: Event; |
| 72 | + onSuspend: Event; |
| 73 | + onTimeupdate: Event; |
| 74 | + onVolumechange: Event; |
| 75 | + onWaiting: Event; |
78 | 76 |
|
79 |
| - onListSwitch: Audio; |
80 |
| - onListShow: void; |
81 |
| - onListHide: void; |
82 |
| - onListAdd: void; |
83 |
| - onListRemove: void; |
84 |
| - onListClear: void; |
85 |
| - onNoticeShow: void; |
86 |
| - onNoticeHide: void; |
87 |
| - onLrcShow: void; |
88 |
| - onLrcHide: void; |
89 |
| - onDestroy: void; |
90 |
| - } |
| 77 | + onListSwitch: Audio; |
| 78 | + onListShow: void; |
| 79 | + onListHide: void; |
| 80 | + onListAdd: void; |
| 81 | + onListRemove: void; |
| 82 | + onListClear: void; |
| 83 | + onNoticeShow: void; |
| 84 | + onNoticeHide: void; |
| 85 | + onLrcShow: void; |
| 86 | + onLrcHide: void; |
| 87 | + onDestroy: void; |
| 88 | +} |
91 | 89 |
|
92 |
| - export interface Settings { |
93 |
| - currentTime: number; |
94 |
| - duration: number | null; |
95 |
| - paused: boolean; |
96 |
| - mini: boolean; |
97 |
| - lrc: boolean; |
98 |
| - list: boolean; |
99 |
| - volume: number; |
100 |
| - loop: LoopMode; |
101 |
| - order: OrderMode; |
102 |
| - music: Audio | null; |
103 |
| - } |
| 90 | +export interface Settings { |
| 91 | + currentTime: number; |
| 92 | + duration: number | null; |
| 93 | + paused: boolean; |
| 94 | + mini: boolean; |
| 95 | + lrc: boolean; |
| 96 | + list: boolean; |
| 97 | + volume: number; |
| 98 | + loop: LoopMode; |
| 99 | + order: OrderMode; |
| 100 | + music: Audio | null; |
| 101 | +} |
104 | 102 |
|
105 |
| - export interface Media { |
106 |
| - /** 返回表示可用音频轨道的 AudioTrackList 对象。 */ |
107 |
| - readonly audioTracks: AudioTrackList; |
108 |
| - /** 设置或返回是否在就绪(加载完成)后随即播放音频。 */ |
109 |
| - readonly autoplay: boolean; |
110 |
| - /** 返回表示音频已缓冲部分的 TimeRanges 对象。 */ |
111 |
| - readonly buffered: TimeRanges; |
112 |
| - /** 设置或返回音频是否应该显示控件(比如播放/暂停等)。 */ |
113 |
| - readonly controls: boolean; |
114 |
| - /** 设置或返回音频的 CORS 设置。 */ |
115 |
| - readonly crossOrigin: string | null; |
116 |
| - /** 返回当前音频的 URL。 */ |
117 |
| - readonly currentSrc: string; |
118 |
| - /** 设置或返回音频中的当前播放位置(以秒计)。 */ |
119 |
| - readonly currentTime: number; |
120 |
| - /** 设置或返回音频默认是否静音。 */ |
121 |
| - readonly defaultMuted: boolean; |
122 |
| - /** 设置或返回音频的默认播放速度。 */ |
123 |
| - readonly defaultPlaybackRate: number; |
124 |
| - /** 返回音频的长度(以秒计)。 */ |
125 |
| - readonly duration: number; |
126 |
| - /** 返回音频的播放是否已结束。 */ |
127 |
| - readonly ended: boolean; |
128 |
| - /** 返回表示音频错误状态的 MediaError 对象。 */ |
129 |
| - readonly error: MediaError | null; |
130 |
| - /** 设置或返回音频是否应在结束时再次播放。 */ |
131 |
| - readonly loop: boolean; |
132 |
| - /** 设置或返回音频所属媒介组合的名称。 */ |
133 |
| - readonly mediaKeys: MediaKeys | null; |
134 |
| - /** 设置或返回是否关闭声音。 */ |
135 |
| - readonly muted: boolean; |
136 |
| - /** 返回音频的当前网络状态。 */ |
137 |
| - readonly networkState: number; |
138 |
| - /** 设置或返回音频是否暂停。 */ |
139 |
| - readonly paused: boolean; |
140 |
| - /** 设置或返回音频播放的速度。 */ |
141 |
| - readonly playbackRate: number; |
142 |
| - /** 返回表示音频已播放部分的 TimeRanges 对象。 */ |
143 |
| - readonly played: TimeRanges; |
144 |
| - /** 设置或返回音频的 preload 属性的值。 */ |
145 |
| - readonly preload: string; |
146 |
| - /** 返回音频当前的就绪状态。 */ |
147 |
| - readonly readyState: number; |
148 |
| - /** 返回表示音频可寻址部分的 TimeRanges 对象。 */ |
149 |
| - readonly seekable: TimeRanges; |
150 |
| - /** 返回用户当前是否正在音频中进行查找。 */ |
151 |
| - readonly seeking: boolean; |
152 |
| - /** 设置或返回音频的 src 属性的值。 */ |
153 |
| - readonly src: string; |
154 |
| - /** 返回表示可用文本轨道的 TextTrackList 对象。 */ |
155 |
| - readonly textTracks: TextTrackList; |
156 |
| - /** 设置或返回音频的音量。 */ |
157 |
| - readonly volume: number; |
158 |
| - } |
159 |
| - } |
| 103 | +export interface Media { |
| 104 | + /** 返回表示可用音频轨道的 AudioTrackList 对象。 */ |
| 105 | + readonly audioTracks: AudioTrackList; |
| 106 | + /** 设置或返回是否在就绪(加载完成)后随即播放音频。 */ |
| 107 | + readonly autoplay: boolean; |
| 108 | + /** 返回表示音频已缓冲部分的 TimeRanges 对象。 */ |
| 109 | + readonly buffered: TimeRanges; |
| 110 | + /** 设置或返回音频是否应该显示控件(比如播放/暂停等)。 */ |
| 111 | + readonly controls: boolean; |
| 112 | + /** 设置或返回音频的 CORS 设置。 */ |
| 113 | + readonly crossOrigin: string | null; |
| 114 | + /** 返回当前音频的 URL。 */ |
| 115 | + readonly currentSrc: string; |
| 116 | + /** 设置或返回音频中的当前播放位置(以秒计)。 */ |
| 117 | + readonly currentTime: number; |
| 118 | + /** 设置或返回音频默认是否静音。 */ |
| 119 | + readonly defaultMuted: boolean; |
| 120 | + /** 设置或返回音频的默认播放速度。 */ |
| 121 | + readonly defaultPlaybackRate: number; |
| 122 | + /** 返回音频的长度(以秒计)。 */ |
| 123 | + readonly duration: number; |
| 124 | + /** 返回音频的播放是否已结束。 */ |
| 125 | + readonly ended: boolean; |
| 126 | + /** 返回表示音频错误状态的 MediaError 对象。 */ |
| 127 | + readonly error: MediaError | null; |
| 128 | + /** 设置或返回音频是否应在结束时再次播放。 */ |
| 129 | + readonly loop: boolean; |
| 130 | + /** 设置或返回音频所属媒介组合的名称。 */ |
| 131 | + readonly mediaKeys: MediaKeys | null; |
| 132 | + /** 设置或返回是否关闭声音。 */ |
| 133 | + readonly muted: boolean; |
| 134 | + /** 返回音频的当前网络状态。 */ |
| 135 | + readonly networkState: number; |
| 136 | + /** 设置或返回音频是否暂停。 */ |
| 137 | + readonly paused: boolean; |
| 138 | + /** 设置或返回音频播放的速度。 */ |
| 139 | + readonly playbackRate: number; |
| 140 | + /** 返回表示音频已播放部分的 TimeRanges 对象。 */ |
| 141 | + readonly played: TimeRanges; |
| 142 | + /** 设置或返回音频的 preload 属性的值。 */ |
| 143 | + readonly preload: string; |
| 144 | + /** 返回音频当前的就绪状态。 */ |
| 145 | + readonly readyState: number; |
| 146 | + /** 返回表示音频可寻址部分的 TimeRanges 对象。 */ |
| 147 | + readonly seekable: TimeRanges; |
| 148 | + /** 返回用户当前是否正在音频中进行查找。 */ |
| 149 | + readonly seeking: boolean; |
| 150 | + /** 设置或返回音频的 src 属性的值。 */ |
| 151 | + readonly src: string; |
| 152 | + /** 返回表示可用文本轨道的 TextTrackList 对象。 */ |
| 153 | + readonly textTracks: TextTrackList; |
| 154 | + /** 设置或返回音频的音量。 */ |
| 155 | + readonly volume: number; |
160 | 156 | }
|
0 commit comments