react-modern-audio-player 1.1.5 → 1.2.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 +11 -9
- package/dist/index.cjs +62 -62
- package/dist/index.es.js +1189 -7984
- package/dist/types/components/AudioPlayer/Context/StateContext/element.d.ts +1 -2
- package/dist/types/components/AudioPlayer/Context/StateContext/index.d.ts +2 -1
- package/dist/types/components/AudioPlayer/Context/StateContext/placement.d.ts +3 -2
- package/dist/types/components/AudioPlayer/Context/dispatchContext.d.ts +8 -7
- package/dist/types/components/AudioPlayer/Interface/Controller/Input/Progress/BarProgress.d.ts +3 -1
- package/dist/types/components/AudioPlayer/Interface/Controller/Input/Progress/WaveformProgress.d.ts +3 -1
- package/dist/types/components/AudioPlayer/Interface/Controller/Tooltip/Volume/useVolume.d.ts +2 -2
- package/dist/types/components/AudioPlayer/Interface/Information/TrackTime/Current.d.ts +3 -0
- package/dist/types/components/AudioPlayer/Interface/Information/TrackTime/Duration.d.ts +3 -0
- package/dist/types/components/AudioPlayer/Interface/Information/TrackTime/Styles.d.ts +6 -0
- package/dist/types/components/AudioPlayer/Interface/Information/TrackTime/Types.d.ts +4 -0
- package/dist/types/components/AudioPlayer/Interface/Information/TrackTime/index.d.ts +2 -0
- package/dist/types/components/AudioPlayer/Player/index.d.ts +2 -1
- package/dist/types/components/Grid/Grid.d.ts +1 -1
- package/dist/types/components/Provider/AudioPlayerProvider.d.ts +2 -1
- package/dist/types/hooks/index.d.ts +4 -0
- package/dist/types/hooks/useRefsDispatch.d.ts +5 -0
- package/dist/types/utils/generateGridTemplateValues.d.ts +2 -2
- package/dist/types/utils/resetAudioValues.d.ts +2 -9
- package/package.json +9 -4
- package/dist/types/components/AudioPlayer/Interface/Information/TrackTime.d.ts +0 -3
package/README.md
CHANGED
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
</a>
|
|
19
19
|
</p>
|
|
20
20
|
|
|
21
|
+
## DEMO
|
|
22
|
+
https://codesandbox.io/s/basic-ypvpyv?file=/src/App.js
|
|
23
|
+
|
|
21
24
|
# ****Flexible and Customizable UI****
|
|
22
25
|
## This can offer waveform by `wavesurfer.js`
|
|
23
26
|
<img width="100%" src="https://user-images.githubusercontent.com/70849655/180435472-f043dbb4-54df-43e0-bc5c-67492510e817.png" alt="">
|
|
@@ -53,11 +56,10 @@ import AudioPlayer from 'react-modern-audio-player';
|
|
|
53
56
|
const playList = [
|
|
54
57
|
{
|
|
55
58
|
name: 'name',
|
|
56
|
-
writer: '
|
|
59
|
+
writer: 'writer',
|
|
57
60
|
img: 'image.jpg',
|
|
58
61
|
src: 'audio.mp3',
|
|
59
62
|
id: 1,
|
|
60
|
-
index: 0,
|
|
61
63
|
},
|
|
62
64
|
]
|
|
63
65
|
function Player (){
|
|
@@ -80,6 +82,7 @@ interface AudioPlayerProps {
|
|
|
80
82
|
player?: PlayerPlacement;
|
|
81
83
|
playList?: PlayListPlacement;
|
|
82
84
|
interface?: InterfacePlacement;
|
|
85
|
+
volumeSlider?: VolumeSliderPlacement;
|
|
83
86
|
};
|
|
84
87
|
}
|
|
85
88
|
```
|
|
@@ -88,7 +91,7 @@ Prop | Type | Default
|
|
|
88
91
|
--- | --- | ---
|
|
89
92
|
`playList` | [PlayList](#playlist) | [ ]
|
|
90
93
|
`audioInitialState` | [AudioInitialState](#audioinitialstate) | isPlaying: false </br>repeatType: "ALL" </br>volume: 1
|
|
91
|
-
`activeUI` | [ActiveUI](#activeui) | playButton : true
|
|
94
|
+
`activeUI` | [ActiveUI](#activeui) | playButton : true
|
|
92
95
|
`customIcons` | [CustomIcons](#customicons) | undefined
|
|
93
96
|
`coverImgsCss` | [CoverImgsCss](#coverimgscss) | undefined
|
|
94
97
|
`placement` | [Placement](#placement) | playListPlacement : "bottom" </br>interfacePlacement :[DefaultInterfacePlacement](#default-interface-placement)
|
|
@@ -100,7 +103,6 @@ type PlayList = Array<AudioData>;
|
|
|
100
103
|
type AudioData = {
|
|
101
104
|
src: string;
|
|
102
105
|
id: number;
|
|
103
|
-
index: number;
|
|
104
106
|
name?: string | ReactNode;
|
|
105
107
|
writer?: string | ReactNode;
|
|
106
108
|
img?: string;
|
|
@@ -136,12 +138,11 @@ type ActiveUI = {
|
|
|
136
138
|
volume: boolean;
|
|
137
139
|
volumeSlider: boolean;
|
|
138
140
|
repeatType: boolean;
|
|
139
|
-
trackTime:
|
|
141
|
+
trackTime: boolean;
|
|
140
142
|
trackInfo: boolean;
|
|
141
143
|
artwork: boolean;
|
|
142
144
|
progress: ProgressUI;
|
|
143
145
|
};
|
|
144
|
-
type TrackTimeUI = "separation-mode" | "unification-mode" | false;
|
|
145
146
|
type ProgressUI = "waveform" | "bar" | false;
|
|
146
147
|
type PlayListUI = "sortable" | "unSortable" | false;
|
|
147
148
|
```
|
|
@@ -187,8 +188,10 @@ type PlayerPlacement =
|
|
|
187
188
|
|
|
188
189
|
type PlayListPlacement = "bottom" | "top";
|
|
189
190
|
|
|
191
|
+
type VolumeSliderPlacement = "bottom" | "top";
|
|
192
|
+
|
|
190
193
|
type InterfacePlacement = {
|
|
191
|
-
templateArea
|
|
194
|
+
templateArea?: InterfaceGridTemplateArea;
|
|
192
195
|
itemCustomArea?: InterfaceGridItemArea;
|
|
193
196
|
};
|
|
194
197
|
|
|
@@ -201,9 +204,9 @@ type InterfacePlacementValue = "row1-1" | "row1-2" | "row1-3" | "row1-4" | ... m
|
|
|
201
204
|
|
|
202
205
|
type InterfaceGridItemArea = Partial<Record<InterfacePlacementKey, string>>;
|
|
203
206
|
/** example
|
|
204
|
-
* check grid item MDN
|
|
205
207
|
* progress : 2-4
|
|
206
208
|
* repeatBtn : row1-4 / 2 / row1-4 / 10
|
|
209
|
+
* check grid item MDN
|
|
207
210
|
*/
|
|
208
211
|
```
|
|
209
212
|
|
|
@@ -293,7 +296,6 @@ function App() {
|
|
|
293
296
|
}}
|
|
294
297
|
activeUI={{
|
|
295
298
|
all: true,
|
|
296
|
-
trackTime: "separation-mode",
|
|
297
299
|
progress: "waveform",
|
|
298
300
|
}}
|
|
299
301
|
/>
|