-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAudioPlayer.js
138 lines (103 loc) · 3.63 KB
/
AudioPlayer.js
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
//import AudioPlayer from 'react-h5-audio-player';
//import 'react-h5-audio-player/lib/styles.css';
import AudioPlayer from 'react-modular-audio-player';
import React, { Component } from 'react';
import './Audio.css';
let playlist = [
{ src: "music/Clarx - Shakedown [NCS Release].mp3",
title: "Song",
artist: "Singer" },
{ src: "music/Billie Eilish Ocean Eyes Official Music.mp3",
title: "Another Song",
artist: "Another Singer" }
];
class Player extends Component {
render() {
return (
<AudioPlayer
audioFiles={playlist}
iconSize="1.1rem"
playIcon="images/play.png"
// playHoverIcon="/playHoverIcon.png"
// pauseIcon="/pauseIcon.png"
// pauseHoverIcon="/pauseIcon.png"
// rewindIcon="/rewindIcon.png"
// rewindHoverIcon="/rewindHoverIcon.png"
// forwardIcon="/forwardIcon.png"
// forwardHoverIcon="/forwardHoverIcon.png"
// volumeIcon="/volumeIcon.png"
// volumeEngagedIcon="/volumeIcon.png"
// muteIcon="/muteIcon.png"
// muteEngagedIcon="/muteIcon.png"
// loopIcon="/loopIcon.png"
// loopEngagedIcon="/loopEngagedIcon.png"
// fontFamily="serif"
// fontSize="1.5rem"
playerWidth="92rem"
/>
);
}
}
export default Player;
// import 'react-h5-audio-player/lib/styles.less' Use LESS
// import 'react-h5-audio-player/src/styles.scss' Use SASS
// import React, { Component } from 'react';
// const playlist = [
// { name: 'y', src: 'music/impact.mp3' },
// { name: 'z', src: 'music/impact2.mp3' },
// { name: 'h', src: 'music/Midranger - Apocalypse [NCS Release].mp3' },
// ];
// class Player extends Component {
// render() {
// return (
// <div>
// <AudioPlayer src="music/impact.mp3"/>
// </div>
// );
// }
// }
// export default Player;
//Workinggggggggggggg
// import React, { Component } from 'react';
// const playlist = [
// { name: '枝芽', src: 'https://hanzluo.s3-us-west-1.amazonaws.com/music/zhiya.mp3' },
// { name: '自由女神', src: 'https://hanzluo.s3-us-west-1.amazonaws.com/music/ziyounvshen.mp3' },
// { name: '无雨无晴', src: 'https://hanzluo.s3-us-west-1.amazonaws.com/music/wuyuwuqing.mp3' },
// { name: '碎片', src: 'https://hanzluo.s3-us-west-1.amazonaws.com/music/suipian.mp3' },
// { name: '永恒的港湾', src: 'https://hanzluo.s3-us-west-1.amazonaws.com/music/yonghengdegangwan.mp3' },
// ]
// interface PlayListState {
// currentMusicIndex: number
// }
// class PlayList extends Component<null, PlayListState> {
// state = {
// currentMusicIndex: 0,
// }
// handleClickPrevious = (): void => {
// this.setState((prevState) => ({
// currentMusicIndex: prevState.currentMusicIndex === 0 ? playlist.length - 1 : prevState.currentMusicIndex - 1,
// }))
// }
// handleClickNext = (): void => {
// this.setState((prevState) => ({
// currentMusicIndex: prevState.currentMusicIndex < playlist.length - 1 ? prevState.currentMusicIndex + 1 : 0,
// }))
// }
// render(): React.ReactNode {
// const { currentMusicIndex } = this.state
// return (
// <div>
// <p>currentMusicIndex: {currentMusicIndex}</p>
// <AudioPlayer
// autoPlayAfterSrcChange={true}
// showSkipControls={true}
// showJumpControls={false}
// src={playlist[currentMusicIndex].src}
// onClickPrevious={this.handleClickPrevious}
// onClickNext={this.handleClickNext}
// />
// </div>
// );
// }
// }
// export default PlayList;