|
@@ -77,24 +77,24 @@ var AudioPlayer = function (_React$Component) {
|
77
|
77
|
var src = this.props.src;
|
78
|
78
|
|
79
|
79
|
this.player.oncanplay = function (event) {
|
80
|
|
- return _this2.setState({
|
81
|
|
- duration: event.target.duration,
|
82
|
|
- isLoading: false,
|
83
|
|
- isPlaying: true
|
84
|
|
- });
|
|
80
|
+ console.log(event, 1111);
|
|
81
|
+ _this2.setState({ duration: event.target.duration });
|
85
|
82
|
};
|
86
|
|
- this.player.onended = function () {
|
87
|
|
- return _this2.setState({
|
88
|
|
- isPlaying: false,
|
89
|
|
- currentDuration: 0,
|
90
|
|
- isLoading: false
|
91
|
|
- });
|
|
83
|
+ this.player.onended = function (event) {
|
|
84
|
+ console.log(event, 2222);
|
|
85
|
+ _this2.setState({ isPlaying: false, currentDuration: 0 });
|
92
|
86
|
};
|
93
|
|
- this.player.onpause = function () {
|
94
|
|
- return _this2.setState({ isPlaying: false, isLoading: false });
|
|
87
|
+ this.player.onpause = function (event) {
|
|
88
|
+ console.log(event, 333);
|
|
89
|
+ _this2.setState({ isPlaying: false });
|
95
|
90
|
};
|
96
|
91
|
this.player.onplay = function () {
|
97
|
|
- return _this2.setState({ isLoading: true });
|
|
92
|
+ console.log(event, 5555);
|
|
93
|
+ _this2.setState({ isPlaying: true, isLoading: false });
|
|
94
|
+ };
|
|
95
|
+ this.player.onplaying = function (event) {
|
|
96
|
+ console.log(event, 4444);
|
|
97
|
+ _this2.setState({ isPlaying: true, isLoading: false });
|
98
|
98
|
};
|
99
|
99
|
this.player.ontimeupdate = function (event) {
|
100
|
100
|
return _this2.setState({ currentDuration: event.target.currentTime });
|
|
@@ -109,24 +109,24 @@ var AudioPlayer = function (_React$Component) {
|
109
|
109
|
|
110
|
110
|
if (this.props.src !== prevProps.src) {
|
111
|
111
|
this.player.oncanplay = function (event) {
|
112
|
|
- return _this3.setState({
|
113
|
|
- duration: event.target.duration,
|
114
|
|
- isLoading: false,
|
115
|
|
- isPlaying: true
|
116
|
|
- });
|
|
112
|
+ console.log(event, 1111);
|
|
113
|
+ _this3.setState({ duration: event.target.duration });
|
117
|
114
|
};
|
118
|
|
- this.player.onended = function () {
|
119
|
|
- return _this3.setState({
|
120
|
|
- isPlaying: false,
|
121
|
|
- currentDuration: 0,
|
122
|
|
- isLoading: false
|
123
|
|
- });
|
|
115
|
+ this.player.onended = function (event) {
|
|
116
|
+ console.log(event, 2222);
|
|
117
|
+ _this3.setState({ isPlaying: false, currentDuration: 0 });
|
124
|
118
|
};
|
125
|
|
- this.player.onpause = function () {
|
126
|
|
- return _this3.setState({ isPlaying: false, isLoading: false });
|
|
119
|
+ this.player.onpause = function (event) {
|
|
120
|
+ console.log(event, 333);
|
|
121
|
+ _this3.setState({ isPlaying: false });
|
127
|
122
|
};
|
128
|
123
|
this.player.onplay = function () {
|
129
|
|
- return _this3.setState({ isLoading: true });
|
|
124
|
+ console.log(event, 5555);
|
|
125
|
+ _this3.setState({ isPlaying: true, isLoading: false });
|
|
126
|
+ };
|
|
127
|
+ this.player.onplaying = function (event) {
|
|
128
|
+ console.log(event, 4444);
|
|
129
|
+ _this3.setState({ isPlaying: true, isLoading: false });
|
130
|
130
|
};
|
131
|
131
|
this.player.ontimeupdate = function (event) {
|
132
|
132
|
return _this3.setState({ currentDuration: event.target.currentTime });
|
|
@@ -153,6 +153,9 @@ var AudioPlayer = function (_React$Component) {
|
153
|
153
|
});
|
154
|
154
|
}
|
155
|
155
|
this.player.play();
|
|
156
|
+ this.setState({
|
|
157
|
+ isLoading: true
|
|
158
|
+ });
|
156
|
159
|
}
|
157
|
160
|
}
|
158
|
161
|
}, {
|
|
@@ -165,7 +168,7 @@ var AudioPlayer = function (_React$Component) {
|
165
|
168
|
var playIconElem = void 0;
|
166
|
169
|
|
167
|
170
|
if (isLoading) {
|
168
|
|
- playIconElem = _react2.default.createElement("img", { src: _loading2.default, alt: "iconLoading" });
|
|
171
|
+ playIconElem = _react2.default.createElement("img", { className: "icon-loading", src: _loading2.default, alt: "iconLoading" });
|
169
|
172
|
} else if (isPlaying) {
|
170
|
173
|
playIconElem = _react2.default.createElement(_icon2.default, { className: "pause", type: "pause" });
|
171
|
174
|
} else {
|