pixuireactcomponents 1.4.1 → 1.4.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixuireactcomponents",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "pixui react components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -37,7 +37,7 @@ var VideoStatus;
37
37
  VideoStatus[VideoStatus["Pause"] = 2] = "Pause";
38
38
  VideoStatus[VideoStatus["End"] = 3] = "End";
39
39
  })(VideoStatus || (VideoStatus = {}));
40
- var openLog = true;
40
+ var openLog = false;
41
41
  var videoLog = function () {
42
42
  var msg = [];
43
43
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -119,7 +119,7 @@ export var VideoPlayer = function (props) {
119
119
  var onSliderDrag = function (value) {
120
120
  var totlaTime = (value / 100) * getDuration();
121
121
  var playSeconds = Math.floor(totlaTime / 1000 + 0.5);
122
- console.log('onSliderDrag, set currentTime:', playSeconds);
122
+ videoLog('onSliderDrag, set currentTime:', playSeconds);
123
123
  setCurrentTime(playSeconds);
124
124
  refVideo.current.currentTime = totlaTime / 1000;
125
125
  };
@@ -182,14 +182,6 @@ export var VideoPlayer = function (props) {
182
182
  }
183
183
  updateSliderHideTimmer();
184
184
  };
185
- if (compRef) {
186
- compRef.current = {
187
- clickComp: onScreenClick,
188
- setShowUI: function (show) {
189
- setShowUI(show, true);
190
- },
191
- };
192
- }
193
185
  var onPause = function () {
194
186
  console.warn('onPause');
195
187
  setVideoStatus(VideoStatus.Pause);
@@ -206,13 +198,32 @@ export var VideoPlayer = function (props) {
206
198
  }
207
199
  else if (videoStatus == VideoStatus.Pause) {
208
200
  refVideo.current.play();
209
- // setShowUI(false);
210
201
  clearInterval(sliderTimmer.current);
211
202
  }
212
203
  else if (videoStatus == VideoStatus.End) {
213
204
  refVideo.current.load();
214
205
  }
215
206
  };
207
+ if (compRef) {
208
+ compRef.current = {
209
+ switchPlayState: switchPlayState,
210
+ setShowUI: function (show) {
211
+ setShowUI(show, true);
212
+ },
213
+ play: function () {
214
+ refVideo.current.play();
215
+ },
216
+ pause: function () {
217
+ refVideo.current.pause();
218
+ },
219
+ load: function () {
220
+ refVideo.current.load();
221
+ },
222
+ getPlayStatus: function () {
223
+ return videoStatus;
224
+ },
225
+ };
226
+ }
216
227
  videoLog('currentTime', currentTime, 'totalTime', totalTime);
217
228
  return (h("div", { className: rootClassName, ref: rootRef },
218
229
  h("video", { ref: refVideo, src: playUrl, "object-fit": "no", autoPlay: autoPlay, style: { width: '100%', height: '100%' }, onPlaying: onplaying, onPlay: onplaying, onError: onerror, onEnded: onended, onPause: onpause, onLoadStart: function () {
@@ -230,7 +241,9 @@ export var VideoPlayer = function (props) {
230
241
  ? elementClass === null || elementClass === void 0 ? void 0 : elementClass.pauseIcon
231
242
  : videoStatus == VideoStatus.Pause
232
243
  ? elementClass === null || elementClass === void 0 ? void 0 : elementClass.playIcon
233
- : elementClass === null || elementClass === void 0 ? void 0 : elementClass.reloadIcon, onClick: function (e) {
244
+ : videoStatus == VideoStatus.Loading
245
+ ? elementClass === null || elementClass === void 0 ? void 0 : elementClass.loadingIcon
246
+ : elementClass === null || elementClass === void 0 ? void 0 : elementClass.reloadIcon, onClick: function (e) {
234
247
  e.stopPropagation();
235
248
  switchPlayState();
236
249
  } })) : null),