pixuireactcomponents 1.4.3 → 1.4.5
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.Loading), 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 () {
|
|
@@ -155,6 +155,10 @@ export var VideoPlayer = function (props) {
|
|
|
155
155
|
videoLog('-----------onpause');
|
|
156
156
|
setVideoStatus(VideoStatus.Pause);
|
|
157
157
|
};
|
|
158
|
+
var onwaiting = function () {
|
|
159
|
+
videoLog('-----------onwaiting');
|
|
160
|
+
setVideoStatus(VideoStatus.Loading);
|
|
161
|
+
};
|
|
158
162
|
var onended = function () {
|
|
159
163
|
// 视频播放结束
|
|
160
164
|
videoLog('-----------onended');
|
|
@@ -226,7 +230,7 @@ export var VideoPlayer = function (props) {
|
|
|
226
230
|
}
|
|
227
231
|
videoLog('currentTime', currentTime, 'totalTime', totalTime);
|
|
228
232
|
return (h("div", { className: rootClassName, ref: rootRef },
|
|
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 () {
|
|
233
|
+
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, onWaiting: onwaiting, onLoadStart: function () {
|
|
230
234
|
console.warn('onloadstart');
|
|
231
235
|
}, onLoadedData: function () {
|
|
232
236
|
console.warn('onloadeddata');
|