pixuireactcomponents 1.4.2 → 1.4.4
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
|
@@ -49,13 +49,13 @@ var videoLog = function () {
|
|
|
49
49
|
};
|
|
50
50
|
export var VideoPlayer = function (props) {
|
|
51
51
|
var _a;
|
|
52
|
-
var
|
|
52
|
+
var _b = props.playUrl, playUrl = _b === void 0 ? '' : _b, _c = props.autoPlay, autoPlay = _c === void 0 ? true : _c, playEvent = props.playEvent, elementClass = props.elementClass, _d = props.hideSliderDuration, hideSliderDuration = _d === void 0 ? 3000 : _d, sliderBG = props.sliderBG, videoDuration = props.videoDuration, compRef = props.compRef, rootClassName = props.rootClassName;
|
|
53
53
|
var isStreaming = !playUrl.endsWith('.mp4');
|
|
54
54
|
var refVideo = useRef(null);
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
var
|
|
58
|
-
var
|
|
55
|
+
var _e = useState(VideoStatus.Pause), videoStatus = _e[0], setVideoStatus = _e[1];
|
|
56
|
+
var _f = useState(0), currentTime = _f[0], setCurrentTime = _f[1];
|
|
57
|
+
var _g = useState(0), totalTime = _g[0], setTotalTime = _g[1];
|
|
58
|
+
var _h = useState(false), showSlider = _h[0], setShowSlider = _h[1];
|
|
59
59
|
var sliderTimmer = useRef(null);
|
|
60
60
|
var rootRef = useRef();
|
|
61
61
|
var updatePlayTime = function () {
|
|
@@ -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
|
-
:
|
|
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),
|