|
@@ -77,24 +77,19 @@ var AudioPlayer = function (_React$Component) {
|
77
|
77
|
var src = this.props.src;
|
78
|
78
|
|
79
|
79
|
this.player.oncanplay = function (event) {
|
80
|
|
- console.log(event, 1111);
|
81
|
|
- _this2.setState({ duration: event.target.duration });
|
|
80
|
+ return _this2.setState({ duration: event.target.duration });
|
82
|
81
|
};
|
83
|
|
- this.player.onended = function (event) {
|
84
|
|
- console.log(event, 2222);
|
85
|
|
- _this2.setState({ isPlaying: false, currentDuration: 0 });
|
|
82
|
+ this.player.onended = function () {
|
|
83
|
+ return _this2.setState({ isPlaying: false, currentDuration: 0 });
|
86
|
84
|
};
|
87
|
|
- this.player.onpause = function (event) {
|
88
|
|
- console.log(event, 333);
|
89
|
|
- _this2.setState({ isPlaying: false });
|
|
85
|
+ this.player.onpause = function () {
|
|
86
|
+ return _this2.setState({ isPlaying: false, isLoading: false });
|
90
|
87
|
};
|
91
|
88
|
this.player.onplay = function () {
|
92
|
|
- console.log(event, 5555);
|
93
|
|
- _this2.setState({ isPlaying: true, isLoading: false });
|
|
89
|
+ return _this2.setState({ isPlaying: false, isLoading: true });
|
94
|
90
|
};
|
95
|
|
- this.player.onplaying = function (event) {
|
96
|
|
- console.log(event, 4444);
|
97
|
|
- _this2.setState({ isPlaying: true, isLoading: false });
|
|
91
|
+ this.player.onplaying = function () {
|
|
92
|
+ return _this2.setState({ isPlaying: true, isLoading: false });
|
98
|
93
|
};
|
99
|
94
|
this.player.ontimeupdate = function (event) {
|
100
|
95
|
return _this2.setState({ currentDuration: event.target.currentTime });
|
|
@@ -109,24 +104,19 @@ var AudioPlayer = function (_React$Component) {
|
109
|
104
|
|
110
|
105
|
if (this.props.src !== prevProps.src) {
|
111
|
106
|
this.player.oncanplay = function (event) {
|
112
|
|
- console.log(event, 1111);
|
113
|
|
- _this3.setState({ duration: event.target.duration });
|
|
107
|
+ return _this3.setState({ duration: event.target.duration });
|
114
|
108
|
};
|
115
|
|
- this.player.onended = function (event) {
|
116
|
|
- console.log(event, 2222);
|
117
|
|
- _this3.setState({ isPlaying: false, currentDuration: 0 });
|
|
109
|
+ this.player.onended = function () {
|
|
110
|
+ return _this3.setState({ isPlaying: false, currentDuration: 0 });
|
118
|
111
|
};
|
119
|
|
- this.player.onpause = function (event) {
|
120
|
|
- console.log(event, 333);
|
121
|
|
- _this3.setState({ isPlaying: false });
|
|
112
|
+ this.player.onpause = function () {
|
|
113
|
+ return _this3.setState({ isPlaying: false, isLoading: false });
|
122
|
114
|
};
|
123
|
115
|
this.player.onplay = function () {
|
124
|
|
- console.log(event, 5555);
|
125
|
|
- _this3.setState({ isPlaying: true, isLoading: false });
|
|
116
|
+ return _this3.setState({ isPlaying: false, isLoading: true });
|
126
|
117
|
};
|
127
|
|
- this.player.onplaying = function (event) {
|
128
|
|
- console.log(event, 4444);
|
129
|
|
- _this3.setState({ isPlaying: true, isLoading: false });
|
|
118
|
+ this.player.onplaying = function () {
|
|
119
|
+ return _this3.setState({ isPlaying: true, isLoading: false });
|
130
|
120
|
};
|
131
|
121
|
this.player.ontimeupdate = function (event) {
|
132
|
122
|
return _this3.setState({ currentDuration: event.target.currentTime });
|
|
@@ -153,9 +143,6 @@ var AudioPlayer = function (_React$Component) {
|
153
|
143
|
});
|
154
|
144
|
}
|
155
|
145
|
this.player.play();
|
156
|
|
- this.setState({
|
157
|
|
- isLoading: true
|
158
|
|
- });
|
159
|
146
|
}
|
160
|
147
|
}
|
161
|
148
|
}, {
|