@vtx/player 1.7.19 → 1.7.21
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/lib/api/fetch.js +5 -33
- package/lib/api/fetch.js.map +1 -1
- package/lib/api/index.js +5 -49
- package/lib/api/index.js.map +1 -1
- package/lib/api/types.js.map +1 -1
- package/lib/bd/PlayerManager.js +34 -67
- package/lib/bd/PlayerManager.js.map +1 -1
- package/lib/bill-player/index.js +64 -119
- package/lib/bill-player/index.js.map +1 -1
- package/lib/bill-player/style/css.js +0 -9
- package/lib/bill-player/style/css.js.map +1 -1
- package/lib/bill-player/style/index.js +0 -9
- package/lib/bill-player/style/index.js.map +1 -1
- package/lib/components/set-tag-video/index.js +4 -32
- package/lib/components/set-tag-video/index.js.map +1 -1
- package/lib/components/set-tag-video/style/css.js.map +1 -1
- package/lib/components/set-tag-video/style/index.js.map +1 -1
- package/lib/components/split-screen/index.js +3 -14
- package/lib/components/split-screen/index.js.map +1 -1
- package/lib/components/split-screen/style/css.js.map +1 -1
- package/lib/components/split-screen/style/index.js.map +1 -1
- package/lib/components/tag-video/index.js +10 -38
- package/lib/components/tag-video/index.js.map +1 -1
- package/lib/components/tag-video/style/css.js.map +1 -1
- package/lib/components/tag-video/style/index.js.map +1 -1
- package/lib/components/video-scale/index.js +2 -9
- package/lib/components/video-scale/index.js.map +1 -1
- package/lib/components/video-scale/style/css.js.map +1 -1
- package/lib/components/video-scale/style/index.js.map +1 -1
- package/lib/context/index.js +0 -4
- package/lib/context/index.js.map +1 -1
- package/lib/controls/index.js +34 -99
- package/lib/controls/index.js.map +1 -1
- package/lib/controls/style/css.js +0 -5
- package/lib/controls/style/css.js.map +1 -1
- package/lib/controls/style/index.js +0 -5
- package/lib/controls/style/index.js.map +1 -1
- package/lib/h264/PlayerManager.js +14 -26
- package/lib/h264/PlayerManager.js.map +1 -1
- package/lib/history-control/index.js +63 -122
- package/lib/history-control/index.js.map +1 -1
- package/lib/history-control/style/css.js +0 -6
- package/lib/history-control/style/css.js.map +1 -1
- package/lib/history-control/style/index.js +0 -6
- package/lib/history-control/style/index.js.map +1 -1
- package/lib/history-control-v2/components/grid-item/index.js +36 -75
- package/lib/history-control-v2/components/grid-item/index.js.map +1 -1
- package/lib/history-control-v2/components/panel/index.js +47 -117
- package/lib/history-control-v2/components/panel/index.js.map +1 -1
- package/lib/history-control-v2/context.js +0 -2
- package/lib/history-control-v2/context.js.map +1 -1
- package/lib/history-control-v2/index.js +46 -113
- package/lib/history-control-v2/index.js.map +1 -1
- package/lib/history-control-v2/style/css.js +0 -10
- package/lib/history-control-v2/style/css.js.map +1 -1
- package/lib/history-control-v2/style/index.js +0 -10
- package/lib/history-control-v2/style/index.js.map +1 -1
- package/lib/history-control-v2/utils.js +0 -20
- package/lib/history-control-v2/utils.js.map +1 -1
- package/lib/history-player/index.js +51 -109
- package/lib/history-player/index.js.map +1 -1
- package/lib/history-player/style/css.js +0 -3
- package/lib/history-player/style/css.js.map +1 -1
- package/lib/history-player/style/index.js +0 -3
- package/lib/history-player/style/index.js.map +1 -1
- package/lib/hooks/useSettings.js +1 -6
- package/lib/hooks/useSettings.js.map +1 -1
- package/lib/icc/PlayerManager.js +21 -58
- package/lib/icc/PlayerManager.js.map +1 -1
- package/lib/icc/api.js +2 -16
- package/lib/icc/api.js.map +1 -1
- package/lib/icons/index.js +23 -171
- package/lib/icons/index.js.map +1 -1
- package/lib/index.js +0 -10
- package/lib/index.js.map +1 -1
- package/lib/live-channel-player/index.js +16 -51
- package/lib/live-channel-player/index.js.map +1 -1
- package/lib/live-channel-player/style/css.js +0 -1
- package/lib/live-channel-player/style/css.js.map +1 -1
- package/lib/live-channel-player/style/index.js +0 -1
- package/lib/live-channel-player/style/index.js.map +1 -1
- package/lib/live-control/index.js +33 -84
- package/lib/live-control/index.js.map +1 -1
- package/lib/live-control/style/css.js +0 -4
- package/lib/live-control/style/css.js.map +1 -1
- package/lib/live-control/style/index.js +0 -4
- package/lib/live-control/style/index.js.map +1 -1
- package/lib/live-control-v2/index.js +68 -154
- package/lib/live-control-v2/index.js.map +1 -1
- package/lib/live-control-v2/style/css.js +0 -7
- package/lib/live-control-v2/style/css.js.map +1 -1
- package/lib/live-control-v2/style/index.js +0 -7
- package/lib/live-control-v2/style/index.js.map +1 -1
- package/lib/live-player/index.js +45 -85
- package/lib/live-player/index.js.map +1 -1
- package/lib/live-player/style/css.js +0 -2
- package/lib/live-player/style/css.js.map +1 -1
- package/lib/live-player/style/index.js +0 -2
- package/lib/live-player/style/index.js.map +1 -1
- package/lib/player/index.js +38 -206
- package/lib/player/index.js.map +1 -1
- package/lib/player/style/css.js.map +1 -1
- package/lib/player/style/index.js.map +1 -1
- package/lib/rsl/PlayerManager.js +14 -63
- package/lib/rsl/PlayerManager.js.map +1 -1
- package/lib/utils/index.d.ts +0 -7
- package/lib/utils/index.js +12 -112
- package/lib/utils/index.js.map +1 -1
- package/lib/vtxHls/PlayerManager.js +2 -19
- package/lib/vtxHls/PlayerManager.js.map +1 -1
- package/lib/vtxHls/WhepManager.js +4 -70
- package/lib/vtxHls/WhepManager.js.map +1 -1
- package/lib/webrtc/PlayerManager.js +24 -40
- package/lib/webrtc/PlayerManager.js.map +1 -1
- package/package.json +3 -2
package/lib/index.js
CHANGED
|
@@ -57,24 +57,14 @@ Object.defineProperty(exports, "Player", {
|
|
|
57
57
|
return _player["default"];
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
-
|
|
61
60
|
var _player = _interopRequireDefault(require("./player"));
|
|
62
|
-
|
|
63
61
|
var _livePlayer = _interopRequireDefault(require("./live-player"));
|
|
64
|
-
|
|
65
62
|
var _historyPlayer = _interopRequireDefault(require("./history-player"));
|
|
66
|
-
|
|
67
63
|
var _liveControl = _interopRequireDefault(require("./live-control"));
|
|
68
|
-
|
|
69
64
|
var _historyControl = _interopRequireDefault(require("./history-control"));
|
|
70
|
-
|
|
71
65
|
var _liveControlV = _interopRequireDefault(require("./live-control-v2"));
|
|
72
|
-
|
|
73
66
|
var _historyControlV = _interopRequireDefault(require("./history-control-v2"));
|
|
74
|
-
|
|
75
67
|
var _billPlayer = _interopRequireDefault(require("./bill-player"));
|
|
76
|
-
|
|
77
68
|
var _liveChannelPlayer = _interopRequireDefault(require("./live-channel-player"));
|
|
78
|
-
|
|
79
69
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
80
70
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["index.js"],"sourcesContent":["// import 'antd/dist/antd.css';\nexport { default as Player } from './player';\nexport { default as LivePlayer } from './live-player';\nexport { default as HistoryPlayer } from './history-player';\nexport { default as LiveControl } from './live-control';\nexport { default as HistoryControl } from './history-control';\nexport { default as LiveControlV2 } from './live-control-v2';\nexport { default as HistoryControlV2 } from './history-control-v2';\nexport { default as BillPlayer } from './bill-player';\nexport { default as LiveChannelPlayer } from './live-channel-player';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_player","_interopRequireDefault","require","_livePlayer","_historyPlayer","_liveControl","_historyControl","_liveControlV","_historyControlV","_billPlayer","_liveChannelPlayer","obj","__esModule"],"sources":["index.js"],"sourcesContent":["// import 'antd/dist/antd.css';\nexport { default as Player } from './player';\nexport { default as LivePlayer } from './live-player';\nexport { default as HistoryPlayer } from './history-player';\nexport { default as LiveControl } from './live-control';\nexport { default as HistoryControl } from './history-control';\nexport { default as LiveControlV2 } from './live-control-v2';\nexport { default as HistoryControlV2 } from './history-control-v2';\nexport { default as BillPlayer } from './bill-player';\nexport { default as LiveChannelPlayer } from './live-channel-player';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,cAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,YAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,aAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,gBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,WAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,kBAAA,GAAAT,sBAAA,CAAAC,OAAA;AAAqE,SAAAD,uBAAAU,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA","ignoreList":[]}
|
|
@@ -1,47 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
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); }
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports["default"] = exports.LiveChannelPlayer = void 0;
|
|
9
|
-
|
|
7
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
|
|
12
9
|
var _react = require("react");
|
|
13
|
-
|
|
14
10
|
var _api = require("../api");
|
|
15
|
-
|
|
16
11
|
var _livePlayer = _interopRequireDefault(require("../live-player"));
|
|
17
|
-
|
|
18
12
|
var _ahooks = require("ahooks");
|
|
19
|
-
|
|
20
|
-
var _utils = require("../utils");
|
|
21
|
-
|
|
13
|
+
var _utils = require("@vtx/utils");
|
|
22
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
-
|
|
24
|
-
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; }
|
|
25
|
-
|
|
26
15
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
-
|
|
28
16
|
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."); }
|
|
29
|
-
|
|
30
17
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
31
|
-
|
|
32
18
|
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; }
|
|
33
|
-
|
|
34
19
|
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; }
|
|
35
|
-
|
|
36
20
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
|
-
|
|
38
21
|
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
39
22
|
function adopt(value) {
|
|
40
23
|
return value instanceof P ? value : new P(function (resolve) {
|
|
41
24
|
resolve(value);
|
|
42
25
|
});
|
|
43
26
|
}
|
|
44
|
-
|
|
45
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
46
28
|
function fulfilled(value) {
|
|
47
29
|
try {
|
|
@@ -50,7 +32,6 @@ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P
|
|
|
50
32
|
reject(e);
|
|
51
33
|
}
|
|
52
34
|
}
|
|
53
|
-
|
|
54
35
|
function rejected(value) {
|
|
55
36
|
try {
|
|
56
37
|
step(generator["throw"](value));
|
|
@@ -58,15 +39,12 @@ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P
|
|
|
58
39
|
reject(e);
|
|
59
40
|
}
|
|
60
41
|
}
|
|
61
|
-
|
|
62
42
|
function step(result) {
|
|
63
43
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
64
44
|
}
|
|
65
|
-
|
|
66
45
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
67
46
|
});
|
|
68
47
|
};
|
|
69
|
-
|
|
70
48
|
/**
|
|
71
49
|
* 基于通道ID的实时播放器
|
|
72
50
|
* @param props
|
|
@@ -74,34 +52,29 @@ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P
|
|
|
74
52
|
*/
|
|
75
53
|
var LiveChannelPlayer = function LiveChannelPlayer(props) {
|
|
76
54
|
var channelId = props.channelId,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
55
|
+
width = props.width,
|
|
56
|
+
height = props.height;
|
|
80
57
|
var _useState = (0, _react.useState)(),
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
58
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
59
|
+
params = _useState2[0],
|
|
60
|
+
setParams = _useState2[1];
|
|
85
61
|
var _useRequest = (0, _ahooks.useRequest)(_api.loadVideoChannel, {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
62
|
+
manual: true
|
|
63
|
+
}),
|
|
64
|
+
getChannelInfo = _useRequest.runAsync;
|
|
90
65
|
var _useRequest2 = (0, _ahooks.useRequest)(_api.getPreviewUrl, {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
66
|
+
manual: true
|
|
67
|
+
}),
|
|
68
|
+
getVideoUrl = _useRequest2.runAsync;
|
|
95
69
|
var getVideoInfo = function getVideoInfo() {
|
|
96
|
-
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/
|
|
70
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
97
71
|
var channel, videoInfo;
|
|
98
|
-
return
|
|
72
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
99
73
|
while (1) {
|
|
100
74
|
switch (_context.prev = _context.next) {
|
|
101
75
|
case 0:
|
|
102
76
|
_context.next = 2;
|
|
103
77
|
return getChannelInfo(channelId);
|
|
104
|
-
|
|
105
78
|
case 2:
|
|
106
79
|
channel = _context.sent;
|
|
107
80
|
_context.next = 5;
|
|
@@ -109,11 +82,9 @@ var LiveChannelPlayer = function LiveChannelPlayer(props) {
|
|
|
109
82
|
channelNum: channel.channelNum,
|
|
110
83
|
deviceId: channel.videoDeviceId
|
|
111
84
|
});
|
|
112
|
-
|
|
113
85
|
case 5:
|
|
114
86
|
videoInfo = _context.sent;
|
|
115
87
|
setParams(videoInfo);
|
|
116
|
-
|
|
117
88
|
case 7:
|
|
118
89
|
case "end":
|
|
119
90
|
return _context.stop();
|
|
@@ -122,13 +93,10 @@ var LiveChannelPlayer = function LiveChannelPlayer(props) {
|
|
|
122
93
|
}, _callee);
|
|
123
94
|
}));
|
|
124
95
|
};
|
|
125
|
-
|
|
126
96
|
var getCloudParams = function getCloudParams() {
|
|
127
97
|
var ptzType = params === null || params === void 0 ? void 0 : params.ptzType;
|
|
128
|
-
|
|
129
98
|
if (ptzType) {
|
|
130
99
|
var type = 'none';
|
|
131
|
-
|
|
132
100
|
if (ptzType === 1) {
|
|
133
101
|
type = 'all';
|
|
134
102
|
} else if (ptzType === 2) {
|
|
@@ -136,18 +104,16 @@ var LiveChannelPlayer = function LiveChannelPlayer(props) {
|
|
|
136
104
|
} else if (ptzType === 3) {
|
|
137
105
|
type = 'onlyRotate';
|
|
138
106
|
}
|
|
139
|
-
|
|
140
107
|
return {
|
|
141
108
|
query: {
|
|
142
109
|
channelNum: params.channelNum,
|
|
143
110
|
deviceId: params.deviceId,
|
|
144
|
-
tenantId: (0, _utils.
|
|
111
|
+
tenantId: (0, _utils.getVtxToken)('tenantId')
|
|
145
112
|
},
|
|
146
113
|
type: type
|
|
147
114
|
};
|
|
148
115
|
}
|
|
149
116
|
};
|
|
150
|
-
|
|
151
117
|
(0, _react.useEffect)(function () {
|
|
152
118
|
if (channelId) getVideoInfo();
|
|
153
119
|
}, [channelId]);
|
|
@@ -161,7 +127,6 @@ var LiveChannelPlayer = function LiveChannelPlayer(props) {
|
|
|
161
127
|
cloudParams: getCloudParams()
|
|
162
128
|
});
|
|
163
129
|
};
|
|
164
|
-
|
|
165
130
|
exports.LiveChannelPlayer = LiveChannelPlayer;
|
|
166
131
|
var _default = LiveChannelPlayer;
|
|
167
132
|
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["__awaiter","thisArg","_arguments","P","generator","adopt","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jsxRuntime","require","_react","_api","_livePlayer","_interopRequireDefault","_ahooks","_utils","obj","__esModule","_slicedToArray","arr","i","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","o","minLen","_arrayLikeToArray","n","Object","prototype","toString","call","slice","constructor","name","Array","from","test","len","length","arr2","_i","Symbol","iterator","_arr","_n","_d","_s","_e","next","done","push","value","err","isArray","__awaiter","thisArg","_arguments","P","generator","adopt","resolve","Promise","reject","fulfilled","step","e","rejected","result","then","apply","LiveChannelPlayer","props","channelId","width","height","_useState","useState","_useState2","params","setParams","_useRequest","useRequest","loadVideoChannel","manual","getChannelInfo","runAsync","_useRequest2","getPreviewUrl","getVideoUrl","getVideoInfo","_regenerator","mark","_callee","channel","videoInfo","wrap","_callee$","_context","prev","sent","channelNum","deviceId","videoDeviceId","stop","getCloudParams","ptzType","type","query","tenantId","getVtxToken","useEffect","_jsx","LivePlayer","url","beenHasVideo","enableAgent","captureName","concat","deviceName","channelName","cloudParams","exports","_default"],"sources":["live-channel-player/index.js"],"sourcesContent":["var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useEffect, useState } from 'react';\nimport { getPreviewUrl, loadVideoChannel } from '../api';\nimport LivePlayer from '../live-player';\nimport { useRequest } from 'ahooks';\nimport { getVtxToken } from '@vtx/utils';\n/**\n * 基于通道ID的实时播放器\n * @param props\n * @returns\n */\nexport const LiveChannelPlayer = (props) => {\n const { channelId, width, height } = props;\n const [params, setParams] = useState();\n const { runAsync: getChannelInfo } = useRequest(loadVideoChannel, { manual: true });\n const { runAsync: getVideoUrl } = useRequest(getPreviewUrl, { manual: true });\n const getVideoInfo = () => __awaiter(void 0, void 0, void 0, function* () {\n const channel = yield getChannelInfo(channelId);\n const videoInfo = yield getVideoUrl({\n channelNum: channel.channelNum,\n deviceId: channel.videoDeviceId,\n });\n setParams(videoInfo);\n });\n const getCloudParams = () => {\n const ptzType = params === null || params === void 0 ? void 0 : params.ptzType;\n if (ptzType) {\n let type = 'none';\n if (ptzType === 1) {\n type = 'all';\n }\n else if (ptzType === 2) {\n type = 'onlyFocus';\n }\n else if (ptzType === 3) {\n type = 'onlyRotate';\n }\n return {\n query: {\n channelNum: params.channelNum,\n deviceId: params.deviceId,\n tenantId: getVtxToken('tenantId'),\n },\n type,\n };\n }\n };\n useEffect(() => {\n if (channelId)\n getVideoInfo();\n }, [channelId]);\n return (params && (_jsx(LivePlayer, { url: params.url, beenHasVideo: params.beenHasVideo, enableAgent: params.enableAgent || false, width: width, height: height, captureName: `${params.deviceName}-${params.channelName}`, cloudParams: getCloudParams() })));\n};\nexport default LiveChannelPlayer;\n"],"mappings":";;;;;;;AASA,IAAAA,WAAA,G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;MACvB;MACA,OAAO;QACHC,KAAK,EAAE;UACHP,UAAU,EAAEtB,MAAM,CAACsB,UAAU;UAC7BC,QAAQ,EAAEvB,MAAM,CAACuB,QAAQ;UACzBO,QAAQ,EAAE,IAAAC,kBAAW,EAAC,UAAU;QACpC,CAAC;QACDH,IAAI,EAAJA;MACJ,CAAC;IACL;EACJ,CAAC;EACD,IAAAI,gBAAS,EAAC,YAAM;IACZ,IAAItC,SAAS,EACTiB,YAAY,CAAC,CAAC;EACtB,CAAC,EAAE,CAACjB,SAAS,CAAC,CAAC;EACf,OAAQM,MAAM,IAAK,IAAAiC,eAAI,EAACC,sBAAU,EAAE;IAAEC,GAAG,EAAEnC,MAAM,CAACmC,GAAG;IAAEC,YAAY,EAAEpC,MAAM,CAACoC,YAAY;IAAEC,WAAW,EAAErC,MAAM,CAACqC,WAAW,IAAI,KAAK;IAAE1C,KAAK,EAAEA,KAAK;IAAEC,MAAM,EAAEA,MAAM;IAAE0C,WAAW,KAAAC,MAAA,CAAKvC,MAAM,CAACwC,UAAU,OAAAD,MAAA,CAAIvC,MAAM,CAACyC,WAAW,CAAE;IAAEC,WAAW,EAAEhB,cAAc,CAAC;EAAE,CAAC,CAAE;AAClQ,CAAC;AAACiB,OAAA,CAAAnD,iBAAA,GAAAA,iBAAA;AAAA,IAAAoD,QAAA,GACapD,iBAAiB;AAAAmD,OAAA,cAAAC,QAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.js","names":[],"sources":["live-channel-player/style/index.js"],"sourcesContent":["import '../../controls/style';\nimport '../../live-player/style';\n"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"css.js","names":["require"],"sources":["live-channel-player/style/index.js"],"sourcesContent":["import '../../controls/style';\nimport '../../live-player/style';\n"],"mappings":";;AAAAA,OAAA;AACAA,OAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["live-channel-player/style/index.js"],"sourcesContent":["import '../../controls/style';\nimport '../../live-player/style';\n"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","names":["require"],"sources":["live-channel-player/style/index.js"],"sourcesContent":["import '../../controls/style';\nimport '../../live-player/style';\n"],"mappings":";;AAAAA,OAAA;AACAA,OAAA","ignoreList":[]}
|
|
@@ -4,47 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
-
|
|
10
8
|
var _react = require("react");
|
|
11
|
-
|
|
12
9
|
var _api = require("../api");
|
|
13
|
-
|
|
14
10
|
var _controls = require("../controls");
|
|
15
|
-
|
|
16
11
|
var _icons = require("../icons");
|
|
17
|
-
|
|
18
12
|
var _livePlayer = _interopRequireDefault(require("../live-player"));
|
|
19
|
-
|
|
20
13
|
var _ahooks = require("ahooks");
|
|
21
|
-
|
|
22
14
|
var _space = _interopRequireDefault(require("antd/lib/space"));
|
|
23
|
-
|
|
24
15
|
var _tooltip = _interopRequireDefault(require("antd/lib/tooltip"));
|
|
25
|
-
|
|
26
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
|
-
|
|
28
17
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
29
|
-
|
|
30
18
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
31
|
-
|
|
32
19
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
33
|
-
|
|
34
20
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
35
|
-
|
|
36
21
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
37
|
-
|
|
38
22
|
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."); }
|
|
39
|
-
|
|
40
23
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
41
|
-
|
|
42
24
|
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; }
|
|
43
|
-
|
|
44
25
|
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; }
|
|
45
|
-
|
|
46
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
47
|
-
|
|
26
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // import { Space, Tooltip } from 'antd';
|
|
48
27
|
var DEFAULT_GRID = 2;
|
|
49
28
|
var DEFAULT_ACTIVE = 0;
|
|
50
29
|
var DEFAULT_CHANNELS = Array(9).fill({
|
|
@@ -53,43 +32,37 @@ var DEFAULT_CHANNELS = Array(9).fill({
|
|
|
53
32
|
/**
|
|
54
33
|
* 实时分屏组件
|
|
55
34
|
*/
|
|
56
|
-
|
|
57
35
|
var LiveControl = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
58
36
|
var _props$height = props.height,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
37
|
+
height = _props$height === void 0 ? '100%' : _props$height,
|
|
38
|
+
_props$width = props.width,
|
|
39
|
+
width = _props$width === void 0 ? '100%' : _props$width,
|
|
40
|
+
onExpandChange = props.onExpandChange,
|
|
41
|
+
onChannelChange = props.onChannelChange,
|
|
42
|
+
polling = props.polling,
|
|
43
|
+
_props$isDark = props.isDark,
|
|
44
|
+
isDark = _props$isDark === void 0 ? false : _props$isDark;
|
|
68
45
|
var _useSetState = (0, _ahooks.useSetState)({
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
46
|
+
expand: true,
|
|
47
|
+
grid: DEFAULT_GRID,
|
|
48
|
+
activeIndex: DEFAULT_ACTIVE,
|
|
49
|
+
channels: DEFAULT_CHANNELS
|
|
50
|
+
}),
|
|
51
|
+
_useSetState2 = _slicedToArray(_useSetState, 2),
|
|
52
|
+
state = _useSetState2[0],
|
|
53
|
+
setState = _useSetState2[1];
|
|
78
54
|
var wrapRef = (0, _react.useRef)(null);
|
|
79
|
-
|
|
80
55
|
var _useFullscreen = (0, _ahooks.useFullscreen)(wrapRef),
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
56
|
+
_useFullscreen2 = _slicedToArray(_useFullscreen, 2),
|
|
57
|
+
isFullscreen = _useFullscreen2[0],
|
|
58
|
+
toggleFullscreen = _useFullscreen2[1].toggleFullscreen;
|
|
59
|
+
var channelRef = (0, _react.useRef)(DEFAULT_CHANNELS);
|
|
60
|
+
// 实时视频轮询
|
|
87
61
|
(0, _ahooks.useInterval)(function () {
|
|
88
62
|
// 是否有视频正在播放
|
|
89
63
|
var hasVideo = state.channels.some(function (item) {
|
|
90
64
|
return item.channelNum;
|
|
91
65
|
});
|
|
92
|
-
|
|
93
66
|
if (polling && hasVideo) {
|
|
94
67
|
setState({
|
|
95
68
|
channels: DEFAULT_CHANNELS
|
|
@@ -108,7 +81,6 @@ var LiveControl = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
108
81
|
var index = state.channels.findIndex(function (c) {
|
|
109
82
|
return c.channelId && channel.channelId && c.channelNum === channel.channelNum;
|
|
110
83
|
});
|
|
111
|
-
|
|
112
84
|
if (~index) {
|
|
113
85
|
setState({
|
|
114
86
|
activeIndex: index
|
|
@@ -116,7 +88,6 @@ var LiveControl = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
116
88
|
} else {
|
|
117
89
|
// 播放该通道
|
|
118
90
|
var newChannels = _toConsumableArray(state.channels);
|
|
119
|
-
|
|
120
91
|
var activeIndex = getActiveIndex(newChannels, state.grid, state.activeIndex);
|
|
121
92
|
newChannels[activeIndex] = channel;
|
|
122
93
|
setState({
|
|
@@ -127,16 +98,14 @@ var LiveControl = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
127
98
|
},
|
|
128
99
|
multiLoad: function multiLoad(channels) {
|
|
129
100
|
var grid = 1;
|
|
130
|
-
if (channels.length > 1) grid = 2;
|
|
131
|
-
|
|
101
|
+
if (channels.length > 1) grid = 2;
|
|
102
|
+
// if (channels.length > 4) grid = 3;
|
|
132
103
|
var newChannels = [];
|
|
133
|
-
|
|
134
104
|
for (var i = 0; i < 9; i++) {
|
|
135
105
|
newChannels.push(channels[i] ? channels[i] : {
|
|
136
106
|
channelNum: ''
|
|
137
107
|
});
|
|
138
108
|
}
|
|
139
|
-
|
|
140
109
|
setState({
|
|
141
110
|
grid: grid,
|
|
142
111
|
channels: newChannels
|
|
@@ -146,11 +115,9 @@ var LiveControl = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
146
115
|
var index = state.channels.findIndex(function (c) {
|
|
147
116
|
return c.channelNum === channelNum;
|
|
148
117
|
});
|
|
149
|
-
|
|
150
118
|
if (~index) {
|
|
151
119
|
// 卸载通道
|
|
152
120
|
var newChannels = _toConsumableArray(state.channels);
|
|
153
|
-
|
|
154
121
|
newChannels[index] = {
|
|
155
122
|
channelNum: ''
|
|
156
123
|
};
|
|
@@ -163,7 +130,6 @@ var LiveControl = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
163
130
|
});
|
|
164
131
|
(0, _react.useEffect)(function () {
|
|
165
132
|
channelRef.current = state.channels;
|
|
166
|
-
|
|
167
133
|
if (onChannelChange) {
|
|
168
134
|
onChannelChange(state.channels.filter(function (c) {
|
|
169
135
|
return !!c.channelNum;
|
|
@@ -172,23 +138,19 @@ var LiveControl = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
172
138
|
}));
|
|
173
139
|
}
|
|
174
140
|
}, [state.channels]);
|
|
175
|
-
|
|
176
141
|
var handleCloseAll = function handleCloseAll() {
|
|
177
142
|
setState({
|
|
178
143
|
channels: DEFAULT_CHANNELS
|
|
179
144
|
});
|
|
180
145
|
};
|
|
181
|
-
|
|
182
146
|
var handleExpand = function handleExpand() {
|
|
183
147
|
onExpandChange && onExpandChange(!state.expand);
|
|
184
148
|
setState({
|
|
185
149
|
expand: !state.expand
|
|
186
150
|
});
|
|
187
151
|
};
|
|
188
|
-
|
|
189
152
|
var getGridItems = function getGridItems() {
|
|
190
153
|
var items = [];
|
|
191
|
-
|
|
192
154
|
var _loop = function _loop(i) {
|
|
193
155
|
var element = (0, _jsxRuntime.jsx)(GridItem, {
|
|
194
156
|
active: state.activeIndex === i,
|
|
@@ -200,7 +162,6 @@ var LiveControl = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
200
162
|
channel: state.channels[i],
|
|
201
163
|
onClose: function onClose() {
|
|
202
164
|
var newChannels = _toConsumableArray(state.channels);
|
|
203
|
-
|
|
204
165
|
newChannels[i] = {
|
|
205
166
|
channelNum: ''
|
|
206
167
|
};
|
|
@@ -211,14 +172,11 @@ var LiveControl = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
211
172
|
}, i);
|
|
212
173
|
items.push(element);
|
|
213
174
|
};
|
|
214
|
-
|
|
215
175
|
for (var i = 0; i < state.grid * state.grid; i++) {
|
|
216
176
|
_loop(i);
|
|
217
177
|
}
|
|
218
|
-
|
|
219
178
|
return items;
|
|
220
179
|
};
|
|
221
|
-
|
|
222
180
|
return (0, _jsxRuntime.jsxs)("div", Object.assign({
|
|
223
181
|
className: "vtx-live-control".concat(isDark ? ' live-dark' : ''),
|
|
224
182
|
ref: wrapRef,
|
|
@@ -319,22 +277,19 @@ var LiveControl = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
319
277
|
}));
|
|
320
278
|
});
|
|
321
279
|
LiveControl.displayName = 'LiveControl';
|
|
322
|
-
|
|
323
280
|
var GridItem = function GridItem(props) {
|
|
324
281
|
var active = props.active,
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
282
|
+
onClick = props.onClick,
|
|
283
|
+
channel = props.channel,
|
|
284
|
+
onClose = props.onClose;
|
|
328
285
|
var empty = !channel.channelNum;
|
|
329
|
-
|
|
330
286
|
var _useRequest = (0, _ahooks.useRequest)(function () {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
287
|
+
return (0, _api.getPreviewUrl)(channel);
|
|
288
|
+
}, {
|
|
289
|
+
ready: !!channel.channelNum,
|
|
290
|
+
refreshDeps: [channel.channelNum]
|
|
291
|
+
}),
|
|
292
|
+
data = _useRequest.data;
|
|
338
293
|
var name = "".concat(data === null || data === void 0 ? void 0 : data.deviceName, "-").concat(data === null || data === void 0 ? void 0 : data.channelName);
|
|
339
294
|
return (0, _jsxRuntime.jsx)("div", Object.assign({
|
|
340
295
|
className: "grid-item-container ".concat(active ? 'active' : ''),
|
|
@@ -367,22 +322,16 @@ var GridItem = function GridItem(props) {
|
|
|
367
322
|
* @param currentIndex 当前索引
|
|
368
323
|
* @returns
|
|
369
324
|
*/
|
|
370
|
-
|
|
371
|
-
|
|
372
325
|
var getActiveIndex = function getActiveIndex(channels, grid, currentIndex) {
|
|
373
326
|
var currentChannels = channels.slice(0, grid * grid);
|
|
374
|
-
|
|
375
327
|
for (var i = currentIndex + 1; i < currentChannels.length; i++) {
|
|
376
328
|
if (!currentChannels[i].channelNum) return i;
|
|
377
329
|
}
|
|
378
|
-
|
|
379
330
|
for (var _i2 = 0; _i2 < currentIndex; _i2++) {
|
|
380
331
|
if (!currentChannels[_i2].channelNum) return _i2;
|
|
381
332
|
}
|
|
382
|
-
|
|
383
333
|
return currentIndex;
|
|
384
334
|
};
|
|
385
|
-
|
|
386
335
|
var _default = LiveControl;
|
|
387
336
|
exports["default"] = _default;
|
|
388
337
|
//# sourceMappingURL=index.js.map
|