@cloud-app-dev/vidc 2.2.0-alpha.4 → 2.2.0-alpha.7
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/es/Api/index.js +16 -12
- package/es/AppContext/static.js +11 -6
- package/es/CheckGroupFixed/index.js +8 -6
- package/es/FullScreen/index.d.ts +12 -0
- package/es/FullScreen/index.js +1 -1
- package/es/InitialConfig/utils.js +12 -8
- package/es/InitialRequest/index.js +6 -2
- package/es/InitialRequest/utils.js +6 -2
- package/es/List/DynamicDeviceList/utils.js +6 -2
- package/es/List/DynamicGridList/index.js +7 -4
- package/es/List/GridList/Demo.js +13 -35
- package/es/List/GridList/data.json +710 -0
- package/es/List/GridList/index.d.ts +2 -2
- package/es/List/GridList/index.js +2 -1
- package/es/List/index.d.ts +3 -1
- package/es/List/index.js +4 -0
- package/es/LoaderApp/index.js +6 -2
- package/es/LoaderApp/loader.js +8 -4
- package/es/LoaderApp/utils.js +6 -2
- package/es/LoaderScript/utils.js +10 -6
- package/es/Modal/index.d.ts +7 -7
- package/es/Picture/component/DefaultRects/RectInfo.js +1 -1
- package/es/Picture/component/DefaultRects/index.js +1 -1
- package/es/Picture/index.d.ts +2 -0
- package/es/Picture/index.js +13 -7
- package/es/Picture/interface.d.ts +136 -3
- package/es/Picture/loadCaptureRectImage.js +6 -2
- package/es/Picture/utils.d.ts +0 -2
- package/es/Player/api/index.js +1 -1
- package/es/Player/player.d.ts +119 -1
- package/es/Player/single_player.js +4 -3
- package/es/Player/style/timeline.css +1 -1
- package/es/PlayerExt/demo.js +20 -82
- package/es/PlayerExt/index.d.ts +7 -1
- package/es/PlayerExt/index.js +46 -21
- package/es/Service/fetch-adapter.js +6 -2
- package/es/WorkerFlow/Form/EmptyUserSet.js +6 -2
- package/es/WorkerFlow/Form/GroupSelect.js +6 -2
- package/es/WorkerFlow/Form/LevelGroupSelect.js +6 -2
- package/es/WorkerFlow/Form/UserAndGroupSelect.js +6 -2
- package/es/WorkerFlow/Form/UserSelect.js +6 -2
- package/es/WorkerFlow/index.js +6 -2
- package/es/index.d.ts +2 -2
- package/es/index.js +3 -3
- package/es/utils.d.ts +2 -1
- package/es/utils.js +24 -3
- package/package.json +1 -1
- package/pnpm-lock.yaml +13650 -0
|
@@ -1,3 +1,7 @@
|
|
|
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
|
+
|
|
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
|
+
|
|
1
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
6
|
|
|
3
7
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -13,10 +17,10 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
17
|
import { __awaiter } from "tslib";
|
|
14
18
|
import { getCaptureRect } from './utils';
|
|
15
19
|
export function loadCaptureRectImage(image, rect, imageType) {
|
|
16
|
-
return __awaiter(this, void 0, void 0, /*#__PURE__*/
|
|
20
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
17
21
|
var _getCaptureRect, _getCaptureRect2, x, y, w, h, canvas, ctx, url;
|
|
18
22
|
|
|
19
|
-
return
|
|
23
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
20
24
|
while (1) {
|
|
21
25
|
switch (_context.prev = _context.next) {
|
|
22
26
|
case 0:
|
package/es/Picture/utils.d.ts
CHANGED
|
@@ -13,9 +13,7 @@ export declare function computedRectScale({ imageSource, domImg, rects }: {
|
|
|
13
13
|
area?: number;
|
|
14
14
|
tags?: import("./interface").TagItemType[];
|
|
15
15
|
imgUrl?: string;
|
|
16
|
-
smId?: string;
|
|
17
16
|
isDefault?: boolean;
|
|
18
|
-
feature?: string;
|
|
19
17
|
dupId?: string;
|
|
20
18
|
lowQuality?: boolean;
|
|
21
19
|
base64?: string;
|
package/es/Player/api/index.js
CHANGED
|
@@ -256,7 +256,7 @@ export function useTypeAndPlay(url, type, isLive, container, segments, flvConfig
|
|
|
256
256
|
video.removeAttribute('src');
|
|
257
257
|
setState({});
|
|
258
258
|
};
|
|
259
|
-
}, [url, container, segments]);
|
|
259
|
+
}, [url, container, segments, type]);
|
|
260
260
|
return [state.type, state.flv, state.hls];
|
|
261
261
|
} //创建Api
|
|
262
262
|
|
package/es/Player/player.d.ts
CHANGED
|
@@ -10,43 +10,153 @@ export type FlvPlayerConfig = {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export interface ISinglePlayerProps {
|
|
13
|
+
/**
|
|
14
|
+
* 视频播放地址
|
|
15
|
+
*/
|
|
13
16
|
url?: string;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 容器类名
|
|
20
|
+
*/
|
|
14
21
|
className?: string;
|
|
15
22
|
children?: React.ReactNode;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 同html video muted 静音
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
16
28
|
muted?: boolean;
|
|
17
|
-
|
|
29
|
+
/**
|
|
30
|
+
* 同html video autoplay 自动播放
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
18
33
|
autoPlay?: boolean;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 同html video playsinline 自动播放
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
19
39
|
playsInline?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
*同html video preload 预加载
|
|
42
|
+
*/
|
|
20
43
|
preload?: string;
|
|
44
|
+
/**
|
|
45
|
+
* 视频封面
|
|
46
|
+
*/
|
|
21
47
|
poster?: string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 同html video loop 循环
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
22
53
|
loop?: boolean;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 视频格式
|
|
57
|
+
* @default 'native'
|
|
58
|
+
*/
|
|
23
59
|
type?: 'flv' | 'hls' | 'native';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 隐藏工具栏
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
24
65
|
hideContrallerBar?: boolean;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 直播模式
|
|
69
|
+
* @default true
|
|
70
|
+
*/
|
|
25
71
|
isLive?: boolean;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 工具栏右外侧拓展
|
|
75
|
+
*/
|
|
26
76
|
rightExtContents?: React.ReactNode;
|
|
77
|
+
/**
|
|
78
|
+
* 工具栏右内侧拓展
|
|
79
|
+
*/
|
|
27
80
|
rightMidExtContents?: React.ReactNode;
|
|
81
|
+
/**
|
|
82
|
+
* 工具栏左外侧拓展
|
|
83
|
+
*/
|
|
28
84
|
leftExtContents?: React.ReactNode;
|
|
85
|
+
/**
|
|
86
|
+
* 工具栏左内侧拓展
|
|
87
|
+
*/
|
|
29
88
|
leftMidExtContents?: React.ReactNode;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 自定义时间轴
|
|
92
|
+
*/
|
|
30
93
|
customTimeLine?: React.ReactNode;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 错误重试次数
|
|
97
|
+
* @default 5
|
|
98
|
+
*/
|
|
31
99
|
errorReloadTimer?: number;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 自定义flv参数配置
|
|
103
|
+
*/
|
|
32
104
|
flvConfig?: FlvPlayerConfig;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 自定义hls参数配置
|
|
108
|
+
*/
|
|
33
109
|
hlsConfig?: HlsConfig;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 自定义reload函数
|
|
113
|
+
*/
|
|
34
114
|
reload?: () => void;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* 视频可播放时执行钩子
|
|
118
|
+
*/
|
|
35
119
|
onCanPlayerInit?: () => void;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* 自定义video事件
|
|
123
|
+
*/
|
|
36
124
|
videoEvents?: CustomEvent[];
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* 自定义播放器的事件
|
|
128
|
+
*/
|
|
37
129
|
playerEvents?: CustomEvent[];
|
|
38
130
|
}
|
|
39
131
|
|
|
40
132
|
type OmitPlayerProps = 'customTimeLine' | 'onCanPlayerInit' | 'isLive' | 'reload' | 'type';
|
|
41
133
|
|
|
42
134
|
export interface IFrontendPlayerProps extends Omit<ISinglePlayerProps, OmitPlayerProps> {
|
|
135
|
+
/**
|
|
136
|
+
* 前端录像开始时间
|
|
137
|
+
*/
|
|
43
138
|
begin?: number;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* 前端录像结束时间
|
|
142
|
+
*/
|
|
44
143
|
end?: number;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* 录像时间轴发生变化回调
|
|
147
|
+
*/
|
|
45
148
|
onSeek(time: number): void;
|
|
46
149
|
}
|
|
47
150
|
|
|
48
151
|
export interface ISegmentPlayerProps extends Omit<ISinglePlayerProps, 'url' | 'customTimeLine' | 'onCanPlayerInit'> {
|
|
152
|
+
/**
|
|
153
|
+
* 云录像片段信息
|
|
154
|
+
*/
|
|
49
155
|
segments?: ISegmentType[];
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* 云录像开始时间
|
|
159
|
+
*/
|
|
50
160
|
begin?: number;
|
|
51
161
|
}
|
|
52
162
|
|
|
@@ -83,8 +193,16 @@ export type ExportPlayerType = {
|
|
|
83
193
|
};
|
|
84
194
|
|
|
85
195
|
export interface ISegmentType {
|
|
196
|
+
/**
|
|
197
|
+
* 视频片段地址
|
|
198
|
+
*/
|
|
86
199
|
url?: string;
|
|
200
|
+
/**
|
|
201
|
+
* 视频片段长度 单位s(秒)
|
|
202
|
+
*/
|
|
87
203
|
duration: number;
|
|
88
204
|
}
|
|
89
205
|
|
|
206
|
+
export const ISegmentTypeDemo: React.FC<ISegmentType>;
|
|
207
|
+
|
|
90
208
|
export type CustomEvent = [string, () => void];
|
|
@@ -55,11 +55,12 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
55
55
|
}),
|
|
56
56
|
_useState2 = _slicedToArray(_useState, 2),
|
|
57
57
|
state = _useState2[0],
|
|
58
|
-
setState = _useState2[1];
|
|
58
|
+
setState = _useState2[1]; // 视频格式判断,外部可以强制指定,也可以通过url自动判断
|
|
59
|
+
|
|
59
60
|
|
|
60
61
|
var vType = useMemo(function () {
|
|
61
62
|
return type || getVideoType(url);
|
|
62
|
-
}, [url]);
|
|
63
|
+
}, [url, type]);
|
|
63
64
|
var domRef = useRef(null);
|
|
64
65
|
var video = useMemo(function () {
|
|
65
66
|
return state.container ? state.container.querySelector('video') : undefined;
|
|
@@ -81,7 +82,7 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
81
82
|
|
|
82
83
|
var hasLink = useMemo(function () {
|
|
83
84
|
return !!url || !!flvConfig.mediaDataSource.segments && vType === 'flv';
|
|
84
|
-
}, [url, flvConfig.mediaDataSource.segments]); // 存储容器
|
|
85
|
+
}, [url, flvConfig.mediaDataSource.segments, vType]); // 存储容器
|
|
85
86
|
|
|
86
87
|
useEffect(function () {
|
|
87
88
|
setState(function (old) {
|
package/es/PlayerExt/demo.js
CHANGED
|
@@ -38,14 +38,15 @@ var options2 = [{
|
|
|
38
38
|
}, {
|
|
39
39
|
value: 0,
|
|
40
40
|
label: '录像'
|
|
41
|
-
}];
|
|
41
|
+
}]; //http://192.168.101.162:14088/flv/live/1853e2a5c3308bd62/2.flv?device_id=&channel_id=1853e2a5c3308bd62&stream_index=2&ip=0
|
|
42
42
|
|
|
43
|
-
function
|
|
43
|
+
function Demo() {
|
|
44
44
|
var _useState = useState({
|
|
45
45
|
type: undefined,
|
|
46
46
|
isLive: 1,
|
|
47
47
|
url: '',
|
|
48
|
-
tempUrl: ''
|
|
48
|
+
tempUrl: '',
|
|
49
|
+
mode: 1
|
|
49
50
|
}),
|
|
50
51
|
_useState2 = _slicedToArray(_useState, 2),
|
|
51
52
|
state = _useState2[0],
|
|
@@ -56,7 +57,7 @@ function Demo1() {
|
|
|
56
57
|
width: '100%',
|
|
57
58
|
height: 800
|
|
58
59
|
}
|
|
59
|
-
}, /*#__PURE__*/React.createElement("h3", null, "\
|
|
60
|
+
}, /*#__PURE__*/React.createElement("h3", null, "\u63D2\u4EF6\u89C6\u9891\u64AD\u653E"), /*#__PURE__*/React.createElement("div", {
|
|
60
61
|
style: {
|
|
61
62
|
marginBottom: 10,
|
|
62
63
|
display: 'flex'
|
|
@@ -103,96 +104,32 @@ function Demo1() {
|
|
|
103
104
|
key: v.label,
|
|
104
105
|
value: v.value
|
|
105
106
|
}, v.label);
|
|
106
|
-
})), /*#__PURE__*/React.createElement(
|
|
107
|
-
|
|
108
|
-
width: 60,
|
|
109
|
-
height: 32
|
|
110
|
-
},
|
|
111
|
-
onClick: function onClick(e) {
|
|
112
|
-
return setState(function (old) {
|
|
113
|
-
return Object.assign(Object.assign({}, old), {
|
|
114
|
-
url: state.tempUrl
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
}, "\u64AD\u653E")), /*#__PURE__*/React.createElement("div", {
|
|
119
|
-
style: {
|
|
120
|
-
height: 600
|
|
121
|
-
}
|
|
122
|
-
}, /*#__PURE__*/React.createElement(ExtModel, {
|
|
123
|
-
url: state.url,
|
|
124
|
-
mode: 1
|
|
125
|
-
}, /*#__PURE__*/React.createElement(Player, {
|
|
126
|
-
type: state.type,
|
|
127
|
-
url: state.url,
|
|
128
|
-
isLive: !!state.isLive
|
|
129
|
-
}))));
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function Demo2() {
|
|
133
|
-
var _useState3 = useState({
|
|
134
|
-
type: undefined,
|
|
135
|
-
isLive: 1,
|
|
136
|
-
url: '',
|
|
137
|
-
tempUrl: ''
|
|
138
|
-
}),
|
|
139
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
140
|
-
state = _useState4[0],
|
|
141
|
-
setState = _useState4[1];
|
|
142
|
-
|
|
143
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
144
|
-
style: {
|
|
145
|
-
width: '100%',
|
|
146
|
-
height: 800
|
|
147
|
-
}
|
|
148
|
-
}, /*#__PURE__*/React.createElement("h3", null, "\u63D2\u4EF6\u89C6\u9891\u64AD\u653E"), /*#__PURE__*/React.createElement("div", {
|
|
149
|
-
style: {
|
|
150
|
-
marginBottom: 10,
|
|
151
|
-
display: 'flex'
|
|
152
|
-
}
|
|
153
|
-
}, /*#__PURE__*/React.createElement(_Select, {
|
|
154
|
-
value: state.type || '',
|
|
107
|
+
})), /*#__PURE__*/React.createElement(_Select, {
|
|
108
|
+
value: state.mode,
|
|
155
109
|
onChange: function onChange(val) {
|
|
156
110
|
return setState(function (old) {
|
|
157
111
|
return Object.assign(Object.assign({}, old), {
|
|
158
|
-
|
|
112
|
+
mode: val
|
|
159
113
|
});
|
|
160
114
|
});
|
|
161
115
|
}
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
})), /*#__PURE__*/React.createElement(_Input, {
|
|
116
|
+
}, /*#__PURE__*/React.createElement(_Select.Option, {
|
|
117
|
+
value: 1
|
|
118
|
+
}, "\u6D4F\u89C8\u5668\u6A21\u5F0F"), /*#__PURE__*/React.createElement(_Select.Option, {
|
|
119
|
+
value: 2
|
|
120
|
+
}, "\u63D2\u4EF6\u6A21\u5F0F")), /*#__PURE__*/React.createElement(_Button, {
|
|
168
121
|
style: {
|
|
169
|
-
|
|
122
|
+
width: 60,
|
|
170
123
|
height: 32
|
|
171
124
|
},
|
|
172
|
-
|
|
173
|
-
placeholder: "\u8BF7\u8F93\u5165\u89C6\u9891\u5730\u5740",
|
|
174
|
-
onChange: function onChange(e) {
|
|
175
|
-
return setState(function (old) {
|
|
176
|
-
return Object.assign(Object.assign({}, old), {
|
|
177
|
-
tempUrl: e.target.value
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
}), /*#__PURE__*/React.createElement(_Select, {
|
|
182
|
-
value: state.isLive,
|
|
183
|
-
onChange: function onChange(val) {
|
|
125
|
+
onClick: function onClick(e) {
|
|
184
126
|
return setState(function (old) {
|
|
185
127
|
return Object.assign(Object.assign({}, old), {
|
|
186
|
-
|
|
128
|
+
url: ''
|
|
187
129
|
});
|
|
188
130
|
});
|
|
189
131
|
}
|
|
190
|
-
},
|
|
191
|
-
return /*#__PURE__*/React.createElement(_Select.Option, {
|
|
192
|
-
key: v.label,
|
|
193
|
-
value: v.value
|
|
194
|
-
}, v.label);
|
|
195
|
-
})), /*#__PURE__*/React.createElement(_Button, {
|
|
132
|
+
}, "\u5173\u95ED"), /*#__PURE__*/React.createElement(_Button, {
|
|
196
133
|
style: {
|
|
197
134
|
width: 60,
|
|
198
135
|
height: 32
|
|
@@ -210,7 +147,8 @@ function Demo2() {
|
|
|
210
147
|
}
|
|
211
148
|
}, /*#__PURE__*/React.createElement(ExtModel, {
|
|
212
149
|
url: state.url,
|
|
213
|
-
mode:
|
|
150
|
+
mode: state.mode,
|
|
151
|
+
pluginDownloadUrl: "http://192.168.101.162:19999/plugins/ZVPlayer.exe"
|
|
214
152
|
}, /*#__PURE__*/React.createElement(Player, {
|
|
215
153
|
type: state.type,
|
|
216
154
|
url: state.url,
|
|
@@ -221,7 +159,7 @@ function Demo2() {
|
|
|
221
159
|
var App = function App() {
|
|
222
160
|
return /*#__PURE__*/React.createElement(_ConfigProvider, {
|
|
223
161
|
prefixCls: "cloudapp"
|
|
224
|
-
}, /*#__PURE__*/React.createElement(
|
|
162
|
+
}, /*#__PURE__*/React.createElement(Demo, null));
|
|
225
163
|
};
|
|
226
164
|
|
|
227
165
|
export default App;
|
package/es/PlayerExt/index.d.ts
CHANGED
|
@@ -28,8 +28,14 @@ export declare const LOCAL_PORT: string[];
|
|
|
28
28
|
* @returns
|
|
29
29
|
*/
|
|
30
30
|
export declare function getLocalPort(): string;
|
|
31
|
+
/**
|
|
32
|
+
* @desc 转码插件模式下的url
|
|
33
|
+
* @param url
|
|
34
|
+
* @param params
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
31
37
|
export declare function getLocalPlayPath(url: string, params?: string): string;
|
|
32
|
-
export declare function usePlugin(mode: PlayModeType): {
|
|
38
|
+
export declare function usePlugin(mode: PlayModeType, key: any): {
|
|
33
39
|
needInstall: boolean;
|
|
34
40
|
};
|
|
35
41
|
export declare function ExtModel({ url, children, mode, pluginDownloadUrl, pluginParams }: IPluginProps): JSX.Element;
|
package/es/PlayerExt/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _useMount from "ahooks/es/useMount";
|
|
2
|
-
|
|
3
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
2
|
|
|
5
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -12,7 +10,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
12
10
|
|
|
13
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
12
|
|
|
15
|
-
import React, { useMemo, useState } from 'react';
|
|
13
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
16
14
|
import IconFont from '../Player/iconfont';
|
|
17
15
|
import "./index.css";
|
|
18
16
|
/**
|
|
@@ -28,6 +26,13 @@ export var LOCAL_PORT = ['15080', '15081', '15082', '15083', '15084', '15085', '
|
|
|
28
26
|
export function getLocalPort() {
|
|
29
27
|
return LOCAL_PORT[Math.floor(Math.random() * LOCAL_PORT.length)];
|
|
30
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* @desc 转码插件模式下的url
|
|
31
|
+
* @param url
|
|
32
|
+
* @param params
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
|
|
31
36
|
export function getLocalPlayPath(url) {
|
|
32
37
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
33
38
|
var URL_TEMPLATE = "http://127.0.0.1:<port>/video/v1/transcoding?uri=<pull_uri>";
|
|
@@ -35,7 +40,7 @@ export function getLocalPlayPath(url) {
|
|
|
35
40
|
var pull_uri = window.btoa(url).replaceAll('=', '').replaceAll('/', '_').replaceAll('+', '-');
|
|
36
41
|
return URL_TEMPLATE.replace('<port>', port).replace('<pull_uri>', pull_uri) + params;
|
|
37
42
|
}
|
|
38
|
-
export function usePlugin(mode) {
|
|
43
|
+
export function usePlugin(mode, key) {
|
|
39
44
|
var _useState = useState({
|
|
40
45
|
installed: false
|
|
41
46
|
}),
|
|
@@ -43,27 +48,28 @@ export function usePlugin(mode) {
|
|
|
43
48
|
state = _useState2[0],
|
|
44
49
|
setState = _useState2[1];
|
|
45
50
|
|
|
46
|
-
|
|
51
|
+
useEffect(function () {
|
|
47
52
|
if (mode !== 2) {
|
|
48
53
|
return undefined;
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
var port = getLocalPort();
|
|
52
|
-
|
|
53
|
-
if (res.status === 200) {
|
|
54
|
-
setState({
|
|
55
|
-
installed: true
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}).catch(function (e) {
|
|
59
|
-
console.error('插件未安装');
|
|
60
|
-
});
|
|
61
|
-
});
|
|
57
|
+
var url = "http://127.0.0.1:".concat(port, "/video/v1/state");
|
|
62
58
|
|
|
59
|
+
var thenFn = function thenFn(res) {
|
|
60
|
+
return res.status === 200 ? setState({
|
|
61
|
+
installed: true
|
|
62
|
+
}) : undefined;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
fetch(url).then(thenFn).catch(function (e) {
|
|
66
|
+
return console.error('插件未安装', e);
|
|
67
|
+
});
|
|
68
|
+
}, [mode, key]);
|
|
63
69
|
return {
|
|
64
70
|
needInstall: useMemo(function () {
|
|
65
71
|
return mode === 2 && !state.installed;
|
|
66
|
-
}, [state.installed])
|
|
72
|
+
}, [state.installed, mode])
|
|
67
73
|
};
|
|
68
74
|
}
|
|
69
75
|
export function ExtModel(_ref) {
|
|
@@ -72,16 +78,24 @@ export function ExtModel(_ref) {
|
|
|
72
78
|
mode = _ref.mode,
|
|
73
79
|
pluginDownloadUrl = _ref.pluginDownloadUrl,
|
|
74
80
|
pluginParams = _ref.pluginParams;
|
|
81
|
+
|
|
82
|
+
var _useState3 = useState({
|
|
83
|
+
forceKey: Date.now()
|
|
84
|
+
}),
|
|
85
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
86
|
+
state = _useState4[0],
|
|
87
|
+
setState = _useState4[1];
|
|
88
|
+
|
|
75
89
|
var hasUrl = useMemo(function () {
|
|
76
90
|
return !!url;
|
|
77
91
|
}, [url]);
|
|
78
92
|
|
|
79
|
-
var _usePlugin = usePlugin(mode),
|
|
93
|
+
var _usePlugin = usePlugin(mode, state.forceKey),
|
|
80
94
|
needInstall = _usePlugin.needInstall;
|
|
81
95
|
|
|
82
96
|
var playUrl = useMemo(function () {
|
|
83
|
-
return
|
|
84
|
-
}, [url]);
|
|
97
|
+
return mode === 2 && url ? getLocalPlayPath(url, pluginParams) : url;
|
|
98
|
+
}, [url, mode]);
|
|
85
99
|
|
|
86
100
|
if (needInstall) {
|
|
87
101
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -93,7 +107,7 @@ export function ExtModel(_ref) {
|
|
|
93
107
|
}
|
|
94
108
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(IconFont, {
|
|
95
109
|
type: "lm-player-PlaySource"
|
|
96
|
-
})), /*#__PURE__*/React.createElement("div", null, "\u8BF7", /*#__PURE__*/React.createElement("a", {
|
|
110
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, "\u8BF7", /*#__PURE__*/React.createElement("a", {
|
|
97
111
|
target: "_blank",
|
|
98
112
|
href: pluginDownloadUrl,
|
|
99
113
|
style: {
|
|
@@ -102,7 +116,18 @@ export function ExtModel(_ref) {
|
|
|
102
116
|
},
|
|
103
117
|
download: "PlayerPlugin.exe",
|
|
104
118
|
rel: "noopener noreferrer"
|
|
105
|
-
}, "\u4E0B\u8F7D"), "\u64AD\u653E\u63D2\u4EF6")
|
|
119
|
+
}, "\u4E0B\u8F7D"), "\u64AD\u653E\u63D2\u4EF6\uFF0C"), /*#__PURE__*/React.createElement("span", null, "\u82E5\u5DF2\u5B89\u88C5\u8BF7\u70B9\u51FB", /*#__PURE__*/React.createElement("a", {
|
|
120
|
+
style: {
|
|
121
|
+
padding: '0 4px'
|
|
122
|
+
},
|
|
123
|
+
onClick: function onClick() {
|
|
124
|
+
return setState(function (old) {
|
|
125
|
+
return Object.assign(Object.assign({}, old), {
|
|
126
|
+
forceKey: Date.now()
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}, "\u91CD\u8BD5")))));
|
|
106
131
|
}
|
|
107
132
|
|
|
108
133
|
if (!hasUrl) {
|
|
@@ -1,3 +1,7 @@
|
|
|
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
|
+
|
|
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
|
+
|
|
1
5
|
/// <reference path="../../typings/global.d.ts"/>
|
|
2
6
|
import { __awaiter } from "tslib";
|
|
3
7
|
import { AxiosError } from 'axios';
|
|
@@ -46,9 +50,9 @@ function timeoutHandle(request, controller, config) {
|
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
function getResponse(request, config) {
|
|
49
|
-
return __awaiter(this, void 0, void 0, /*#__PURE__*/
|
|
53
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
50
54
|
var stageOne, response;
|
|
51
|
-
return
|
|
55
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
52
56
|
while (1) {
|
|
53
57
|
switch (_context.prev = _context.next) {
|
|
54
58
|
case 0:
|