@cloud-app-dev/vidc 3.0.9 → 3.0.12
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/.prettierrc +1 -1
- package/.umirc.ts +3 -2
- package/clear-cache.sh +4 -0
- package/es/CustomRenderSelect/index.css +20 -0
- package/es/CustomRenderSelect/index.d.ts +10 -0
- package/es/CustomRenderSelect/index.js +73 -0
- package/es/List/DynamicGridList/index.js +4 -3
- package/es/List/DynamicList/utils.d.ts +1 -1
- package/es/List/DynamicList/utils.js +1 -1
- package/es/List/GridList/Demo.js +1 -1
- package/es/Player/api/index.d.ts +4 -4
- package/es/Player/contraller_bar/contraller_event.js +1 -1
- package/es/Player/demo.js +36 -12
- package/es/Player/event/errorEvent.d.ts +2 -2
- package/es/Player/event/errorEvent.js +2 -2
- package/es/Player/live_heart.d.ts +4 -2
- package/es/Player/live_heart.js +24 -12
- package/es/Player/message.js +4 -4
- package/es/Player/player.d.ts +4 -4
- package/es/Player/segment_player.js +1 -0
- package/es/Player/segment_timeline.d.ts +2 -1
- package/es/Player/segment_timeline.js +7 -12
- package/es/Player/single_player.js +2 -1
- package/es/Player/style/iconfont.css +150 -33
- package/es/Player/style/iconfont.ttf +0 -0
- package/es/Player/style/iconfont.woff +0 -0
- package/es/Player/style/iconfont.woff2 +0 -0
- package/es/Player/util.d.ts +1 -1
- package/es/Player/util.js +17 -22
- package/es/ScreenPlayer/Live.d.ts +1 -1
- package/es/ScreenPlayer/Live.js +67 -14
- package/es/ScreenPlayer/LiveTools.d.ts +3 -1
- package/es/ScreenPlayer/LiveTools.js +69 -33
- package/es/ScreenPlayer/PlayerWithExt.d.ts +2 -2
- package/es/ScreenPlayer/PlayerWithExt.js +5 -4
- package/es/ScreenPlayer/Record.d.ts +1 -1
- package/es/ScreenPlayer/Record.js +64 -32
- package/es/ScreenPlayer/RecordTools.d.ts +2 -1
- package/es/ScreenPlayer/RecordTools.js +46 -36
- package/es/ScreenPlayer/ScreenSelect.js +41 -20
- package/es/ScreenPlayer/SegmentTimeLine.d.ts +2 -2
- package/es/ScreenPlayer/SegmentTimeLine.js +17 -36
- package/es/ScreenPlayer/TimeMode.js +8 -2
- package/es/ScreenPlayer/TimeSlider.d.ts +2 -2
- package/es/ScreenPlayer/TimeSlider.js +15 -15
- package/es/ScreenPlayer/demo.js +4 -4
- package/es/ScreenPlayer/demo2.js +1 -1
- package/es/ScreenPlayer/index.css +29 -10
- package/es/ScreenPlayer/interface.d.ts +24 -4
- package/es/ScreenPlayer/useTimeSlider.d.ts +22 -0
- package/es/ScreenPlayer/useTimeSlider.js +485 -0
- package/es/ScreenPlayer/utils.d.ts +1 -0
- package/es/ScreenPlayer/utils.js +17 -8
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/package.json +2 -2
package/.prettierrc
CHANGED
package/.umirc.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { defineConfig } from 'dumi';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
|
|
4
4
|
const token =
|
|
5
|
-
'eyJhbGciOiJIUzI1NiJ9.
|
|
5
|
+
'eyJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb25JZCI6IjEwMDEwMTAwMDQ0NSIsImV4dCI6MTY2MjI1ODMwNzUxNSwidWlkIjoiMTAxMDAwMDAwNjk5IiwidmFsaWRTdGF0ZSI6MTA0NDA2LCJyb2xlSWQiOlsxMDAwMDAxMTA1MTgsMTAwMDAwMTEwNzI4XSwidmFsaWRUaW1lIjoxNzA0MzgzOTk5MDAwLCJvcHRDZW50ZXJJZCI6IjEwMDEwMDAwMDIzMyIsInVzZXJUeXBlIjoxMDA3MDQsImlhdCI6MTY2MTk5OTEwNzUxNX0.uk_G3vqBCFqxQM2jbV6CSN-z9YNVt_cx5nWXkSuCOIA';
|
|
6
6
|
|
|
7
7
|
export default defineConfig({
|
|
8
8
|
title: 'CloudApp VIDC',
|
|
@@ -87,12 +87,13 @@ export default defineConfig({
|
|
|
87
87
|
--gray11: #4B4B4B;
|
|
88
88
|
--gray12: #383838;
|
|
89
89
|
--background: #348fe2;
|
|
90
|
+
--icon:#62708B;
|
|
90
91
|
--fs: 14px;
|
|
91
92
|
--fs-small: 12px;
|
|
92
93
|
--fs-large: 20px;
|
|
93
94
|
--color: rgba(0,0,0,1);
|
|
94
95
|
--color-dark: #000000;
|
|
95
|
-
--color-light: rgba(
|
|
96
|
+
--color-light: rgba(255,255,255,1);
|
|
96
97
|
--color-disabled: rgba(0,0,0,0.26);
|
|
97
98
|
--shadow1: 2px 0 10px 0 rgba(0,0,0,0.06);
|
|
98
99
|
--shadow2: 2px 0 10px 0 rgba(0,0,0,0.06);
|
package/clear-cache.sh
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.custom-render-select {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
position: relative;
|
|
4
|
+
width: max-content;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
}
|
|
7
|
+
.custom-render-select .custom-render-box {
|
|
8
|
+
display: inline-block;
|
|
9
|
+
position: relative;
|
|
10
|
+
z-index: 22;
|
|
11
|
+
}
|
|
12
|
+
.custom-render-select .cloudapp-select {
|
|
13
|
+
position: absolute;
|
|
14
|
+
width: max-content;
|
|
15
|
+
height: 100%;
|
|
16
|
+
left: 50%;
|
|
17
|
+
top: 50%;
|
|
18
|
+
opacity: 0;
|
|
19
|
+
transform: translate(-50%, -50%);
|
|
20
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SelectProps } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import './index.less';
|
|
4
|
+
interface ICustomRenderSelectProps extends SelectProps {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
value: any;
|
|
7
|
+
customRender: (value: any) => JSX.Element;
|
|
8
|
+
}
|
|
9
|
+
declare function CustomRenderSelect({ children, value, customRender, dropdownClassName, getPopupContainer, ...props }: ICustomRenderSelectProps): JSX.Element;
|
|
10
|
+
export default CustomRenderSelect;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import "antd/lib/select/style";
|
|
2
|
+
import _Select from "antd/lib/select";
|
|
3
|
+
import _useClickAway from "ahooks/es/useClickAway";
|
|
4
|
+
import _useToggle3 from "ahooks/es/useToggle";
|
|
5
|
+
import _uuid from "@cloud-app-dev/utils/es/uuid";
|
|
6
|
+
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
|
|
9
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
|
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
+
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
14
|
+
|
|
15
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
16
|
+
|
|
17
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
+
|
|
19
|
+
import { __rest } from "tslib";
|
|
20
|
+
import React, { useMemo, useRef } from 'react';
|
|
21
|
+
import "./index.css";
|
|
22
|
+
|
|
23
|
+
function CustomRenderSelect(_a) {
|
|
24
|
+
var children = _a.children,
|
|
25
|
+
value = _a.value,
|
|
26
|
+
customRender = _a.customRender,
|
|
27
|
+
dropdownClassName = _a.dropdownClassName,
|
|
28
|
+
getPopupContainer = _a.getPopupContainer,
|
|
29
|
+
props = __rest(_a, ["children", "value", "customRender", "dropdownClassName", "getPopupContainer"]);
|
|
30
|
+
|
|
31
|
+
var classname = useMemo(function () {
|
|
32
|
+
return "custom-render-select-dropdown-".concat(_uuid());
|
|
33
|
+
}, []);
|
|
34
|
+
var domRef = useRef(null);
|
|
35
|
+
|
|
36
|
+
var _useToggle = _useToggle3(),
|
|
37
|
+
_useToggle2 = _slicedToArray(_useToggle, 2),
|
|
38
|
+
open = _useToggle2[0],
|
|
39
|
+
_useToggle2$ = _useToggle2[1],
|
|
40
|
+
toggle = _useToggle2$.toggle,
|
|
41
|
+
set = _useToggle2$.set;
|
|
42
|
+
|
|
43
|
+
var getDoms = useMemo(function () {
|
|
44
|
+
return [function () {
|
|
45
|
+
return domRef.current.querySelector('.custom-render-box');
|
|
46
|
+
}, function () {
|
|
47
|
+
return document.querySelector(".".concat(classname));
|
|
48
|
+
}];
|
|
49
|
+
}, []);
|
|
50
|
+
|
|
51
|
+
_useClickAway(function () {
|
|
52
|
+
return set(false);
|
|
53
|
+
}, getDoms, ['click']);
|
|
54
|
+
|
|
55
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
56
|
+
className: "custom-render-select",
|
|
57
|
+
ref: domRef
|
|
58
|
+
}, /*#__PURE__*/React.createElement(_Select, Object.assign({}, props, {
|
|
59
|
+
value: value,
|
|
60
|
+
dropdownClassName: "custom-render-select-dropdown ".concat(classname, " ").concat(dropdownClassName),
|
|
61
|
+
getPopupContainer: getPopupContainer ? getPopupContainer : function () {
|
|
62
|
+
return domRef.current.parentElement.parentElement;
|
|
63
|
+
},
|
|
64
|
+
open: open
|
|
65
|
+
}), children), /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
className: "custom-render-box",
|
|
67
|
+
onClick: toggle
|
|
68
|
+
}, customRender(value)), /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
className: "popup-container"
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export default CustomRenderSelect;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import "antd/lib/message/style";
|
|
2
2
|
import _message from "antd/lib/message";
|
|
3
|
+
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
3
4
|
import { __rest } from "tslib";
|
|
4
|
-
import React, {
|
|
5
|
+
import React, { useMemo, useRef } from 'react';
|
|
5
6
|
import GridList from '../GridList';
|
|
6
7
|
import useInfiniteScroll from '../../useInfiniteScroll';
|
|
7
8
|
|
|
@@ -28,8 +29,8 @@ function DynamicGridList(_a) {
|
|
|
28
29
|
data = _useInfiniteScroll.data,
|
|
29
30
|
noMore = _useInfiniteScroll.noMore;
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
return _message.success('数据已全部加载完成!');
|
|
32
|
+
_useUpdateEffect(function () {
|
|
33
|
+
return noMore && _message.success('数据已全部加载完成!');
|
|
33
34
|
}, [noMore]);
|
|
34
35
|
|
|
35
36
|
function getItemData(data) {
|
package/es/List/GridList/Demo.js
CHANGED
package/es/Player/api/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Flvjs from '@cloud-app-dev/flv.js';
|
|
2
2
|
import Hls, { HlsConfig } from 'hls.js';
|
|
3
3
|
import type { FlvPlayerConfig } from '../player';
|
|
4
4
|
declare class Api {
|
|
@@ -57,9 +57,9 @@ declare class Api {
|
|
|
57
57
|
}
|
|
58
58
|
export declare type TypeAndPlay = {
|
|
59
59
|
type?: string;
|
|
60
|
-
flv?:
|
|
60
|
+
flv?: Flvjs.Player;
|
|
61
61
|
hls?: Hls;
|
|
62
62
|
};
|
|
63
|
-
export declare function useTypeAndPlay(url?: string, type?: string, isLive?: boolean, container?: HTMLElement, segments?:
|
|
64
|
-
export declare function usePlayerApi(url?: string, type?: string, isLive?: boolean, container?: HTMLElement, segments?:
|
|
63
|
+
export declare function useTypeAndPlay(url?: string, type?: string, isLive?: boolean, container?: HTMLElement, segments?: Flvjs.MediaSegment[], flvConfig?: FlvPlayerConfig, hlsConfig?: HlsConfig): [string, Flvjs.Player, Hls];
|
|
64
|
+
export declare function usePlayerApi(url?: string, type?: string, isLive?: boolean, container?: HTMLElement, segments?: Flvjs.MediaSegment[], flvConfig?: FlvPlayerConfig, hlsConfig?: HlsConfig): [Api, [string, Flvjs.Player, Hls]];
|
|
65
65
|
export default Api;
|
|
@@ -47,7 +47,7 @@ function ContrallerEvent(_ref) {
|
|
|
47
47
|
container.removeEventListener('mouseenter', showContraller, false);
|
|
48
48
|
container.removeEventListener('mouseleave', hideContraller, false);
|
|
49
49
|
};
|
|
50
|
-
}, [event]);
|
|
50
|
+
}, [container, event]);
|
|
51
51
|
return /*#__PURE__*/React.createElement(React.Fragment, null, React.Children.map(children, function (child) {
|
|
52
52
|
return /*#__PURE__*/React.isValidElement(child) ? /*#__PURE__*/React.cloneElement(child, {
|
|
53
53
|
visibel: visibel
|
package/es/Player/demo.js
CHANGED
|
@@ -23,6 +23,7 @@ import React, { useState } from 'react';
|
|
|
23
23
|
import Player from './single_player';
|
|
24
24
|
import SegmentPlayer from './segment_player';
|
|
25
25
|
import FrontendPlayer from './frontend_player';
|
|
26
|
+
import moment from 'moment';
|
|
26
27
|
var options = [{
|
|
27
28
|
value: '',
|
|
28
29
|
label: '自动'
|
|
@@ -123,28 +124,51 @@ function Demo1() {
|
|
|
123
124
|
}));
|
|
124
125
|
}
|
|
125
126
|
|
|
126
|
-
var
|
|
127
|
+
var mm = moment().set({
|
|
128
|
+
hours: 0,
|
|
129
|
+
minutes: 0,
|
|
130
|
+
seconds: 0
|
|
131
|
+
});
|
|
132
|
+
var m = mm.clone();
|
|
127
133
|
|
|
128
134
|
function Demo2() {
|
|
129
135
|
var _useState3 = useState({
|
|
130
136
|
isLive: 1,
|
|
131
137
|
segments: [{
|
|
132
|
-
beginTime:
|
|
133
|
-
endTime:
|
|
138
|
+
beginTime: m.valueOf(),
|
|
139
|
+
endTime: m.set({
|
|
140
|
+
minutes: 1
|
|
141
|
+
}).valueOf(),
|
|
134
142
|
url: 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
|
|
135
143
|
}, {
|
|
136
|
-
beginTime:
|
|
137
|
-
|
|
144
|
+
beginTime: m.set({
|
|
145
|
+
minutes: 1
|
|
146
|
+
}).valueOf(),
|
|
147
|
+
endTime: m.set({
|
|
148
|
+
minutes: 2
|
|
149
|
+
}).valueOf()
|
|
138
150
|
}, {
|
|
139
|
-
beginTime:
|
|
140
|
-
|
|
151
|
+
beginTime: m.set({
|
|
152
|
+
minutes: 2
|
|
153
|
+
}).valueOf(),
|
|
154
|
+
endTime: m.set({
|
|
155
|
+
minutes: 3
|
|
156
|
+
}).valueOf(),
|
|
141
157
|
url: 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4?date=1'
|
|
142
158
|
}, {
|
|
143
|
-
beginTime:
|
|
144
|
-
|
|
159
|
+
beginTime: m.set({
|
|
160
|
+
minutes: 3
|
|
161
|
+
}).valueOf(),
|
|
162
|
+
endTime: m.set({
|
|
163
|
+
minutes: 4
|
|
164
|
+
}).valueOf()
|
|
145
165
|
}, {
|
|
146
|
-
beginTime:
|
|
147
|
-
|
|
166
|
+
beginTime: m.set({
|
|
167
|
+
minutes: 4
|
|
168
|
+
}).valueOf(),
|
|
169
|
+
endTime: m.set({
|
|
170
|
+
minutes: 5
|
|
171
|
+
}).valueOf(),
|
|
148
172
|
url: 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4?date=2'
|
|
149
173
|
}],
|
|
150
174
|
tempUrl: ''
|
|
@@ -190,7 +214,7 @@ function Demo2() {
|
|
|
190
214
|
});
|
|
191
215
|
}
|
|
192
216
|
}, "\u64AD\u653E")), /*#__PURE__*/React.createElement(SegmentPlayer, {
|
|
193
|
-
begin:
|
|
217
|
+
begin: mm.valueOf(),
|
|
194
218
|
segments: state.segments,
|
|
195
219
|
isLive: false
|
|
196
220
|
}));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type VideoEventInstance from '.';
|
|
3
3
|
import type Api from '../api';
|
|
4
|
-
import
|
|
4
|
+
import Flvjs from '@cloud-app-dev/flv.js';
|
|
5
5
|
import Hls from 'hls.js';
|
|
6
6
|
interface IErrorEventProps {
|
|
7
7
|
event: VideoEventInstance;
|
|
8
8
|
api: Api;
|
|
9
9
|
errorReloadTimer: number;
|
|
10
|
-
flv:
|
|
10
|
+
flv: Flvjs.Player;
|
|
11
11
|
hls: Hls;
|
|
12
12
|
reload: () => void;
|
|
13
13
|
unload: () => void;
|
|
@@ -20,7 +20,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
20
20
|
|
|
21
21
|
import React, { useState, useEffect, useRef } from 'react';
|
|
22
22
|
import EventName from './eventName';
|
|
23
|
-
import
|
|
23
|
+
import Flvjs from '@cloud-app-dev/flv.js';
|
|
24
24
|
import Hls from 'hls.js';
|
|
25
25
|
|
|
26
26
|
function ErrorEvent(_ref) {
|
|
@@ -70,7 +70,7 @@ function ErrorEvent(_ref) {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
if (flv) {
|
|
73
|
-
flv.on(
|
|
73
|
+
flv.on(Flvjs.Events.ERROR, errorHandle);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
if (hls) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import Api from './api';
|
|
3
|
-
|
|
2
|
+
import type Api from './api';
|
|
3
|
+
import type VideoEventInstance from './event';
|
|
4
|
+
declare function LiveHeart({ api, event }: {
|
|
4
5
|
api: Api;
|
|
6
|
+
event: VideoEventInstance;
|
|
5
7
|
}): JSX.Element;
|
|
6
8
|
export default LiveHeart;
|
package/es/Player/live_heart.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import _useRafInterval from "ahooks/es/useRafInterval";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
3
|
+
import _useDocumentVisibility from "ahooks/es/useDocumentVisibility";
|
|
4
|
+
import React, { useRef } from 'react';
|
|
5
|
+
import Events from './event/eventName';
|
|
4
6
|
|
|
5
7
|
function LiveHeart(_ref) {
|
|
6
|
-
var api = _ref.api
|
|
8
|
+
var api = _ref.api,
|
|
9
|
+
event = _ref.event;
|
|
10
|
+
|
|
11
|
+
var documentVisibility = _useDocumentVisibility();
|
|
12
|
+
|
|
13
|
+
var cTimeRef = useRef(null);
|
|
7
14
|
|
|
8
15
|
var run = function run() {
|
|
9
16
|
var current = api.getCurrentTime();
|
|
@@ -16,21 +23,26 @@ function LiveHeart(_ref) {
|
|
|
16
23
|
}
|
|
17
24
|
};
|
|
18
25
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
26
|
+
_useUpdateEffect(function () {
|
|
27
|
+
return run();
|
|
28
|
+
}, [documentVisibility]);
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
28
|
-
}, [api]);
|
|
30
|
+
_useRafInterval(function () {
|
|
31
|
+
return cTimeRef.current = api.getCurrentTime();
|
|
32
|
+
}, 1 * 1000);
|
|
29
33
|
|
|
30
34
|
_useRafInterval(function () {
|
|
31
35
|
return run();
|
|
32
36
|
}, 30 * 1000);
|
|
33
37
|
|
|
38
|
+
_useRafInterval(function () {
|
|
39
|
+
var cuurentTime = api.getCurrentTime();
|
|
40
|
+
|
|
41
|
+
if (!api.video.paused && cuurentTime === cTimeRef.current) {
|
|
42
|
+
event.emit(Events.ERROR);
|
|
43
|
+
}
|
|
44
|
+
}, 20 * 1000);
|
|
45
|
+
|
|
34
46
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
35
47
|
}
|
|
36
48
|
|
package/es/Player/message.js
CHANGED
|
@@ -110,8 +110,8 @@ function VideoMessage(_ref) {
|
|
|
110
110
|
api.pause();
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
event.addEventListener('loadstart', openLoading);
|
|
114
|
-
|
|
113
|
+
event.addEventListener('loadstart', openLoading); // event.addEventListener('waiting', openLoading);
|
|
114
|
+
// event.addEventListener('seeking', openLoading)
|
|
115
115
|
|
|
116
116
|
event.addEventListener('loadeddata', closeLoading);
|
|
117
117
|
event.addEventListener('canplay', closeLoading);
|
|
@@ -122,8 +122,8 @@ function VideoMessage(_ref) {
|
|
|
122
122
|
event.on(EventName.HISTORY_PLAY_END, playEnd);
|
|
123
123
|
event.on(EventName.CLEAR_ERROR_TIMER, reloadSuccess);
|
|
124
124
|
return function () {
|
|
125
|
-
event.removeEventListener('loadstart', openLoading);
|
|
126
|
-
|
|
125
|
+
event.removeEventListener('loadstart', openLoading); // event.removeEventListener('waiting', openLoading);
|
|
126
|
+
// event.removeEventListener('seeking', openLoading)
|
|
127
127
|
|
|
128
128
|
event.removeEventListener('loadeddata', closeLoading);
|
|
129
129
|
event.removeEventListener('canplay', closeLoading);
|
package/es/Player/player.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type Flvjs from '@cloud-app-dev/flv.js';
|
|
2
2
|
import type Hls, { HlsConfig } from 'hls.js';
|
|
3
3
|
import type React from 'react';
|
|
4
4
|
import type Api from './api';
|
|
5
5
|
import type VideoEventInstance from './event';
|
|
6
6
|
|
|
7
7
|
export type FlvPlayerConfig = {
|
|
8
|
-
mediaDataSource:
|
|
9
|
-
config:
|
|
8
|
+
mediaDataSource: Flvjs.MediaDataSource;
|
|
9
|
+
config: Flvjs.Config;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export interface ISinglePlayerProps {
|
|
@@ -198,7 +198,7 @@ export type ExportPlayerType = {
|
|
|
198
198
|
container: HTMLElement;
|
|
199
199
|
api: Api;
|
|
200
200
|
event: VideoEventInstance;
|
|
201
|
-
plugins: [
|
|
201
|
+
plugins: [Flvjs.Player, Hls];
|
|
202
202
|
fit?: string;
|
|
203
203
|
setIndex?: (i: number) => void;
|
|
204
204
|
seekTo?: (i: number) => void;
|
|
@@ -11,6 +11,7 @@ interface ITimeLineProps {
|
|
|
11
11
|
duration: number;
|
|
12
12
|
setIndex: (i: number) => void;
|
|
13
13
|
begin: number;
|
|
14
|
+
seekTo: (time: number) => void;
|
|
14
15
|
}
|
|
15
|
-
declare function SegmentTimeLine({ api, event, index, segments, duration, begin, setIndex }: ITimeLineProps): JSX.Element;
|
|
16
|
+
declare function SegmentTimeLine({ api, event, index, segments, duration, begin, setIndex, seekTo }: ITimeLineProps): JSX.Element;
|
|
16
17
|
export default SegmentTimeLine;
|
|
@@ -27,7 +27,8 @@ function SegmentTimeLine(_ref) {
|
|
|
27
27
|
segments = _ref.segments,
|
|
28
28
|
duration = _ref.duration,
|
|
29
29
|
begin = _ref.begin,
|
|
30
|
-
setIndex = _ref.setIndex
|
|
30
|
+
setIndex = _ref.setIndex,
|
|
31
|
+
seekTo = _ref.seekTo;
|
|
31
32
|
var status = useBarStatus(event);
|
|
32
33
|
|
|
33
34
|
var _useTimes = useTimes(api, event),
|
|
@@ -56,17 +57,11 @@ function SegmentTimeLine(_ref) {
|
|
|
56
57
|
var ele = e.currentTarget;
|
|
57
58
|
var rect = ele.getBoundingClientRect();
|
|
58
59
|
var current = e.pageX - rect.left;
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
setTimeout(function () {
|
|
65
|
-
return api.seekTo(currentTime);
|
|
66
|
-
}, 500);
|
|
67
|
-
} else {
|
|
68
|
-
api.seekTo(currentTime);
|
|
69
|
-
}
|
|
60
|
+
var item = segments[i - 1];
|
|
61
|
+
var pTime = item ? item.endTime : begin;
|
|
62
|
+
var duration = segments[i].endTime - segments[i].beginTime;
|
|
63
|
+
var currentTime = current / rect.width * duration;
|
|
64
|
+
seekTo(Math.round(currentTime + pTime));
|
|
70
65
|
}, [segments, api, index, setIndex]);
|
|
71
66
|
return /*#__PURE__*/React.createElement("div", {
|
|
72
67
|
className: "player-timeline-layout player-segment-timeline-layout ".concat(status === 0 ? 'hide-time-line' : '')
|
|
@@ -213,7 +213,8 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
213
213
|
reload: reload,
|
|
214
214
|
errorReloadTimer: errorReloadTimer
|
|
215
215
|
}), isLive && /*#__PURE__*/React.createElement(LiveHeart, {
|
|
216
|
-
api: playApi
|
|
216
|
+
api: playApi,
|
|
217
|
+
event: playEvent
|
|
217
218
|
})), children);
|
|
218
219
|
});
|
|
219
220
|
SinglePlayer.defaultProps = {
|