@cloud-app-dev/vidc 3.0.10 → 3.0.11
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/.umirc.ts +1 -1
- package/clear-cache.sh +4 -0
- package/es/CustomRenderSelect/index.d.ts +1 -1
- package/es/CustomRenderSelect/index.js +8 -2
- 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/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/single_player.js +2 -1
- 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 +50 -10
- package/es/ScreenPlayer/LiveTools.d.ts +3 -1
- package/es/ScreenPlayer/LiveTools.js +16 -10
- package/es/ScreenPlayer/Record.d.ts +1 -1
- package/es/ScreenPlayer/Record.js +42 -10
- package/es/ScreenPlayer/RecordTools.d.ts +2 -1
- package/es/ScreenPlayer/RecordTools.js +6 -4
- package/es/ScreenPlayer/demo.js +4 -4
- package/es/ScreenPlayer/demo2.js +1 -1
- package/es/ScreenPlayer/index.css +3 -0
- package/es/ScreenPlayer/interface.d.ts +19 -2
- package/es/ScreenPlayer/utils.js +1 -1
- package/package.json +2 -2
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',
|
package/clear-cache.sh
ADDED
|
@@ -6,5 +6,5 @@ interface ICustomRenderSelectProps extends SelectProps {
|
|
|
6
6
|
value: any;
|
|
7
7
|
customRender: (value: any) => JSX.Element;
|
|
8
8
|
}
|
|
9
|
-
declare function CustomRenderSelect({ children, value, customRender, dropdownClassName, ...props }: ICustomRenderSelectProps): JSX.Element;
|
|
9
|
+
declare function CustomRenderSelect({ children, value, customRender, dropdownClassName, getPopupContainer, ...props }: ICustomRenderSelectProps): JSX.Element;
|
|
10
10
|
export default CustomRenderSelect;
|
|
@@ -25,7 +25,8 @@ function CustomRenderSelect(_a) {
|
|
|
25
25
|
value = _a.value,
|
|
26
26
|
customRender = _a.customRender,
|
|
27
27
|
dropdownClassName = _a.dropdownClassName,
|
|
28
|
-
|
|
28
|
+
getPopupContainer = _a.getPopupContainer,
|
|
29
|
+
props = __rest(_a, ["children", "value", "customRender", "dropdownClassName", "getPopupContainer"]);
|
|
29
30
|
|
|
30
31
|
var classname = useMemo(function () {
|
|
31
32
|
return "custom-render-select-dropdown-".concat(_uuid());
|
|
@@ -57,11 +58,16 @@ function CustomRenderSelect(_a) {
|
|
|
57
58
|
}, /*#__PURE__*/React.createElement(_Select, Object.assign({}, props, {
|
|
58
59
|
value: value,
|
|
59
60
|
dropdownClassName: "custom-render-select-dropdown ".concat(classname, " ").concat(dropdownClassName),
|
|
61
|
+
getPopupContainer: getPopupContainer ? getPopupContainer : function () {
|
|
62
|
+
return domRef.current.parentElement.parentElement;
|
|
63
|
+
},
|
|
60
64
|
open: open
|
|
61
65
|
}), children), /*#__PURE__*/React.createElement("div", {
|
|
62
66
|
className: "custom-render-box",
|
|
63
67
|
onClick: toggle
|
|
64
|
-
}, customRender(value))
|
|
68
|
+
}, customRender(value)), /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
className: "popup-container"
|
|
70
|
+
}));
|
|
65
71
|
}
|
|
66
72
|
|
|
67
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
|
|
@@ -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;
|
|
@@ -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 = {
|
package/es/Player/util.d.ts
CHANGED
package/es/Player/util.js
CHANGED
|
@@ -3,7 +3,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3
3
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
4
4
|
|
|
5
5
|
import { __awaiter } from "tslib";
|
|
6
|
-
import Flvjs from 'flv.
|
|
6
|
+
import Flvjs from '@cloud-app-dev/flv.js';
|
|
7
7
|
import Hls from 'hls.js';
|
|
8
8
|
import Events from './event/eventName';
|
|
9
9
|
/**
|
|
@@ -39,21 +39,17 @@ export function createFlvPlayer(video, url, isLive, flvConfig) {
|
|
|
39
39
|
return undefined;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
Flvjs.LoggingControl.enableDebug = false;
|
|
43
|
+
Flvjs.LoggingControl.enableVerbose = false;
|
|
44
|
+
Flvjs.LoggingControl.enableWarn = false;
|
|
42
45
|
var mediaDataSource = Object.assign({
|
|
43
46
|
type: 'flv',
|
|
44
47
|
url: url
|
|
45
48
|
}, flvConfig.mediaDataSource);
|
|
46
49
|
var config = Object.assign({
|
|
47
50
|
enableWorker: true,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// lazyLoadMaxDuration: 0,
|
|
51
|
-
// autoCleanupMaxBackwardDuration: 3,
|
|
52
|
-
// autoCleanupMinBackwardDuration: 2,
|
|
53
|
-
// autoCleanupSourceBuffer: true,
|
|
54
|
-
enableStashBuffer: false,
|
|
55
|
-
stashInitialSize: 128,
|
|
56
|
-
isLive: isLive !== null && isLive !== void 0 ? isLive : true
|
|
51
|
+
isLive: isLive !== null && isLive !== void 0 ? isLive : true,
|
|
52
|
+
enableStashBuffer: !isLive
|
|
57
53
|
}, flvConfig.config);
|
|
58
54
|
var player = Flvjs.createPlayer(mediaDataSource, config);
|
|
59
55
|
player.attachMediaElement(video);
|
|
@@ -65,21 +61,21 @@ export var playReload = function playReload(video, event, flv, hls, url) {
|
|
|
65
61
|
video.removeAttribute('src');
|
|
66
62
|
|
|
67
63
|
if (flv) {
|
|
68
|
-
flv.unload();
|
|
69
|
-
flv.load();
|
|
70
64
|
tryCatch(function () {
|
|
71
|
-
|
|
65
|
+
flv.unload();
|
|
66
|
+
flv.load();
|
|
67
|
+
flv.play();
|
|
72
68
|
});
|
|
73
69
|
}
|
|
74
70
|
|
|
75
71
|
if (hls) {
|
|
76
|
-
hls.swapAudioCodec();
|
|
77
|
-
hls.recoverMediaError();
|
|
78
|
-
hls.stopLoad();
|
|
79
|
-
hls.startLoad();
|
|
80
|
-
hls.loadSource(url);
|
|
81
72
|
tryCatch(function () {
|
|
82
|
-
|
|
73
|
+
hls.swapAudioCodec();
|
|
74
|
+
hls.recoverMediaError();
|
|
75
|
+
hls.stopLoad();
|
|
76
|
+
hls.startLoad();
|
|
77
|
+
hls.loadSource(url);
|
|
78
|
+
video.play();
|
|
83
79
|
});
|
|
84
80
|
}
|
|
85
81
|
|
|
@@ -145,15 +141,14 @@ export function tryCatch(fn) {
|
|
|
145
141
|
return fn();
|
|
146
142
|
|
|
147
143
|
case 3:
|
|
148
|
-
_context.next =
|
|
144
|
+
_context.next = 7;
|
|
149
145
|
break;
|
|
150
146
|
|
|
151
147
|
case 5:
|
|
152
148
|
_context.prev = 5;
|
|
153
149
|
_context.t0 = _context["catch"](0);
|
|
154
|
-
console.debug(_context.t0);
|
|
155
150
|
|
|
156
|
-
case
|
|
151
|
+
case 7:
|
|
157
152
|
case "end":
|
|
158
153
|
return _context.stop();
|
|
159
154
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ILivePlayerProps } from './interface';
|
|
3
3
|
import './index.less';
|
|
4
|
-
declare function LivePlayer({ list, children, onIndexChange, onClose, onCloseAll }: ILivePlayerProps): JSX.Element;
|
|
4
|
+
declare function LivePlayer({ list, children, onIndexChange, onClose, onCloseAll, snapshot, defaultScreen, screenChange, defaultSelectIndex, }: ILivePlayerProps): JSX.Element;
|
|
5
5
|
export default LivePlayer;
|
package/es/ScreenPlayer/Live.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
2
|
+
|
|
1
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
4
|
|
|
3
5
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -31,11 +33,15 @@ function LivePlayer(_ref) {
|
|
|
31
33
|
children = _ref.children,
|
|
32
34
|
onIndexChange = _ref.onIndexChange,
|
|
33
35
|
onClose = _ref.onClose,
|
|
34
|
-
onCloseAll = _ref.onCloseAll
|
|
36
|
+
onCloseAll = _ref.onCloseAll,
|
|
37
|
+
snapshot = _ref.snapshot,
|
|
38
|
+
defaultScreen = _ref.defaultScreen,
|
|
39
|
+
screenChange = _ref.screenChange,
|
|
40
|
+
defaultSelectIndex = _ref.defaultSelectIndex;
|
|
35
41
|
|
|
36
42
|
var _useState = useState({
|
|
37
|
-
screenNum: 4,
|
|
38
|
-
selectIndex: 0,
|
|
43
|
+
screenNum: defaultScreen !== null && defaultScreen !== void 0 ? defaultScreen : 4,
|
|
44
|
+
selectIndex: defaultSelectIndex !== null && defaultSelectIndex !== void 0 ? defaultSelectIndex : 0,
|
|
39
45
|
modes: []
|
|
40
46
|
}),
|
|
41
47
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -87,18 +93,50 @@ function LivePlayer(_ref) {
|
|
|
87
93
|
setState(function (old) {
|
|
88
94
|
return Object.assign(Object.assign({}, old), obj);
|
|
89
95
|
});
|
|
90
|
-
}; //
|
|
91
|
-
|
|
96
|
+
}; // 当前窗口信息
|
|
97
|
+
|
|
92
98
|
|
|
99
|
+
var segmentItem = useMemo(function () {
|
|
100
|
+
return list[state.selectIndex] || {};
|
|
101
|
+
}, [state.selectIndex, list]);
|
|
102
|
+
/**
|
|
103
|
+
* 同步外部的selectIndex变化
|
|
104
|
+
*/
|
|
93
105
|
|
|
94
106
|
useEffect(function () {
|
|
95
|
-
|
|
107
|
+
if (typeof defaultSelectIndex !== 'number') {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
setState(function (old) {
|
|
112
|
+
if (old.selectIndex !== defaultSelectIndex) {
|
|
113
|
+
return Object.assign(Object.assign({}, old), {
|
|
114
|
+
selectIndex: defaultSelectIndex
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return old;
|
|
119
|
+
});
|
|
120
|
+
}, [defaultSelectIndex]); // index变化同步到父组件
|
|
121
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
122
|
+
|
|
123
|
+
_useUpdateEffect(function () {
|
|
124
|
+
return onIndexChange && onIndexChange(state.selectIndex);
|
|
96
125
|
}, [state.selectIndex]);
|
|
126
|
+
/**
|
|
127
|
+
* 通知screenNum变化
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
_useUpdateEffect(function () {
|
|
132
|
+
return screenChange && onIndexChange(state.screenNum);
|
|
133
|
+
}, [state.screenNum]);
|
|
134
|
+
|
|
97
135
|
return /*#__PURE__*/React.createElement("div", {
|
|
98
|
-
className: "split-screen-player-wrapper"
|
|
99
|
-
ref: domRef
|
|
136
|
+
className: "split-screen-player-wrapper split-screen-player-live-wrapper"
|
|
100
137
|
}, /*#__PURE__*/React.createElement("div", {
|
|
101
|
-
className: "player-layout"
|
|
138
|
+
className: "player-layout",
|
|
139
|
+
ref: domRef
|
|
102
140
|
}, screenList.map(function (item, index) {
|
|
103
141
|
var _a;
|
|
104
142
|
|
|
@@ -126,12 +164,14 @@ function LivePlayer(_ref) {
|
|
|
126
164
|
onClose: onClose,
|
|
127
165
|
onCloseAll: onCloseAll,
|
|
128
166
|
fit: fit,
|
|
167
|
+
disabled: !segmentItem.url,
|
|
129
168
|
toggleFit: toggleFit,
|
|
130
169
|
getPlayerItem: getPlayerItem,
|
|
131
170
|
screenNum: state.screenNum,
|
|
132
171
|
mode: state.modes[state.selectIndex],
|
|
133
172
|
containerRef: domRef,
|
|
134
|
-
updateState: updateState
|
|
173
|
+
updateState: updateState,
|
|
174
|
+
snapshot: snapshot
|
|
135
175
|
}), children && /*#__PURE__*/React.cloneElement(children, {
|
|
136
176
|
selectIndex: state.selectIndex
|
|
137
177
|
}));
|
|
@@ -14,6 +14,8 @@ interface IToolsProps {
|
|
|
14
14
|
toggleFit?: () => void;
|
|
15
15
|
onClose?: () => void;
|
|
16
16
|
onCloseAll?: () => void;
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
snapshot?: (base64?: string) => void;
|
|
17
19
|
}
|
|
18
|
-
declare function LiveTools({ containerRef, updateState, screenNum, getPlayerItem, mode, toggleFit, fit, onClose, onCloseAll }: IToolsProps): JSX.Element;
|
|
20
|
+
declare function LiveTools({ containerRef, updateState, screenNum, getPlayerItem, mode, toggleFit, fit, onClose, onCloseAll, disabled, snapshot, }: IToolsProps): JSX.Element;
|
|
19
21
|
export default LiveTools;
|
|
@@ -16,6 +16,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
16
16
|
import React from 'react';
|
|
17
17
|
import IconFont from '../Player/iconfont';
|
|
18
18
|
import ScreenSelect from './ScreenSelect';
|
|
19
|
+
import DisableMark from '../DisableMark';
|
|
19
20
|
|
|
20
21
|
function LiveTools(_ref) {
|
|
21
22
|
var containerRef = _ref.containerRef,
|
|
@@ -26,7 +27,9 @@ function LiveTools(_ref) {
|
|
|
26
27
|
toggleFit = _ref.toggleFit,
|
|
27
28
|
fit = _ref.fit,
|
|
28
29
|
onClose = _ref.onClose,
|
|
29
|
-
onCloseAll = _ref.onCloseAll
|
|
30
|
+
onCloseAll = _ref.onCloseAll,
|
|
31
|
+
disabled = _ref.disabled,
|
|
32
|
+
snapshot = _ref.snapshot;
|
|
30
33
|
|
|
31
34
|
var _useFullscreen = _useFullscreen3(containerRef),
|
|
32
35
|
_useFullscreen2 = _slicedToArray(_useFullscreen, 2),
|
|
@@ -50,14 +53,17 @@ function LiveTools(_ref) {
|
|
|
50
53
|
player ? player.reload ? player.reload() : player.api.reload() : undefined;
|
|
51
54
|
};
|
|
52
55
|
|
|
53
|
-
var
|
|
56
|
+
var snapshotaction = function snapshotaction() {
|
|
54
57
|
var player = getPlayerItem();
|
|
55
|
-
|
|
58
|
+
var base64 = player ? player.api.snapshot() : undefined;
|
|
59
|
+
snapshot && snapshot(base64);
|
|
56
60
|
};
|
|
57
61
|
|
|
58
62
|
var player = getPlayerItem();
|
|
59
63
|
return /*#__PURE__*/React.createElement("div", {
|
|
60
64
|
className: "player-tools"
|
|
65
|
+
}, /*#__PURE__*/React.createElement(DisableMark, {
|
|
66
|
+
disabled: disabled
|
|
61
67
|
}, /*#__PURE__*/React.createElement("div", {
|
|
62
68
|
className: "player-tools-left"
|
|
63
69
|
}, /*#__PURE__*/React.createElement("span", {
|
|
@@ -70,7 +76,7 @@ function LiveTools(_ref) {
|
|
|
70
76
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
71
77
|
type: "lm-player-xiangji1fill",
|
|
72
78
|
title: "\u622A\u56FE",
|
|
73
|
-
onClick:
|
|
79
|
+
onClick: snapshotaction
|
|
74
80
|
})), /*#__PURE__*/React.createElement("span", {
|
|
75
81
|
className: "player-tools-item",
|
|
76
82
|
onClick: reload
|
|
@@ -92,9 +98,7 @@ function LiveTools(_ref) {
|
|
|
92
98
|
},
|
|
93
99
|
type: "lm-player-S_Device_shezhi",
|
|
94
100
|
title: "\u5207\u6362".concat(mode === 1 ? '插件' : '浏览器', "\u6A21\u5F0F")
|
|
95
|
-
}))
|
|
96
|
-
className: "player-tools-mid"
|
|
97
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
98
102
|
className: "player-tools-item",
|
|
99
103
|
onClick: onClose,
|
|
100
104
|
style: {
|
|
@@ -104,11 +108,13 @@ function LiveTools(_ref) {
|
|
|
104
108
|
type: "lm-player-tingzhi",
|
|
105
109
|
title: "\u505C\u6B62",
|
|
106
110
|
style: {
|
|
107
|
-
fontSize:
|
|
111
|
+
fontSize: 14,
|
|
108
112
|
position: 'relative',
|
|
109
113
|
top: 1
|
|
110
114
|
}
|
|
111
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
115
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
116
|
+
className: "player-tools-mid"
|
|
117
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
112
118
|
className: "player-tools-item",
|
|
113
119
|
onClick: playToggle,
|
|
114
120
|
style: {
|
|
@@ -163,7 +169,7 @@ function LiveTools(_ref) {
|
|
|
163
169
|
}) : /*#__PURE__*/React.createElement(IconFont, {
|
|
164
170
|
type: "lm-player-quanping",
|
|
165
171
|
title: "\u5168\u5C4F"
|
|
166
|
-
}))));
|
|
172
|
+
})))));
|
|
167
173
|
}
|
|
168
174
|
|
|
169
175
|
export default LiveTools;
|
|
@@ -6,5 +6,5 @@ import './index.less';
|
|
|
6
6
|
* @param param0
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
|
-
declare function RecordPlayer({ list, children, queryRecord, onIndexChange, onClose, onCloseAll, download }: IRecordPlayerProps): JSX.Element;
|
|
9
|
+
declare function RecordPlayer({ list, children, queryRecord, onIndexChange, onClose, onCloseAll, download, snapshot, defaultScreen, screenChange, defaultSelectIndex, }: IRecordPlayerProps): JSX.Element;
|
|
10
10
|
export default RecordPlayer;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
2
|
|
|
3
|
+
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
3
4
|
import "antd/lib/message/style";
|
|
4
5
|
import _message from "antd/lib/message";
|
|
5
6
|
import _usePrevious from "ahooks/es/usePrevious";
|
|
@@ -61,9 +62,15 @@ function RecordPlayer(_ref) {
|
|
|
61
62
|
onIndexChange = _ref.onIndexChange,
|
|
62
63
|
onClose = _ref.onClose,
|
|
63
64
|
onCloseAll = _ref.onCloseAll,
|
|
64
|
-
download = _ref.download
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
download = _ref.download,
|
|
66
|
+
snapshot = _ref.snapshot,
|
|
67
|
+
defaultScreen = _ref.defaultScreen,
|
|
68
|
+
screenChange = _ref.screenChange,
|
|
69
|
+
defaultSelectIndex = _ref.defaultSelectIndex;
|
|
70
|
+
|
|
71
|
+
var _useState = useState(Object.assign(Object.assign({}, defaultState), {
|
|
72
|
+
screenNum: defaultScreen !== null && defaultScreen !== void 0 ? defaultScreen : defaultState.screenNum
|
|
73
|
+
})),
|
|
67
74
|
_useState2 = _slicedToArray(_useState, 2),
|
|
68
75
|
state = _useState2[0],
|
|
69
76
|
setState = _useState2[1];
|
|
@@ -306,18 +313,42 @@ function RecordPlayer(_ref) {
|
|
|
306
313
|
setState(function (old) {
|
|
307
314
|
return Object.assign({}, old);
|
|
308
315
|
});
|
|
309
|
-
};
|
|
310
|
-
|
|
316
|
+
};
|
|
317
|
+
/**
|
|
318
|
+
* 同步外部的selectIndex变化
|
|
319
|
+
*/
|
|
311
320
|
|
|
312
321
|
|
|
313
322
|
useEffect(function () {
|
|
314
|
-
|
|
323
|
+
if (typeof defaultSelectIndex !== 'number') {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
setState(function (old) {
|
|
328
|
+
if (old.selectIndex !== defaultSelectIndex) {
|
|
329
|
+
return Object.assign(Object.assign({}, old), {
|
|
330
|
+
selectIndex: defaultSelectIndex
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return old;
|
|
335
|
+
});
|
|
336
|
+
}, [defaultSelectIndex]); // index变化同步到父组件
|
|
337
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
338
|
+
|
|
339
|
+
_useUpdateEffect(function () {
|
|
340
|
+
return onIndexChange && onIndexChange(state.selectIndex);
|
|
315
341
|
}, [state.selectIndex]);
|
|
342
|
+
|
|
343
|
+
_useUpdateEffect(function () {
|
|
344
|
+
return screenChange && screenChange(state.screenNum);
|
|
345
|
+
}, [state.screenNum]);
|
|
346
|
+
|
|
316
347
|
return /*#__PURE__*/React.createElement("div", {
|
|
317
|
-
className: "split-screen-player-wrapper split-screen-player-wrapper-record"
|
|
318
|
-
ref: domRef
|
|
348
|
+
className: "split-screen-player-wrapper split-screen-player-wrapper-record"
|
|
319
349
|
}, /*#__PURE__*/React.createElement("div", {
|
|
320
|
-
className: "player-layout"
|
|
350
|
+
className: "player-layout",
|
|
351
|
+
ref: domRef
|
|
321
352
|
}, screenList.map(function (item, index) {
|
|
322
353
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
323
354
|
|
|
@@ -377,7 +408,8 @@ function RecordPlayer(_ref) {
|
|
|
377
408
|
onClose: onClose,
|
|
378
409
|
onCloseAll: onCloseAll,
|
|
379
410
|
timeMode: state.timeMode,
|
|
380
|
-
download: download
|
|
411
|
+
download: download,
|
|
412
|
+
snapshot: snapshot
|
|
381
413
|
}), /*#__PURE__*/React.createElement(SegmentTimeLine, {
|
|
382
414
|
begin: timeBegin,
|
|
383
415
|
updateState: updateState,
|
|
@@ -19,6 +19,7 @@ interface IToolsProps {
|
|
|
19
19
|
onCloseAll?: () => void;
|
|
20
20
|
timeMode: number;
|
|
21
21
|
download?: () => void;
|
|
22
|
+
snapshot?: (base64: string) => void;
|
|
22
23
|
}
|
|
23
|
-
declare function RecordTools({ containerRef, updateState, download, screenNum, timeMode, getPlayerItem, mode, toggleFit, fit, time, onTimeChange, onClose, onCloseAll, }: IToolsProps): JSX.Element;
|
|
24
|
+
declare function RecordTools({ containerRef, updateState, download, screenNum, timeMode, getPlayerItem, mode, toggleFit, fit, time, onTimeChange, onClose, onCloseAll, snapshot, }: IToolsProps): JSX.Element;
|
|
24
25
|
export default RecordTools;
|
|
@@ -32,7 +32,8 @@ function RecordTools(_ref) {
|
|
|
32
32
|
time = _ref.time,
|
|
33
33
|
onTimeChange = _ref.onTimeChange,
|
|
34
34
|
onClose = _ref.onClose,
|
|
35
|
-
onCloseAll = _ref.onCloseAll
|
|
35
|
+
onCloseAll = _ref.onCloseAll,
|
|
36
|
+
snapshot = _ref.snapshot;
|
|
36
37
|
|
|
37
38
|
var _useFullscreen = _useFullscreen3(containerRef),
|
|
38
39
|
_useFullscreen2 = _slicedToArray(_useFullscreen, 2),
|
|
@@ -56,9 +57,10 @@ function RecordTools(_ref) {
|
|
|
56
57
|
player ? player.reload ? player.reload() : player.api.reload() : undefined;
|
|
57
58
|
};
|
|
58
59
|
|
|
59
|
-
var
|
|
60
|
+
var snapshotaction = function snapshotaction() {
|
|
60
61
|
var player = getPlayerItem();
|
|
61
|
-
|
|
62
|
+
var base64 = player ? player.api.snapshot() : undefined;
|
|
63
|
+
snapshot && snapshot(base64);
|
|
62
64
|
};
|
|
63
65
|
|
|
64
66
|
var player = getPlayerItem();
|
|
@@ -76,7 +78,7 @@ function RecordTools(_ref) {
|
|
|
76
78
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
77
79
|
type: "lm-player-xiangji1fill",
|
|
78
80
|
title: "\u622A\u56FE",
|
|
79
|
-
onClick:
|
|
81
|
+
onClick: snapshotaction
|
|
80
82
|
})), /*#__PURE__*/React.createElement("span", {
|
|
81
83
|
className: "player-tools-item",
|
|
82
84
|
onClick: reload
|
package/es/ScreenPlayer/demo.js
CHANGED
|
@@ -3,16 +3,16 @@ import _ConfigProvider from "antd/lib/config-provider";
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import LivePlayer from './Live';
|
|
5
5
|
var list = [{
|
|
6
|
-
url: 'https://6a75ef90-
|
|
6
|
+
url: 'https://6a75ef90-3-server.antelopecloud.cn/flv_live?app=live&token=542446023_3356491776_1693469173_b34efba891f35a66b227642f66272534',
|
|
7
7
|
type: 'flv'
|
|
8
8
|
}, {
|
|
9
|
-
url: 'https://6a75ef90-
|
|
9
|
+
url: 'https://6a75ef90-3-server.antelopecloud.cn/flv_live?app=live&token=542446023_3356491776_1693469173_b34efba891f35a66b227642f66272534',
|
|
10
10
|
type: 'flv'
|
|
11
11
|
}, {
|
|
12
|
-
url: 'https://6a75ef90-
|
|
12
|
+
url: 'https://6a75ef90-1-server.antelopecloud.cn/flv_live?app=live&token=542453821_3356491776_1693535323_3a90f54c141b9a246d5679678ebafe90',
|
|
13
13
|
type: 'flv'
|
|
14
14
|
}, {
|
|
15
|
-
url: 'https://
|
|
15
|
+
url: 'https://6a75ef88-6-server.antelopecloud.cn/flv_live?app=live&token=542449206_3356491776_1693535342_803846974f04eb02e8115d10432d062f',
|
|
16
16
|
type: 'flv'
|
|
17
17
|
}];
|
|
18
18
|
export default function App() {
|
package/es/ScreenPlayer/demo2.js
CHANGED
|
@@ -28,7 +28,7 @@ import RecordPlayer from './Record';
|
|
|
28
28
|
import moment from 'moment';
|
|
29
29
|
import Service from '../Service';
|
|
30
30
|
import { completionSegments } from './utils';
|
|
31
|
-
var token = "eyJhbGciOiJIUzI1NiJ9.
|
|
31
|
+
var token = "eyJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb25JZCI6IjEwMDEwMTAwMDQ0NSIsImV4dCI6MTY2MjI1ODMwNzUxNSwidWlkIjoiMTAxMDAwMDAwNjk5IiwidmFsaWRTdGF0ZSI6MTA0NDA2LCJyb2xlSWQiOlsxMDAwMDAxMTA1MTgsMTAwMDAwMTEwNzI4XSwidmFsaWRUaW1lIjoxNzA0MzgzOTk5MDAwLCJvcHRDZW50ZXJJZCI6IjEwMDEwMDAwMDIzMyIsInVzZXJUeXBlIjoxMDA3MDQsImlhdCI6MTY2MTk5OTEwNzUxNX0.uk_G3vqBCFqxQM2jbV6CSN-z9YNVt_cx5nWXkSuCOIA";
|
|
32
32
|
var cids = ['538509097', '539172446'];
|
|
33
33
|
|
|
34
34
|
var query = function query(_ref) {
|
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
.split-screen-player-wrapper .player-layout .player-with-ext-layout.player-current-index .lm-player-ext-layout {
|
|
20
20
|
border: 1px solid var(--primary);
|
|
21
21
|
}
|
|
22
|
+
.split-screen-player-wrapper.split-screen-player-live-wrapper .player-layout {
|
|
23
|
+
height: calc(100% - 42px);
|
|
24
|
+
}
|
|
22
25
|
.split-screen-player-wrapper .player-tools-group {
|
|
23
26
|
height: 88px;
|
|
24
27
|
position: relative;
|
|
@@ -24,7 +24,7 @@ export interface IRecordPlayerProps {
|
|
|
24
24
|
/**
|
|
25
25
|
* 窗口索引变化,后续基于索引传入播放必要数据
|
|
26
26
|
*/
|
|
27
|
-
onIndexChange
|
|
27
|
+
onIndexChange?: (idx: number) => void;
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* 关闭单个窗口
|
|
@@ -39,6 +39,14 @@ export interface IRecordPlayerProps {
|
|
|
39
39
|
* 录像下载回调
|
|
40
40
|
*/
|
|
41
41
|
download?: () => void;
|
|
42
|
+
|
|
43
|
+
snapshot?: (base64: string) => void;
|
|
44
|
+
|
|
45
|
+
screenChange?: (num: number) => void;
|
|
46
|
+
|
|
47
|
+
defaultScreen?: 1 | 4 | 6 | 9 | 16;
|
|
48
|
+
|
|
49
|
+
defaultSelectIndex?: number;
|
|
42
50
|
}
|
|
43
51
|
|
|
44
52
|
export interface IRecordPlayerState {
|
|
@@ -87,6 +95,7 @@ export type ScreenItemLivePlayerType = {
|
|
|
87
95
|
url?: string;
|
|
88
96
|
type?: 'flv' | 'hls' | 'native';
|
|
89
97
|
mode?: PlayModeType;
|
|
98
|
+
cid?: string;
|
|
90
99
|
};
|
|
91
100
|
|
|
92
101
|
export interface ILivePlayerProps {
|
|
@@ -105,7 +114,15 @@ export interface ILivePlayerProps {
|
|
|
105
114
|
/**
|
|
106
115
|
* 窗口索引变化,后续基于索引传入播放必要数据
|
|
107
116
|
*/
|
|
108
|
-
onIndexChange
|
|
117
|
+
onIndexChange?: (idx: number) => void;
|
|
118
|
+
|
|
119
|
+
snapshot?: (base64: string) => void;
|
|
120
|
+
|
|
121
|
+
screenChange?: (num: number) => void;
|
|
122
|
+
|
|
123
|
+
defaultScreen?: 1 | 4 | 6 | 9 | 16;
|
|
124
|
+
|
|
125
|
+
defaultSelectIndex?: number;
|
|
109
126
|
}
|
|
110
127
|
|
|
111
128
|
export interface ILivePlayerState {
|
package/es/ScreenPlayer/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@cloud-app-dev/vidc",
|
|
4
4
|
"description": "Video Image Data Componennts",
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.11",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "dumi dev",
|
|
8
8
|
"docs:build": "dumi build",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
]
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
+
"@cloud-app-dev/flv.js": "^1.0.3",
|
|
33
34
|
"ahooks": "^3.7.0",
|
|
34
35
|
"axios": "^0.27.2",
|
|
35
|
-
"flv.zv.js": "^2.2.0",
|
|
36
36
|
"hls.js": "^1.2.1",
|
|
37
37
|
"immer": "^9.0.15",
|
|
38
38
|
"lodash-es": "^4.17.21",
|