@cloud-app-dev/vidc 3.1.22 → 3.2.2
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 +0 -3
- package/es/PlayerExt/index.d.ts +3 -1
- package/es/PlayerExt/index.js +18 -6
- package/es/ScreenPlayer/PlayerWithExt.js +2 -1
- package/es/ScreenPlayer/RatePick.js +6 -0
- package/es/ScreenPlayer/Record.d.ts +1 -1
- package/es/ScreenPlayer/Record.js +100 -155
- package/es/ScreenPlayer/RecordTools.js +3 -3
- package/es/ScreenPlayer/demo2.js +132 -52
- package/es/ScreenPlayer/interface.d.ts +21 -29
- package/es/ScreenPlayer/utils.d.ts +1 -11
- package/es/ScreenPlayer/utils.js +8 -20
- package/package.json +1 -1
- package/es/ScreenPlayer/useRecordList.d.ts +0 -8
- package/es/ScreenPlayer/useRecordList.js +0 -245
package/es/ScreenPlayer/demo2.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
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); }
|
|
1
2
|
import "antd/lib/date-picker/style";
|
|
2
3
|
import _DatePicker from "antd/lib/date-picker";
|
|
3
4
|
import "antd/lib/config-provider/style";
|
|
4
5
|
import _ConfigProvider from "antd/lib/config-provider";
|
|
6
|
+
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; }
|
|
5
7
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
8
|
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."); }
|
|
7
9
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
@@ -12,31 +14,50 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
12
14
|
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; }
|
|
13
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; }
|
|
14
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
-
import { __rest } from "tslib";
|
|
17
|
+
import { __awaiter, __rest } from "tslib";
|
|
16
18
|
import React, { useMemo, useState } from 'react';
|
|
17
19
|
import RecordPlayer from './Record';
|
|
18
20
|
import moment from 'moment';
|
|
19
21
|
import { completionSegments } from './utils';
|
|
20
|
-
|
|
22
|
+
import Service from '../Service';
|
|
23
|
+
var token = "eyJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb25JZCI6IjEwMDEwMTAwMDQ0NSIsImV4dCI6MTY2ODI1OTg2NjQyNywidWlkIjoiMTAxMDAwMDAwNjk5IiwidmFsaWRTdGF0ZSI6MTA0NDA2LCJyb2xlSWQiOlsxMDAwMDAxMTA1MTgsMTAwMDAwMTEwNzI4XSwidmFsaWRUaW1lIjoxNzA0MzgzOTk5MDAwLCJvcHRDZW50ZXJJZCI6IjEwMDEwMDAwMDIzMyIsInVzZXJUeXBlIjoxMDA3MDQsImlhdCI6MTY2ODAwMDY2NjQyN30.LukoTVo52uE6X5nqlXhDuXLX02mAbpRA5pR1ROObmKA";
|
|
24
|
+
var cids = ['560077633', '560073578'];
|
|
21
25
|
var query = function query(_a) {
|
|
22
26
|
var cid = _a.cid,
|
|
23
27
|
date = _a.date,
|
|
24
28
|
recordType = _a.recordType,
|
|
25
29
|
props = __rest(_a, ["cid", "date", "recordType"]);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
// const json = {
|
|
31
|
+
// code: 0,
|
|
32
|
+
// message: '成功',
|
|
33
|
+
// data: [
|
|
34
|
+
// {
|
|
35
|
+
// beginTime: '1667995200',
|
|
36
|
+
// endTime: '1667996100',
|
|
37
|
+
// url: 'https://jxsr-oss1.antelopecloud.cn/oss/v1/560077633/record/m3u8/1667995200_1667996100.m3u8?client_token=560077633_0_1668087138_21ad227ea16c7b29c11ea741f12bba36&head=1',
|
|
38
|
+
// },
|
|
39
|
+
// {
|
|
40
|
+
// beginTime: '1667996100',
|
|
41
|
+
// endTime: '1667997000',
|
|
42
|
+
// url: 'https://jxsr-oss1.antelopecloud.cn/oss/v1/560077633/record/m3u8/1667996100_1667997000.m3u8?client_token=560077633_0_1668087138_21ad227ea16c7b29c11ea741f12bba36',
|
|
43
|
+
// },
|
|
44
|
+
// {
|
|
45
|
+
// beginTime: '1667997000',
|
|
46
|
+
// endTime: '1667997900',
|
|
47
|
+
// url: 'https://jxsr-oss1.antelopecloud.cn/oss/v1/560077633/record/m3u8/1667997000_1667997900.m3u8?client_token=560077633_0_1668087138_21ad227ea16c7b29c11ea741f12bba36',
|
|
48
|
+
// },
|
|
49
|
+
// {
|
|
50
|
+
// beginTime: '1667997900',
|
|
51
|
+
// endTime: '1667998800',
|
|
52
|
+
// url: 'https://jxsr-oss1.antelopecloud.cn/oss/v1/560077633/record/m3u8/1667997900_1667998800.m3u8?client_token=560077633_0_1668087138_21ad227ea16c7b29c11ea741f12bba36',
|
|
53
|
+
// },
|
|
54
|
+
// {
|
|
55
|
+
// beginTime: '1667998800',
|
|
56
|
+
// endTime: '1667999136',
|
|
57
|
+
// url: 'https://jxsr-oss1.antelopecloud.cn/oss/v1/560077633/record/m3u8/1667998800_1667999136.m3u8?client_token=560077633_0_1668087138_21ad227ea16c7b29c11ea741f12bba36',
|
|
58
|
+
// },
|
|
59
|
+
// ],
|
|
60
|
+
// };
|
|
40
61
|
var m = moment(date);
|
|
41
62
|
var beginTime = m.set({
|
|
42
63
|
hours: 0,
|
|
@@ -48,15 +69,19 @@ var query = function query(_a) {
|
|
|
48
69
|
minutes: 59,
|
|
49
70
|
seconds: 59
|
|
50
71
|
}).unix();
|
|
51
|
-
var promise =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
72
|
+
var promise = Service.http({
|
|
73
|
+
method: 'post',
|
|
74
|
+
url: "https://jxsr-eye.antelopecloud.cn/api/staticResource/v2/video/queryHistoryAddress?Authorization=".concat(token),
|
|
75
|
+
data: {
|
|
76
|
+
cid: cid,
|
|
77
|
+
mediaType: 'hls',
|
|
78
|
+
beginTime: beginTime,
|
|
79
|
+
endTime: endTime
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
// const promise = Promise.resolve(json.data.map((v: any) => ({ url: v.play_url, beginTime: v.begin, endTime: v.end })));
|
|
58
83
|
return promise.then(function (res) {
|
|
59
|
-
return completionSegments(beginTime, endTime, res).map(function (v) {
|
|
84
|
+
return completionSegments(beginTime, endTime, res.data).map(function (v) {
|
|
60
85
|
return Object.assign(Object.assign({}, v), {
|
|
61
86
|
beginTime: v.beginTime * 1000,
|
|
62
87
|
endTime: v.endTime * 1000
|
|
@@ -69,6 +94,7 @@ var query = function query(_a) {
|
|
|
69
94
|
});
|
|
70
95
|
};
|
|
71
96
|
export default function App() {
|
|
97
|
+
var _this = this;
|
|
72
98
|
var _useState = useState({
|
|
73
99
|
list: [],
|
|
74
100
|
idx: 0
|
|
@@ -83,7 +109,6 @@ export default function App() {
|
|
|
83
109
|
second: 0
|
|
84
110
|
}) : undefined;
|
|
85
111
|
}, [state.list, state.idx]);
|
|
86
|
-
console.log(state.list);
|
|
87
112
|
return /*#__PURE__*/React.createElement(_ConfigProvider, {
|
|
88
113
|
prefixCls: "cloudapp"
|
|
89
114
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -93,24 +118,52 @@ export default function App() {
|
|
|
93
118
|
}, /*#__PURE__*/React.createElement(_DatePicker, {
|
|
94
119
|
value: value,
|
|
95
120
|
onChange: function onChange(v) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
121
|
+
return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
122
|
+
var list, flag, cid, date, item, segments;
|
|
123
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
124
|
+
while (1) {
|
|
125
|
+
switch (_context.prev = _context.next) {
|
|
126
|
+
case 0:
|
|
127
|
+
list = _toConsumableArray(state.list);
|
|
128
|
+
flag = state.idx % 2 === 0;
|
|
129
|
+
cid = flag ? cids[0] : cids[1];
|
|
130
|
+
date = v.set({
|
|
131
|
+
hours: 0,
|
|
132
|
+
minutes: 0,
|
|
133
|
+
seconds: 0
|
|
134
|
+
}).valueOf();
|
|
135
|
+
item = {
|
|
136
|
+
date: date,
|
|
137
|
+
cid: cid,
|
|
138
|
+
type: 'hls',
|
|
139
|
+
recordType: 1,
|
|
140
|
+
loading: true
|
|
141
|
+
};
|
|
142
|
+
list[state.idx] = item;
|
|
143
|
+
setState(function (old) {
|
|
144
|
+
return Object.assign(Object.assign({}, old), {
|
|
145
|
+
list: list
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
_context.next = 9;
|
|
149
|
+
return query(item);
|
|
150
|
+
case 9:
|
|
151
|
+
segments = _context.sent;
|
|
152
|
+
item.loading = false;
|
|
153
|
+
item.segments = segments;
|
|
154
|
+
list[state.idx] = item;
|
|
155
|
+
setState(function (old) {
|
|
156
|
+
return Object.assign(Object.assign({}, old), {
|
|
157
|
+
list: _toConsumableArray(list)
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
case 14:
|
|
161
|
+
case "end":
|
|
162
|
+
return _context.stop();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}, _callee);
|
|
166
|
+
}));
|
|
114
167
|
}
|
|
115
168
|
}), /*#__PURE__*/React.createElement("div", {
|
|
116
169
|
style: {
|
|
@@ -120,7 +173,6 @@ export default function App() {
|
|
|
120
173
|
}
|
|
121
174
|
}, /*#__PURE__*/React.createElement(RecordPlayer, {
|
|
122
175
|
list: state.list,
|
|
123
|
-
queryRecord: query,
|
|
124
176
|
onIndexChange: function onIndexChange(idx) {
|
|
125
177
|
return setState(function (old) {
|
|
126
178
|
return Object.assign(Object.assign({}, old), {
|
|
@@ -128,14 +180,42 @@ export default function App() {
|
|
|
128
180
|
});
|
|
129
181
|
});
|
|
130
182
|
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
183
|
+
onTimeLineChange: function onTimeLineChange(date) {
|
|
184
|
+
return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
185
|
+
var item, segments;
|
|
186
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
187
|
+
while (1) {
|
|
188
|
+
switch (_context2.prev = _context2.next) {
|
|
189
|
+
case 0:
|
|
190
|
+
item = state.list[state.idx];
|
|
191
|
+
state.list[state.idx].loading = true;
|
|
192
|
+
setState(function (old) {
|
|
193
|
+
return Object.assign(Object.assign({}, old), {
|
|
194
|
+
list: _toConsumableArray(state.list)
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
_context2.next = 5;
|
|
198
|
+
return query({
|
|
199
|
+
cid: item.cid,
|
|
200
|
+
date: date,
|
|
201
|
+
recordType: 1
|
|
202
|
+
});
|
|
203
|
+
case 5:
|
|
204
|
+
segments = _context2.sent;
|
|
205
|
+
state.list[state.idx].loading = false;
|
|
206
|
+
state.list[state.idx].segments = [].concat(_toConsumableArray(segments), _toConsumableArray(state.list[state.idx].segments));
|
|
207
|
+
setState(function (old) {
|
|
208
|
+
return Object.assign(Object.assign({}, old), {
|
|
209
|
+
list: _toConsumableArray(state.list)
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
case 9:
|
|
213
|
+
case "end":
|
|
214
|
+
return _context2.stop();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}, _callee2);
|
|
218
|
+
}));
|
|
139
219
|
},
|
|
140
220
|
onClose: function onClose() {
|
|
141
221
|
var list = state.list;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { PlayModeType } from '../PlayerExt';
|
|
3
|
-
import type { ISegmentType,ExportPlayerType } from '../Player/player';
|
|
3
|
+
import type { ISegmentType, ExportPlayerType } from '../Player/player';
|
|
4
4
|
|
|
5
5
|
export type RecordItem = {
|
|
6
6
|
type?: 'flv' | 'hls' | 'native';
|
|
@@ -10,22 +10,16 @@ export type RecordItem = {
|
|
|
10
10
|
url?: string;
|
|
11
11
|
recordType?: 1 | 2; //1云录像 2前端录像
|
|
12
12
|
mode?: PlayModeType;
|
|
13
|
+
loading?: boolean; // 录像获取状态
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
export interface IRecordPlayerProps {
|
|
16
17
|
/**
|
|
17
18
|
* 播放对象
|
|
18
19
|
*/
|
|
19
|
-
list?:
|
|
20
|
+
list?: RecordItem[];
|
|
20
21
|
children?: JSX.Element;
|
|
21
22
|
|
|
22
|
-
/**
|
|
23
|
-
* 获取录像,此处要自行做好错误处理
|
|
24
|
-
*/
|
|
25
|
-
queryRecord: (options: { cid: string; date: number; recordType: 1 | 2 }) => Promise<ISegmentType[]>;
|
|
26
|
-
|
|
27
|
-
queryRecordErrorHandle?: (index: number) => void;
|
|
28
|
-
|
|
29
23
|
/**
|
|
30
24
|
* 窗口索引变化,后续基于索引传入播放必要数据
|
|
31
25
|
*/
|
|
@@ -88,7 +82,20 @@ export interface IRecordPlayerProps {
|
|
|
88
82
|
*/
|
|
89
83
|
getLocalRecordUrl?: (options: { url: URL; begin: number; end: number }) => Promise<string>;
|
|
90
84
|
|
|
85
|
+
/**
|
|
86
|
+
* 插件下载地址
|
|
87
|
+
*/
|
|
91
88
|
pluginDownloadUrl?: string;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 轴发生变化
|
|
92
|
+
*/
|
|
93
|
+
onTimeLineChange?: (time: number) => void;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 用户控制seek频率
|
|
97
|
+
*/
|
|
98
|
+
seekLoading?: boolean;
|
|
92
99
|
}
|
|
93
100
|
|
|
94
101
|
export interface IRecordPlayerState {
|
|
@@ -105,37 +112,22 @@ export interface IRecordPlayerState {
|
|
|
105
112
|
/**
|
|
106
113
|
* 插件OR浏览器
|
|
107
114
|
*/
|
|
108
|
-
modes: {[key:string]:PlayModeType};
|
|
115
|
+
modes: { [key: string]: PlayModeType };
|
|
109
116
|
|
|
110
117
|
/**
|
|
111
118
|
* 时间轴开始时间
|
|
112
119
|
*/
|
|
113
|
-
currentTimes: {[key:string]:number};
|
|
120
|
+
currentTimes: { [key: string]: number };
|
|
114
121
|
|
|
115
122
|
/**
|
|
116
123
|
* 需要seek的时间针对当前窗口,为0时忽略
|
|
117
124
|
*/
|
|
118
|
-
seekTo?: number;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* 接收外部list变化,同时存储滑动时间轴后新日期的片段
|
|
122
|
-
*/
|
|
123
|
-
mergeSegments?: RecordItem[];
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* 加载中,用于拦截多次时间轴变化需要加载片段的情况
|
|
127
|
-
*/
|
|
128
|
-
loading?: boolean;
|
|
125
|
+
seekTo?: { [key: string]: number };
|
|
129
126
|
|
|
130
127
|
/**
|
|
131
128
|
* 录像时间轴单页绘制时长单位(hour)
|
|
132
129
|
*/
|
|
133
130
|
timeMode: number;
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* 窗口播放状态
|
|
137
|
-
*/
|
|
138
|
-
winLoadingStatus: {[key:string]:boolean};
|
|
139
131
|
}
|
|
140
132
|
|
|
141
133
|
export type ScreenItemLivePlayerType = {
|
|
@@ -205,9 +197,9 @@ export interface ILivePlayerProps {
|
|
|
205
197
|
export interface ILivePlayerState {
|
|
206
198
|
screenNum: number;
|
|
207
199
|
selectIndex: number;
|
|
208
|
-
modes: {[key:string]:PlayModeType};
|
|
200
|
+
modes: { [key: string]: PlayModeType };
|
|
209
201
|
}
|
|
210
202
|
|
|
211
203
|
export const RecordPlayer: React.FC<IRecordPlayerProps>;
|
|
212
204
|
|
|
213
|
-
export type PlayItemMapType = { [key: string]: React.MutableRefObject<ExportPlayerType> };
|
|
205
|
+
export type PlayItemMapType = { [key: string]: React.MutableRefObject<ExportPlayerType> };
|
|
@@ -9,17 +9,6 @@ export declare const TimeModeLibs: {
|
|
|
9
9
|
name: number;
|
|
10
10
|
}[];
|
|
11
11
|
export declare function mergeFill<T, S>(len: number, mergeArr: T[], fillItem: S): (T | S)[];
|
|
12
|
-
export declare const FILTER_KEY = "00|11|00";
|
|
13
|
-
/**
|
|
14
|
-
* 找出两个数组不等的索引
|
|
15
|
-
* @param arr1
|
|
16
|
-
* @param arr2
|
|
17
|
-
* @returns
|
|
18
|
-
*/
|
|
19
|
-
export declare function differenceWithIndexs(arr1: any[], arr2: any[]): {
|
|
20
|
-
idx: number;
|
|
21
|
-
value: string;
|
|
22
|
-
}[];
|
|
23
12
|
/**
|
|
24
13
|
* unix时间戳
|
|
25
14
|
* @param start
|
|
@@ -27,3 +16,4 @@ export declare function differenceWithIndexs(arr1: any[], arr2: any[]): {
|
|
|
27
16
|
* @param segments
|
|
28
17
|
*/
|
|
29
18
|
export declare const completionSegments: (start: number, end: number, segments: ISegmentType[]) => ISegmentType[];
|
|
19
|
+
export declare function sleep(time: number): Promise<unknown>;
|
package/es/ScreenPlayer/utils.js
CHANGED
|
@@ -38,25 +38,6 @@ export function mergeFill(len, mergeArr, fillItem) {
|
|
|
38
38
|
return mergeArr[i] ? mergeArr[i] : v;
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
export var FILTER_KEY = '00|11|00'; // 需要忽略的key值
|
|
42
|
-
/**
|
|
43
|
-
* 找出两个数组不等的索引
|
|
44
|
-
* @param arr1
|
|
45
|
-
* @param arr2
|
|
46
|
-
* @returns
|
|
47
|
-
*/
|
|
48
|
-
export function differenceWithIndexs(arr1, arr2) {
|
|
49
|
-
var idxs = [];
|
|
50
|
-
arr1.forEach(function (item, index) {
|
|
51
|
-
if (item && item !== arr2[index]) {
|
|
52
|
-
idxs.push({
|
|
53
|
-
idx: index,
|
|
54
|
-
value: item
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
return idxs;
|
|
59
|
-
}
|
|
60
41
|
/**
|
|
61
42
|
* unix时间戳
|
|
62
43
|
* @param start
|
|
@@ -91,4 +72,11 @@ export var completionSegments = function completionSegments(start, end, segments
|
|
|
91
72
|
});
|
|
92
73
|
}
|
|
93
74
|
return arr;
|
|
94
|
-
};
|
|
75
|
+
};
|
|
76
|
+
export function sleep(time) {
|
|
77
|
+
return new Promise(function (reslove) {
|
|
78
|
+
return setTimeout(function () {
|
|
79
|
+
return reslove(time);
|
|
80
|
+
}, time);
|
|
81
|
+
});
|
|
82
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ISegmentType } from '../Player/player';
|
|
2
|
-
import { RecordItem } from './interface';
|
|
3
|
-
interface IUseRecordOptions {
|
|
4
|
-
loaddingCallback: (index: number, loading: boolean) => void;
|
|
5
|
-
errorCallback: (index: number) => void;
|
|
6
|
-
}
|
|
7
|
-
declare function useRecordList(list: RecordItem[], queryRecord: (options: any) => Promise<ISegmentType[]>, options: IUseRecordOptions): RecordItem[];
|
|
8
|
-
export default useRecordList;
|