Allen 5 lat temu
rodzic
commit
66a30f487a

+ 32
- 29
lib/components/AudioPlayer/index.js Wyświetl plik

77
         var src = this.props.src;
77
         var src = this.props.src;
78
 
78
 
79
         this.player.oncanplay = function (event) {
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
         this.player.onplay = function () {
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
         this.player.ontimeupdate = function (event) {
99
         this.player.ontimeupdate = function (event) {
100
           return _this2.setState({ currentDuration: event.target.currentTime });
100
           return _this2.setState({ currentDuration: event.target.currentTime });
109
 
109
 
110
       if (this.props.src !== prevProps.src) {
110
       if (this.props.src !== prevProps.src) {
111
         this.player.oncanplay = function (event) {
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
         this.player.onplay = function () {
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
         this.player.ontimeupdate = function (event) {
131
         this.player.ontimeupdate = function (event) {
132
           return _this3.setState({ currentDuration: event.target.currentTime });
132
           return _this3.setState({ currentDuration: event.target.currentTime });
153
           });
153
           });
154
         }
154
         }
155
         this.player.play();
155
         this.player.play();
156
+        this.setState({
157
+          isLoading: true
158
+        });
156
       }
159
       }
157
     }
160
     }
158
   }, {
161
   }, {
165
       var playIconElem = void 0;
168
       var playIconElem = void 0;
166
 
169
 
167
       if (isLoading) {
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
       } else if (isPlaying) {
172
       } else if (isPlaying) {
170
         playIconElem = _react2.default.createElement(_icon2.default, { className: "pause", type: "pause" });
173
         playIconElem = _react2.default.createElement(_icon2.default, { className: "pause", type: "pause" });
171
       } else {
174
       } else {

+ 1
- 1
lib/components/AudioPlayer/index.js.map
Plik diff jest za duży
Wyświetl plik


+ 5
- 0
lib/components/AudioPlayer/index.less Wyświetl plik

19
     font-size: 14px;
19
     font-size: 14px;
20
   }
20
   }
21
 
21
 
22
+  .icon-loading {
23
+    width: 100%;
24
+    height: 100%;
25
+  }
26
+
22
   .slider {
27
   .slider {
23
     margin: 0 0 0 16px;
28
     margin: 0 0 0 16px;
24
     width: 195px;
29
     width: 195px;

+ 3
- 3
lib/version.json Wyświetl plik

1
 {
1
 {
2
     "name":       "comment",
2
     "name":       "comment",
3
-    "buildDate":  1588410272677,
3
+    "buildDate":  1588435719936,
4
     "version":    "1.0.4",
4
     "version":    "1.0.4",
5
-    "numCommits": 213,
6
-    "hash":       "f79e8f9",
5
+    "numCommits": 215,
6
+    "hash":       "7d03c9b",
7
     "dirty":      true
7
     "dirty":      true
8
 }
8
 }