-
Notifications
You must be signed in to change notification settings - Fork 111
/
index.d.ts
164 lines (143 loc) · 4.56 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
import * as React from 'react';
export interface SoundCloud {
audio: HTMLMediaElement;
resolve: (url: string, callback: () => void) => void;
on: (e: string, fn: () => void) => void;
off: (e: string, fn: () => void) => void;
unbindAll: () => void;
preload: (streamUrl: string, preloadType: 'none' | 'metadata' | 'auto') => void;
play: (options?: { streamUrl?: string; playlistIndex?: number }) => void;
pause: () => void;
stop: () => void;
next: (options?: { loop?: boolean }) => void;
seek: (e: Event) => void;
cleanData: () => void;
setVolume: (volumePercentage: number) => void; // percent 0-1
setTime: (setTime: number) => void; // seconds
}
export interface CoverProps {
className?: string;
style?: React.CSSProperties;
children?: React.ReactNode;
backgroundUrl: string;
trackName: string;
artistName: string;
}
export interface NextButtonProps {
className?: string;
style?: React.CSSProperties;
onNextClick?: (e: Event) => void;
}
export interface PlayButtonProps {
className?: string;
style?: React.CSSProperties;
seeking?: boolean;
playing?: boolean;
onTogglePlay?: (e: Event) => void;
seekingIcon?: React.ReactNode;
}
export interface PrevButtonProps {
className?: string;
style?: React.CSSProperties;
onPrevClick?: (e: Event) => void;
}
export interface ProgressProps {
className?: string;
style?: React.CSSProperties;
innerClassName?: string;
innerStyle?: React.CSSProperties;
value?: number; // percent 0-100
onSeekTrack?: (e: Event) => void;
}
export interface TimerProps {
className?: string;
style?: React.CSSProperties;
duration?: string | number; // seconds
currentTime?: string | number; // seconds
}
export interface VolumeControlProps {
className?: string;
style?: React.CSSProperties;
buttonClassName?: string;
rangeClassName?: string;
volume?: number; // percent 0-1
isMuted?: boolean;
onVolumeChange?: (e: Event) => void;
onToggleMute?: (e: Event) => void;
}
declare module 'react-soundplayer/addons' {
export interface WrappedComponentProps {
currentTime: number; // seconds
duration: number; // seconds
isMuted: boolean;
playing: boolean;
preloadType?: 'none' | 'metadata' | 'auto';
seeking: boolean;
loading?: boolean;
soundCloudAudio: SoundCloud;
streamUrl: string;
volume: number; // percent 0-1
}
export interface WithAudioComponentProps {
clientId?: string;
resolveUrl?: string;
streamUrl: WrappedComponentProps['streamUrl'];
preloadType?: WrappedComponentProps['preloadType'];
duration?: WrappedComponentProps['duration']; // seconds
soundCloudAudio?: WrappedComponentProps['soundCloudAudio'];
loading?: WrappedComponentProps['loading'];
onReady?: () => void;
onStartTrack?: () => void;
onStopTrack?: () => void;
onPauseTrack?: () => void;
}
export function withSoundCloudAudio(
WrappedComponent: (props: WrappedComponentProps) => JSX.Element
): React.ComponentType<WithAudioComponentProps>;
export function withCustomAudio(
WrappedComponent: (props: WrappedComponentProps) => JSX.Element
): React.ComponentType<WithAudioComponentProps>;
}
declare module 'react-soundplayer/components' {
export class Cover extends React.Component<CoverProps> {}
export interface IconProps {
children?: React.ReactNode;
}
export const Icons: {
ButtonIconSVG: React.StatelessComponent<IconProps>;
NextIconSVG: React.StatelessComponent;
PauseIconSVG: React.StatelessComponent;
PlayIconSVG: React.StatelessComponent;
PrevIconSVG: React.StatelessComponent;
SoundCloudLogoSVG: React.StatelessComponent;
VolumeIconLoudSVG: React.StatelessComponent;
VolumeIconMuteSVG: React.StatelessComponent;
VolumeIconSVG: React.StatelessComponent<IconProps>;
};
export class NextButton extends React.Component<NextButtonProps> {}
export class PlayButton extends React.Component<PlayButtonProps> {
public static defaultProps: {
playing: false;
seeking: false;
};
}
export class PrevButton extends React.Component<PrevButtonProps> {}
export class Progress extends React.Component<ProgressProps> {
public static defaultProps: {
value: 0; // percent 0-100
};
}
export class Timer extends React.Component<TimerProps> {
public static defaultProps: {
duration: 0; // seconds
currentTime: 0; // seconds
};
public static prettyTime(time: number): string;
}
export class VolumeControl extends React.Component<VolumeControlProps> {
public static defaultProps: {
volume: 1; // percent 0-1
isMuted: false;
};
}
}