@cloud-app-dev/vidc 3.1.21 → 3.2.1

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.
@@ -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
- var cids = ['538509097', '539172446'];
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
- var json = {
27
- code: 0,
28
- codeRemark: '操作成功',
29
- data: [{
30
- begin: 1666627615,
31
- end: 1666697789,
32
- play_url: 'http://192.168.2.63:18092/flv/vod/2834d2b1be2ca7056_1/1bd7e2db944e0c87f.flv?origin_url=sdk%3A%2F%2Fadmin%3Alingyang123%40192.168.2.200%3A8000%2Fcam%2Fplayback%3Ffactory%3Dhikvision%26channel%3D1%26subType%3D0%26startTime%3D1666627615%26endTime%3D1666697789'
33
- }, {
34
- begin: 1666697792,
35
- end: 1666713420,
36
- play_url: 'http://192.168.2.63:18092/flv/vod/2834d2b1be2ca7056_1/1a151c645418ceec0.flv?origin_url=sdk%3A%2F%2Fadmin%3Alingyang123%40192.168.2.200%3A8000%2Fcam%2Fplayback%3Ffactory%3Dhikvision%26channel%3D1%26subType%3D0%26startTime%3D1666697792%26endTime%3D1666713420'
37
- }]
38
- };
39
- console.log(cid, date, recordType, props);
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 = Promise.resolve(json.data.map(function (v) {
52
- return {
53
- url: v.play_url,
54
- beginTime: v.begin,
55
- endTime: v.end
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
- var flag = state.idx % 2 === 0;
97
- setState(function (old) {
98
- var list = old.list;
99
- list[old.idx] = {
100
- date: v.set({
101
- hours: 0,
102
- seconds: 0,
103
- minutes: 0
104
- }).valueOf(),
105
- cid: flag ? cids[0] : cids[1],
106
- type: flag ? 'hls' : 'flv',
107
- recordType: flag ? 1 : 2,
108
- aaa: 111
109
- };
110
- return Object.assign(Object.assign({}, old), {
111
- list: _toConsumableArray(list)
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: {
@@ -128,14 +181,42 @@ export default function App() {
128
181
  });
129
182
  });
130
183
  },
131
- queryRecordErrorHandle: function queryRecordErrorHandle(idx) {
132
- var list = state.list;
133
- list[idx] = undefined;
134
- setState(function (old) {
135
- return Object.assign(Object.assign({}, old), {
136
- list: _toConsumableArray(list)
137
- });
138
- });
184
+ onTimeLineChange: function onTimeLineChange(date) {
185
+ return __awaiter(_this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
186
+ var item, segments;
187
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
188
+ while (1) {
189
+ switch (_context2.prev = _context2.next) {
190
+ case 0:
191
+ item = state.list[state.idx];
192
+ state.list[state.idx].loading = true;
193
+ setState(function (old) {
194
+ return Object.assign(Object.assign({}, old), {
195
+ list: _toConsumableArray(state.list)
196
+ });
197
+ });
198
+ _context2.next = 5;
199
+ return query({
200
+ cid: item.cid,
201
+ date: date,
202
+ recordType: 1
203
+ });
204
+ case 5:
205
+ segments = _context2.sent;
206
+ state.list[state.idx].loading = false;
207
+ state.list[state.idx].segments = [].concat(_toConsumableArray(segments), _toConsumableArray(state.list[state.idx].segments));
208
+ setState(function (old) {
209
+ return Object.assign(Object.assign({}, old), {
210
+ list: _toConsumableArray(state.list)
211
+ });
212
+ });
213
+ case 9:
214
+ case "end":
215
+ return _context2.stop();
216
+ }
217
+ }
218
+ }, _callee2);
219
+ }));
139
220
  },
140
221
  onClose: function onClose() {
141
222
  var list = state.list;
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- import { PlayModeType } from '../PlayerExt';
3
- import { ISegmentType } from '../Player/player';
1
+ import type React from 'react';
2
+ import type { PlayModeType } from '../PlayerExt';
3
+ import type { ISegmentType, ExportPlayerType } from '../Player/player';
4
4
 
5
5
  export type RecordItem = {
6
6
  type?: 'flv' | 'hls' | 'native';
@@ -10,13 +10,14 @@ 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?: Omit<RecordItem, 'segments' | 'url'>[];
20
+ list?: RecordItem[];
20
21
  children?: JSX.Element;
21
22
 
22
23
  /**
@@ -88,7 +89,20 @@ export interface IRecordPlayerProps {
88
89
  */
89
90
  getLocalRecordUrl?: (options: { url: URL; begin: number; end: number }) => Promise<string>;
90
91
 
92
+ /**
93
+ * 插件下载地址
94
+ */
91
95
  pluginDownloadUrl?: string;
96
+
97
+ /**
98
+ * 轴发生变化
99
+ */
100
+ onTimeLineChange?: (time: number) => void;
101
+
102
+ /**
103
+ * 用户控制seek频率
104
+ */
105
+ seekLoading?: boolean;
92
106
  }
93
107
 
94
108
  export interface IRecordPlayerState {
@@ -105,37 +119,22 @@ export interface IRecordPlayerState {
105
119
  /**
106
120
  * 插件OR浏览器
107
121
  */
108
- modes: PlayModeType[];
122
+ modes: { [key: string]: PlayModeType };
109
123
 
110
124
  /**
111
125
  * 时间轴开始时间
112
126
  */
113
- currentTimes: number[];
127
+ currentTimes: { [key: string]: number };
114
128
 
115
129
  /**
116
130
  * 需要seek的时间针对当前窗口,为0时忽略
117
131
  */
118
- seekTo?: number;
119
-
120
- /**
121
- * 接收外部list变化,同时存储滑动时间轴后新日期的片段
122
- */
123
- mergeSegments?: RecordItem[];
124
-
125
- /**
126
- * 加载中,用于拦截多次时间轴变化需要加载片段的情况
127
- */
128
- loading?: boolean;
132
+ seekTo?: { [key: string]: number };
129
133
 
130
134
  /**
131
135
  * 录像时间轴单页绘制时长单位(hour)
132
136
  */
133
137
  timeMode: number;
134
-
135
- /**
136
- * 窗口播放状态
137
- */
138
- winLoadingStatus: boolean[];
139
138
  }
140
139
 
141
140
  export type ScreenItemLivePlayerType = {
@@ -205,7 +204,9 @@ export interface ILivePlayerProps {
205
204
  export interface ILivePlayerState {
206
205
  screenNum: number;
207
206
  selectIndex: number;
208
- modes: PlayModeType[];
207
+ modes: { [key: string]: PlayModeType };
209
208
  }
210
209
 
211
210
  export const RecordPlayer: React.FC<IRecordPlayerProps>;
211
+
212
+ 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>;
@@ -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
@@ -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.1.21",
5
+ "version": "3.2.1",
6
6
  "scripts": {
7
7
  "start": "dumi dev",
8
8
  "docs:build": "dumi build",
@@ -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;