@realsee/vreo 1.0.0-alpha.3 → 1.0.0-alpha.30
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/CHANGELOG.md +9 -1
- package/README.md +46 -36
- package/lib/PlayController/createHTMLAudioElement.js +6 -11
- package/lib/PlayController/index.js +16 -81
- package/lib/Player/App.js +0 -24
- package/lib/Player/Controller.d.ts +3 -3
- package/lib/Player/Controller.js +47 -105
- package/lib/Player/custom/SpatialScenePanel/index.js +42 -68
- package/lib/Player/hooks.js +0 -10
- package/lib/Player/index.js +40 -87
- package/lib/Player/modules/Drawer/index.js +0 -17
- package/lib/Player/modules/PopUp/index.js +0 -10
- package/lib/Player/modules/ResizeObserver/index.js +0 -8
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +2 -2
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +20 -114
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +2 -24
- package/lib/Player/modules/VideoAgent/index.js +1 -18
- package/lib/Player/modules/Wave/index.js +160 -36
- package/lib/Player/modules/keyframes/BgMusic/index.js +50 -51
- package/lib/Player/modules/keyframes/CameraMovement/index.js +3 -27
- package/lib/Player/modules/keyframes/InfoPanel/index.js +8 -25
- package/lib/Player/modules/keyframes/ModelVideo/index.js +3 -29
- package/lib/Player/modules/keyframes/PanoEffect/index.js +15 -43
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +0 -7
- package/lib/Player/modules/keyframes/PanoTag/index.js +7 -23
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +22 -47
- package/lib/Player/modules/keyframes/Prompter/index.js +10 -32
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +18 -25
- package/lib/Player/modules/keyframes/VideoEffect/index.js +12 -47
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +0 -2
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +0 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +0 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +19 -60
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +2 -5
- package/lib/fivePlugins/CameraMovementPlugin/index.js +28 -75
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +0 -4
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +11 -60
- package/lib/index.js +0 -1
- package/lib/react/index.js +7 -34
- package/lib/shared-utils/Audio.d.ts +14 -0
- package/lib/shared-utils/Audio.js +159 -0
- package/lib/shared-utils/{AduioLike.d.ts → AudioLike.d.ts} +0 -0
- package/lib/shared-utils/{AduioLike.js → AudioLike.js} +9 -45
- package/lib/shared-utils/Preloader.js +0 -7
- package/lib/shared-utils/addResizeListener.js +0 -5
- package/lib/shared-utils/animationFrame/BetterTween.js +2 -38
- package/lib/shared-utils/animationFrame/index.js +2 -10
- package/lib/shared-utils/animationFrame/tween.js +2 -15
- package/lib/shared-utils/createTransMatrix.js +2 -17
- package/lib/shared-utils/getFileExpandedName.js +0 -1
- package/lib/shared-utils/getMediaInfo.js +0 -9
- package/lib/shared-utils/setElementDataset.js +0 -2
- package/lib/typings/VreoUnit.d.ts +5 -5
- package/lib/typings/VreoUnit.js +0 -15
- package/package.json +2 -4
- package/stylesheets/default.css +11 -4
- package/docs/.nojekyll +0 -1
- package/docs/assets/custom.css +0 -78
- package/docs/assets/highlight.css +0 -127
- package/docs/assets/icons.css +0 -1043
- package/docs/assets/icons.png +0 -0
- package/docs/assets/icons@2x.png +0 -0
- package/docs/assets/main.js +0 -52
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1414
- package/docs/assets/widgets.png +0 -0
- package/docs/assets/widgets@2x.png +0 -0
- package/docs/classes/Player.AudioLike.html +0 -52
- package/docs/classes/Player.Controller.html +0 -54
- package/docs/classes/Player.Player-1.html +0 -50
- package/docs/classes/Player.VideoAgentMesh.html +0 -142
- package/docs/classes/Player.VideoAgentScene.html +0 -1
- package/docs/demo/assets/AppReact.39bef668.js +0 -1
- package/docs/demo/assets/default.9bbb3329.js +0 -3984
- package/docs/demo/assets/default.f3f3ca8c.css +0 -1
- package/docs/demo/assets/dynamic.5e9275ce.js +0 -1
- package/docs/demo/assets/examples.2ac45f33.js +0 -25
- package/docs/demo/assets/examples.dac4a6fe.css +0 -1
- package/docs/demo/assets/index.6699bd11.js +0 -1
- package/docs/demo/assets/index.9331038f.css +0 -1
- package/docs/demo/assets/main.a0741cbc.js +0 -1
- package/docs/demo/assets/react.2ee8565f.css +0 -1
- package/docs/demo/assets/react.a3f20ea9.js +0 -25
- package/docs/demo/assets/znRoyv06SZQeqA7m.0057e8ae.js +0 -1
- package/docs/demo/examples.html +0 -17
- package/docs/demo/index-react-dynamic.html +0 -20
- package/docs/demo/index-react.html +0 -20
- package/docs/demo/index.html +0 -19
- package/docs/enums/Player.InfoPanelStyleEnum.html +0 -1
- package/docs/enums/Player.InfoPanelTypeEnum.html +0 -3
- package/docs/enums/Player.PanoEffectEnum.html +0 -5
- package/docs/enums/Player.PanoTagEnum.html +0 -3
- package/docs/enums/Player.PanoTagStyleEnum.html +0 -7
- package/docs/enums/Player.VreoKeyframeEnum.html +0 -25
- package/docs/enums/fivePlugins.CameraMovementEffect.html +0 -1
- package/docs/enums/fivePlugins.Rotation.html +0 -1
- package/docs/index.html +0 -245
- package/docs/interfaces/Player.CustomVreoKeyframeProps.html +0 -1
- package/docs/interfaces/Player.PlayerConfigs.html +0 -7
- package/docs/interfaces/Player.Vertex.html +0 -3
- package/docs/interfaces/Player.VideoAgentMeshOptions.html +0 -8
- package/docs/interfaces/Player.VreoKeyframe.html +0 -3
- package/docs/interfaces/Player.VreoUnit.html +0 -3
- package/docs/interfaces/Player.VreoVideo.html +0 -3
- package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +0 -4
- package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +0 -1
- package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +0 -7
- package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +0 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +0 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +0 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +0 -1
- package/docs/interfaces/fivePlugins.Vector3Position.html +0 -3
- package/docs/interfaces/react.VreoActionCallbacks.html +0 -23
- package/docs/interfaces/react.VreoProviderProps.html +0 -1
- package/docs/modules/Player.html +0 -37
- package/docs/modules/custom.html +0 -3
- package/docs/modules/fivePlugins.html +0 -6
- package/docs/modules/react.html +0 -1
- package/docs/modules.html +0 -1
- package/resources/PlayController/createHTMLAudioElement.ts +0 -53
- package/resources/PlayController/index.ts +0 -154
- package/resources/Player/App.tsx +0 -66
- package/resources/Player/Controller.ts +0 -297
- package/resources/Player/custom/SpatialScenePanel/index.tsx +0 -264
- package/resources/Player/hooks.ts +0 -26
- package/resources/Player/index.tsx +0 -225
- package/resources/Player/modules/Drawer/index.tsx +0 -40
- package/resources/Player/modules/PopUp/index.tsx +0 -26
- package/resources/Player/modules/ResizeObserver/index.tsx +0 -23
- package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +0 -302
- package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +0 -56
- package/resources/Player/modules/VideoAgent/index.tsx +0 -53
- package/resources/Player/modules/Wave/index.tsx +0 -18
- package/resources/Player/modules/keyframes/BgMusic/index.tsx +0 -66
- package/resources/Player/modules/keyframes/CameraMovement/index.tsx +0 -37
- package/resources/Player/modules/keyframes/InfoPanel/index.tsx +0 -165
- package/resources/Player/modules/keyframes/ModelVideo/index.tsx +0 -77
- package/resources/Player/modules/keyframes/PanoEffect/index.tsx +0 -99
- package/resources/Player/modules/keyframes/PanoEffect/lineAnime.ts +0 -31
- package/resources/Player/modules/keyframes/PanoTag/index.tsx +0 -83
- package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +0 -117
- package/resources/Player/modules/keyframes/Prompter/index.tsx +0 -56
- package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +0 -99
- package/resources/Player/modules/keyframes/VideoEffect/index.tsx +0 -115
- package/resources/Player/typings.ts +0 -49
- package/resources/fivePlugins/CSS3DRenderPlugin/centerPoint.ts +0 -5
- package/resources/fivePlugins/CSS3DRenderPlugin/createResizeObserver.ts +0 -17
- package/resources/fivePlugins/CSS3DRenderPlugin/evenNumber.ts +0 -4
- package/resources/fivePlugins/CSS3DRenderPlugin/index.ts +0 -254
- package/resources/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.ts +0 -5
- package/resources/fivePlugins/CameraMovementPlugin/index.ts +0 -226
- package/resources/fivePlugins/CameraMovementPlugin/typings.ts +0 -59
- package/resources/fivePlugins/ModelTVVideoPlugin/index.ts +0 -278
- package/resources/index.ts +0 -1
- package/resources/react/index.tsx +0 -121
- package/resources/shared-utils/AduioLike.ts +0 -109
- package/resources/shared-utils/Preloader.ts +0 -35
- package/resources/shared-utils/addResizeListener.ts +0 -46
- package/resources/shared-utils/animationFrame/BetterTween.ts +0 -33
- package/resources/shared-utils/animationFrame/index.ts +0 -48
- package/resources/shared-utils/animationFrame/tween.ts +0 -51
- package/resources/shared-utils/createTransMatrix.ts +0 -12
- package/resources/shared-utils/getFileExpandedName.ts +0 -6
- package/resources/shared-utils/getMediaInfo.ts +0 -52
- package/resources/shared-utils/setElementDataset.ts +0 -18
- package/resources/typings/VreoUnit.ts +0 -314
|
@@ -1,68 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
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
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.VideoAgentMesh = void 0;
|
|
9
|
-
|
|
10
8
|
var THREE = _interopRequireWildcard(require("three"));
|
|
11
|
-
|
|
12
9
|
var _Preloader = require("../../../shared-utils/Preloader");
|
|
13
|
-
|
|
14
10
|
var _mobx = require("mobx");
|
|
15
|
-
|
|
16
|
-
var _AduioLike = _interopRequireDefault(require("../../../shared-utils/AduioLike"));
|
|
17
|
-
|
|
11
|
+
var _AudioLike = _interopRequireDefault(require("../../../shared-utils/AudioLike"));
|
|
18
12
|
var _getMediaInfo = require("../../../shared-utils/getMediaInfo");
|
|
19
|
-
|
|
20
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
-
|
|
22
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
-
|
|
24
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
16
|
+
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; }
|
|
26
17
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
27
|
-
|
|
28
18
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
29
|
-
|
|
30
19
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
31
|
-
|
|
32
20
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
33
|
-
|
|
34
21
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
35
|
-
|
|
36
22
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
37
|
-
|
|
38
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
39
|
-
|
|
23
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
40
24
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
41
|
-
|
|
42
25
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
43
|
-
|
|
44
26
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
45
|
-
|
|
46
27
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
47
|
-
|
|
48
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
49
|
-
|
|
28
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
50
29
|
var vertexShader = "\nvarying vec2 vUv;\nvarying vec2 vColorUv;\nvarying vec2 vMaskUv;\nvoid main(){\n vUv = uv;\n vColorUv = vec2(uv.x / 2.0, uv.y);\n vMaskUv = vec2(0.5 + uv.x / 2.0, uv.y);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n";
|
|
51
|
-
|
|
52
30
|
var fragmentShaderTpl = function fragmentShaderTpl() {
|
|
53
31
|
return "\nuniform int enable;\nuniform sampler2D map;\nvarying vec2 vUv;\nvarying vec2 vColorUv;\nvarying vec2 vMaskUv;\n\nvec3 hsv2rgb(vec3 c) {\n const vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n\nvec3 rgb2hsv(vec3 c) {\n const vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n\n float d = q.x - min(q.w, q.y);\n return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + 0.001)), d / (q.x + 0.001), q.x);\n}\n\nvoid main(void) {\n vec3 color = texture2D(map, vUv).xyz;\n float amask = 1.0;\n\n float ref = color.r;\n if (ref < color.b) ref = color.b;\n amask = color.g - ref + 0.1;\n amask = smoothstep(0.1, 0.3, amask);\n amask = 1.0 - amask;\n\n vec3 target = rgb2hsv(vec3(0.0 / 255.0, 255.0 / 255.0, 0.0 / 255.0));\n vec3 hsv = rgb2hsv(color);\n float distance = abs(hsv.x - target.x);\n if (distance < 0.15) {\n hsv.y = 0.0;\n }\n color = hsv2rgb(hsv);\n\n gl_FragColor = vec4(color.rgb, amask * float(enable));\n}\n";
|
|
54
32
|
};
|
|
55
|
-
|
|
56
33
|
var cacheInstance = {};
|
|
57
|
-
|
|
58
34
|
/**
|
|
59
35
|
* 视频经纪人MESH
|
|
60
36
|
*/
|
|
61
37
|
var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
62
38
|
_inherits(VideoAgentMesh, _THREE$Mesh);
|
|
63
|
-
|
|
64
39
|
var _super = _createSuper(VideoAgentMesh);
|
|
65
|
-
|
|
66
40
|
/**
|
|
67
41
|
*
|
|
68
42
|
* @param width
|
|
@@ -73,15 +47,11 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
|
73
47
|
*/
|
|
74
48
|
function VideoAgentMesh(width, height, widthSegments, heightSegments) {
|
|
75
49
|
var _this$options$videoIn, _this$options$videoIn2, _this$options$videoIn3;
|
|
76
|
-
|
|
77
50
|
var _this;
|
|
78
|
-
|
|
79
51
|
var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
|
|
80
52
|
preload: true
|
|
81
53
|
};
|
|
82
|
-
|
|
83
54
|
_classCallCheck(this, VideoAgentMesh);
|
|
84
|
-
|
|
85
55
|
if (!options.videoInstance) {
|
|
86
56
|
if (cacheInstance.videoInstance) {
|
|
87
57
|
options.videoInstance = cacheInstance.videoInstance;
|
|
@@ -97,7 +67,6 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
|
97
67
|
videoInstance.controls = false;
|
|
98
68
|
}
|
|
99
69
|
}
|
|
100
|
-
|
|
101
70
|
var geometry = new THREE.PlaneGeometry(width, height, widthSegments, heightSegments);
|
|
102
71
|
var videoTexture = new THREE.VideoTexture(options.videoInstance);
|
|
103
72
|
var material = new THREE.ShaderMaterial({
|
|
@@ -117,14 +86,13 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
|
117
86
|
_this.options = options;
|
|
118
87
|
_this.freeze = false;
|
|
119
88
|
_this.paused = true;
|
|
120
|
-
|
|
121
89
|
if (!options.audioInstance) {
|
|
122
90
|
if (cacheInstance.audioInstance) {
|
|
123
91
|
_this.audioInstance = cacheInstance.audioInstance;
|
|
124
92
|
} else {
|
|
125
93
|
var audioInstance = document.createElement('audio');
|
|
126
|
-
audioInstance.crossOrigin = '';
|
|
127
|
-
|
|
94
|
+
audioInstance.crossOrigin = '';
|
|
95
|
+
// videoInstance.muted = true
|
|
128
96
|
audioInstance.muted = false;
|
|
129
97
|
audioInstance.autoplay = false;
|
|
130
98
|
audioInstance.style.display = 'none';
|
|
@@ -135,74 +103,52 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
|
135
103
|
} else {
|
|
136
104
|
_this.audioInstance = options.audioInstance;
|
|
137
105
|
}
|
|
138
|
-
|
|
139
|
-
_this.audioLikeInstance = new _AduioLike["default"]();
|
|
106
|
+
_this.audioLikeInstance = new _AudioLike["default"]();
|
|
140
107
|
(0, _mobx.makeObservable)(_assertThisInitialized(_this), {
|
|
141
108
|
paused: _mobx.observable
|
|
142
109
|
});
|
|
143
|
-
|
|
144
110
|
var updatePaused = function updatePaused(paused) {
|
|
145
111
|
return (0, _mobx.runInAction)(function () {
|
|
146
112
|
return _this.paused = paused;
|
|
147
113
|
});
|
|
148
114
|
};
|
|
149
|
-
|
|
150
115
|
var onPause = function onPause() {
|
|
151
116
|
return updatePaused(true);
|
|
152
117
|
};
|
|
153
|
-
|
|
154
118
|
var onPlay = function onPlay() {
|
|
155
119
|
return updatePaused(false);
|
|
156
120
|
};
|
|
157
|
-
|
|
158
121
|
var onEnded = function onEnded() {
|
|
159
122
|
return console.log('vreo: video 播放结束');
|
|
160
123
|
};
|
|
161
|
-
|
|
162
124
|
_this.audioInstance.addEventListener('pause', onPause);
|
|
163
|
-
|
|
164
125
|
_this.audioInstance.addEventListener('play', onPlay);
|
|
165
|
-
|
|
166
126
|
(_this$options$videoIn = _this.options.videoInstance) === null || _this$options$videoIn === void 0 ? void 0 : _this$options$videoIn.addEventListener('pause', onPause);
|
|
167
127
|
(_this$options$videoIn2 = _this.options.videoInstance) === null || _this$options$videoIn2 === void 0 ? void 0 : _this$options$videoIn2.addEventListener('play', onPlay);
|
|
168
|
-
|
|
169
128
|
_this.audioLikeInstance.addEventListener('pause', onPause);
|
|
170
|
-
|
|
171
129
|
_this.audioLikeInstance.addEventListener('play', onPlay);
|
|
172
|
-
|
|
173
130
|
(_this$options$videoIn3 = _this.options.videoInstance) === null || _this$options$videoIn3 === void 0 ? void 0 : _this$options$videoIn3.addEventListener('ended', onEnded);
|
|
174
|
-
|
|
175
131
|
_this.$removeEventListener = function () {
|
|
176
132
|
var _this$options$videoIn4, _this$options$videoIn5, _this$options$videoIn6;
|
|
177
|
-
|
|
178
133
|
_this.audioInstance.removeEventListener('pause', onPause);
|
|
179
|
-
|
|
180
134
|
_this.audioInstance.removeEventListener('play', onPlay);
|
|
181
|
-
|
|
182
135
|
(_this$options$videoIn4 = _this.options.videoInstance) === null || _this$options$videoIn4 === void 0 ? void 0 : _this$options$videoIn4.removeEventListener('pause', onPause);
|
|
183
136
|
(_this$options$videoIn5 = _this.options.videoInstance) === null || _this$options$videoIn5 === void 0 ? void 0 : _this$options$videoIn5.removeEventListener('play', onPlay);
|
|
184
|
-
|
|
185
137
|
_this.audioLikeInstance.removeEventListener('pause', onPause);
|
|
186
|
-
|
|
187
138
|
_this.audioLikeInstance.removeEventListener('play', onPlay);
|
|
188
|
-
|
|
189
139
|
(_this$options$videoIn6 = _this.options.videoInstance) === null || _this$options$videoIn6 === void 0 ? void 0 : _this$options$videoIn6.removeEventListener('ended', onEnded);
|
|
190
140
|
};
|
|
191
|
-
|
|
192
141
|
return _this;
|
|
193
142
|
}
|
|
194
|
-
|
|
195
143
|
_createClass(VideoAgentMesh, [{
|
|
196
144
|
key: "mediaInstance",
|
|
197
145
|
get: function get() {
|
|
198
146
|
if (!this.videoUrl) {
|
|
199
147
|
return this.audioLikeInstance;
|
|
200
148
|
}
|
|
201
|
-
|
|
202
149
|
if ((0, _getMediaInfo.getMediaType)(this.videoUrl) === 'audio') {
|
|
203
150
|
return this.audioInstance;
|
|
204
151
|
}
|
|
205
|
-
|
|
206
152
|
var uniforms = this.material.uniforms;
|
|
207
153
|
var videoInstance = uniforms.map.value.image;
|
|
208
154
|
return videoInstance;
|
|
@@ -210,11 +156,10 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
|
210
156
|
}, {
|
|
211
157
|
key: "update",
|
|
212
158
|
value: function () {
|
|
213
|
-
var _update = _asyncToGenerator( /*#__PURE__*/
|
|
159
|
+
var _update = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(videoUrl) {
|
|
214
160
|
var _this2 = this;
|
|
215
|
-
|
|
216
161
|
var uniforms, onStart;
|
|
217
|
-
return
|
|
162
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
218
163
|
while (1) {
|
|
219
164
|
switch (_context.prev = _context.next) {
|
|
220
165
|
case 0:
|
|
@@ -222,11 +167,11 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
|
222
167
|
_context.next = 2;
|
|
223
168
|
break;
|
|
224
169
|
}
|
|
225
|
-
|
|
226
170
|
return _context.abrupt("return");
|
|
227
|
-
|
|
228
171
|
case 2:
|
|
229
|
-
this.videoUrl = videoUrl;
|
|
172
|
+
this.videoUrl = videoUrl;
|
|
173
|
+
|
|
174
|
+
// // 兼容非视频场景
|
|
230
175
|
// if (this.mediaInstance instanceof HTMLAudioElement) {
|
|
231
176
|
// this.mediaInstance.style.display = 'none'
|
|
232
177
|
// } else if (this.mediaInstance instanceof HTMLVideoElement) {
|
|
@@ -236,48 +181,37 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
|
236
181
|
this.freeze = true;
|
|
237
182
|
_context.next = 6;
|
|
238
183
|
return this.mediaInstance.pause();
|
|
239
|
-
|
|
240
184
|
case 6:
|
|
241
185
|
uniforms = this.material.uniforms;
|
|
242
186
|
this.mediaInstance.muted = true;
|
|
243
|
-
|
|
244
187
|
if (!(this.options.preload || this.options.preload === undefined || (0, _getMediaInfo.getMediaType)(this.videoUrl) === 'video')) {
|
|
245
188
|
_context.next = 18;
|
|
246
189
|
break;
|
|
247
190
|
}
|
|
248
|
-
|
|
249
191
|
_context.t1 = URL;
|
|
250
192
|
_context.next = 12;
|
|
251
193
|
return _Preloader.Preloader.blob(this.videoUrl);
|
|
252
|
-
|
|
253
194
|
case 12:
|
|
254
195
|
_context.t2 = _context.sent;
|
|
255
196
|
_context.next = 15;
|
|
256
197
|
return _context.t1.createObjectURL.call(_context.t1, _context.t2);
|
|
257
|
-
|
|
258
198
|
case 15:
|
|
259
199
|
_context.t0 = _context.sent;
|
|
260
200
|
_context.next = 19;
|
|
261
201
|
break;
|
|
262
|
-
|
|
263
202
|
case 18:
|
|
264
203
|
_context.t0 = this.videoUrl;
|
|
265
|
-
|
|
266
204
|
case 19:
|
|
267
205
|
this.mediaInstance.src = _context.t0;
|
|
268
206
|
this.mediaInstance.setAttribute('data-src', this.videoUrl);
|
|
269
|
-
|
|
270
207
|
onStart = function onStart() {
|
|
271
208
|
if (_this2.mediaInstance.currentTime === 0) return;
|
|
272
209
|
_this2.freeze = false;
|
|
273
210
|
_this2.mediaInstance.muted = false;
|
|
274
211
|
uniforms.enable.value = (0, _getMediaInfo.getMediaType)(_this2.videoUrl) ? 1 : 0;
|
|
275
|
-
|
|
276
212
|
_this2.mediaInstance.removeEventListener('timeupdate', onStart, false);
|
|
277
213
|
};
|
|
278
|
-
|
|
279
214
|
this.mediaInstance.addEventListener('timeupdate', onStart, false);
|
|
280
|
-
|
|
281
215
|
case 23:
|
|
282
216
|
case "end":
|
|
283
217
|
return _context.stop();
|
|
@@ -285,24 +219,21 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
|
285
219
|
}
|
|
286
220
|
}, _callee, this);
|
|
287
221
|
}));
|
|
288
|
-
|
|
289
222
|
function update(_x) {
|
|
290
223
|
return _update.apply(this, arguments);
|
|
291
224
|
}
|
|
292
|
-
|
|
293
225
|
return update;
|
|
294
226
|
}()
|
|
295
227
|
}, {
|
|
296
228
|
key: "play",
|
|
297
229
|
value: function () {
|
|
298
|
-
var _play = _asyncToGenerator( /*#__PURE__*/
|
|
230
|
+
var _play = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
299
231
|
var _this3 = this;
|
|
300
|
-
|
|
301
232
|
var videoUrl,
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
return
|
|
233
|
+
currentTime,
|
|
234
|
+
duration,
|
|
235
|
+
_args3 = arguments;
|
|
236
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
306
237
|
while (1) {
|
|
307
238
|
switch (_context3.prev = _context3.next) {
|
|
308
239
|
case 0:
|
|
@@ -310,78 +241,62 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
|
310
241
|
currentTime = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : 0;
|
|
311
242
|
duration = _args3.length > 2 ? _args3[2] : undefined;
|
|
312
243
|
videoUrl = videoUrl || '';
|
|
313
|
-
|
|
314
244
|
if (!(duration && !videoUrl)) {
|
|
315
245
|
_context3.next = 10;
|
|
316
246
|
break;
|
|
317
247
|
}
|
|
318
|
-
|
|
319
248
|
if (this.currentTime) {
|
|
320
249
|
this.mediaInstance.currentTime = currentTime;
|
|
321
250
|
}
|
|
322
|
-
|
|
323
251
|
this.mediaInstance.duration = duration;
|
|
324
252
|
this.videoUrl = '';
|
|
325
253
|
this.mediaInstance.play();
|
|
326
254
|
return _context3.abrupt("return", true);
|
|
327
|
-
|
|
328
255
|
case 10:
|
|
329
256
|
if (videoUrl) {
|
|
330
257
|
_context3.next = 18;
|
|
331
258
|
break;
|
|
332
259
|
}
|
|
333
|
-
|
|
334
260
|
if (!this.videoUrl) {
|
|
335
261
|
_context3.next = 16;
|
|
336
262
|
break;
|
|
337
263
|
}
|
|
338
|
-
|
|
339
264
|
_context3.next = 14;
|
|
340
265
|
return this.mediaInstance.play();
|
|
341
|
-
|
|
342
266
|
case 14:
|
|
343
267
|
_context3.next = 17;
|
|
344
268
|
break;
|
|
345
|
-
|
|
346
269
|
case 16:
|
|
347
270
|
console.warn('警告:视频资源未初始化。');
|
|
348
|
-
|
|
349
271
|
case 17:
|
|
350
272
|
return _context3.abrupt("return", true);
|
|
351
|
-
|
|
352
273
|
case 18:
|
|
353
274
|
if (!(videoUrl === this.videoUrl)) {
|
|
354
275
|
_context3.next = 23;
|
|
355
276
|
break;
|
|
356
277
|
}
|
|
357
|
-
|
|
358
278
|
this.mediaInstance.currentTime = currentTime;
|
|
359
279
|
_context3.next = 22;
|
|
360
280
|
return this.mediaInstance.play();
|
|
361
|
-
|
|
362
281
|
case 22:
|
|
363
282
|
return _context3.abrupt("return", true);
|
|
364
|
-
|
|
365
283
|
case 23:
|
|
366
284
|
_context3.next = 25;
|
|
367
285
|
return this.update(videoUrl);
|
|
368
|
-
|
|
369
286
|
case 25:
|
|
370
287
|
this.mediaInstance.pause();
|
|
371
288
|
_context3.next = 28;
|
|
372
289
|
return new Promise(function (resolve) {
|
|
373
|
-
return setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
374
|
-
return
|
|
290
|
+
return setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
291
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
375
292
|
while (1) {
|
|
376
293
|
switch (_context2.prev = _context2.next) {
|
|
377
294
|
case 0:
|
|
378
295
|
_this3.mediaInstance.currentTime = currentTime;
|
|
379
296
|
_context2.next = 3;
|
|
380
297
|
return _this3.mediaInstance.play();
|
|
381
|
-
|
|
382
298
|
case 3:
|
|
383
299
|
resolve(true);
|
|
384
|
-
|
|
385
300
|
case 4:
|
|
386
301
|
case "end":
|
|
387
302
|
return _context2.stop();
|
|
@@ -390,10 +305,8 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
|
390
305
|
}, _callee2);
|
|
391
306
|
})), 20);
|
|
392
307
|
});
|
|
393
|
-
|
|
394
308
|
case 28:
|
|
395
309
|
return _context3.abrupt("return", _context3.sent);
|
|
396
|
-
|
|
397
310
|
case 29:
|
|
398
311
|
case "end":
|
|
399
312
|
return _context3.stop();
|
|
@@ -401,17 +314,14 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
|
401
314
|
}
|
|
402
315
|
}, _callee3, this);
|
|
403
316
|
}));
|
|
404
|
-
|
|
405
317
|
function play() {
|
|
406
318
|
return _play.apply(this, arguments);
|
|
407
319
|
}
|
|
408
|
-
|
|
409
320
|
return play;
|
|
410
321
|
}()
|
|
411
322
|
/**
|
|
412
|
-
*
|
|
323
|
+
* 秒转成毫秒,保障精准度
|
|
413
324
|
*/
|
|
414
|
-
|
|
415
325
|
}, {
|
|
416
326
|
key: "currentTime",
|
|
417
327
|
get: function get() {
|
|
@@ -422,20 +332,16 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
|
422
332
|
value: function dispose() {
|
|
423
333
|
// 销毁事件监听
|
|
424
334
|
this.$removeEventListener();
|
|
425
|
-
|
|
426
335
|
if (cacheInstance.audioInstance) {
|
|
427
336
|
document.body.removeChild(cacheInstance.audioInstance);
|
|
428
337
|
cacheInstance.audioInstance = undefined;
|
|
429
338
|
}
|
|
430
|
-
|
|
431
339
|
if (cacheInstance.videoInstance) {
|
|
432
340
|
document.body.removeChild(cacheInstance.videoInstance);
|
|
433
341
|
cacheInstance.videoInstance = undefined;
|
|
434
342
|
}
|
|
435
343
|
}
|
|
436
344
|
}]);
|
|
437
|
-
|
|
438
345
|
return VideoAgentMesh;
|
|
439
346
|
}(THREE.Mesh);
|
|
440
|
-
|
|
441
347
|
exports.VideoAgentMesh = VideoAgentMesh;
|
|
@@ -1,65 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
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
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.VideoAgentScene = void 0;
|
|
9
|
-
|
|
10
8
|
var THREE = _interopRequireWildcard(require("three"));
|
|
11
|
-
|
|
12
9
|
var _addResizeListener = require("../../../shared-utils/addResizeListener");
|
|
13
|
-
|
|
14
10
|
var _VideoAgentMesh = require("./VideoAgentMesh");
|
|
15
|
-
|
|
16
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
|
|
18
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
20
13
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
21
|
-
|
|
22
14
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
23
|
-
|
|
24
15
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
|
-
|
|
26
16
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
|
-
|
|
28
17
|
var VideoAgentScene = /*#__PURE__*/_createClass(function VideoAgentScene(container, options) {
|
|
29
18
|
var _this = this;
|
|
30
|
-
|
|
31
19
|
_classCallCheck(this, VideoAgentScene);
|
|
32
|
-
|
|
33
20
|
_defineProperty(this, "scene", new THREE.Scene());
|
|
34
|
-
|
|
35
21
|
_defineProperty(this, "camera", new THREE.OrthographicCamera(-240, 240, 135, -135));
|
|
36
|
-
|
|
37
22
|
_defineProperty(this, "renderer", new THREE.WebGLRenderer({
|
|
38
23
|
alpha: true
|
|
39
24
|
}));
|
|
40
|
-
|
|
41
25
|
_defineProperty(this, "disposers", []);
|
|
42
|
-
|
|
43
26
|
_defineProperty(this, "run", function () {
|
|
44
27
|
// 视频开始 1s 不渲染:规避某些设备黑屏闪烁问题。视频前 2s 是最好是静默的。
|
|
45
28
|
if (!(_this.videoAgentMesh.paused || _this.videoAgentMesh.freeze) && _this.videoAgentMesh.currentTime > 1000) {
|
|
46
29
|
_this.renderer.render(_this.scene, _this.camera);
|
|
47
30
|
}
|
|
48
|
-
|
|
49
31
|
requestAnimationFrame(_this.run);
|
|
50
32
|
});
|
|
51
|
-
|
|
52
33
|
_defineProperty(this, "dispose", function () {
|
|
53
34
|
var _this$videoAgentMesh;
|
|
54
|
-
|
|
55
35
|
(_this$videoAgentMesh = _this.videoAgentMesh) === null || _this$videoAgentMesh === void 0 ? void 0 : _this$videoAgentMesh.dispose();
|
|
56
|
-
|
|
57
36
|
_this.disposers.forEach(function (disposer) {
|
|
58
37
|
return disposer === null || disposer === void 0 ? void 0 : disposer();
|
|
59
38
|
});
|
|
60
39
|
});
|
|
40
|
+
this.videoAgentMesh = new _VideoAgentMesh.VideoAgentMesh(480, 270, 1, 1, options);
|
|
61
41
|
|
|
62
|
-
|
|
42
|
+
// const needRender = getMediaType(this.videoAgentMesh.videoUrl) === 'video'
|
|
63
43
|
|
|
64
44
|
if (container) {
|
|
65
45
|
this.camera.position.set(0, 0, 10);
|
|
@@ -68,7 +48,6 @@ var VideoAgentScene = /*#__PURE__*/_createClass(function VideoAgentScene(contain
|
|
|
68
48
|
domElement.classList.add('VideoAgent-canvas');
|
|
69
49
|
var dispose = (0, _addResizeListener.addResizeListener)(container, function (width, height) {
|
|
70
50
|
_this.renderer.setSize(width * window.devicePixelRatio, height * window.devicePixelRatio);
|
|
71
|
-
|
|
72
51
|
domElement.style.width = "".concat(width, "px");
|
|
73
52
|
domElement.style.height = "".concat(height, "px");
|
|
74
53
|
});
|
|
@@ -78,5 +57,4 @@ var VideoAgentScene = /*#__PURE__*/_createClass(function VideoAgentScene(contain
|
|
|
78
57
|
this.run();
|
|
79
58
|
}
|
|
80
59
|
});
|
|
81
|
-
|
|
82
60
|
exports.VideoAgentScene = VideoAgentScene;
|
|
@@ -1,55 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
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
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.VideoAgent = VideoAgent;
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _hooks = require("../../hooks");
|
|
13
|
-
|
|
14
10
|
var _VideoAgentScene = require("./VideoAgentScene");
|
|
15
|
-
|
|
16
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
-
|
|
18
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
|
|
20
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
-
|
|
22
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
-
|
|
24
15
|
function VideoAgent(props) {
|
|
25
16
|
var _controller$avatar2;
|
|
26
|
-
|
|
27
17
|
var ref = React.useRef(null);
|
|
28
18
|
var controller = (0, _hooks.useController)();
|
|
29
19
|
var showAvatar = React.useMemo(function () {
|
|
30
20
|
var _controller$avatar;
|
|
31
|
-
|
|
32
21
|
return ((_controller$avatar = controller.avatar) === null || _controller$avatar === void 0 ? void 0 : _controller$avatar.url) && controller.avatar.force === true;
|
|
33
22
|
}, [controller.avatar]);
|
|
34
23
|
var showVideoAgent = React.useMemo(function () {
|
|
35
24
|
var _controller$videoAgen;
|
|
36
|
-
|
|
37
25
|
if (showAvatar) return false;
|
|
38
26
|
return ((_controller$videoAgen = controller.videoAgentScene) === null || _controller$videoAgen === void 0 ? void 0 : _controller$videoAgen.videoAgentMesh.mediaInstance) instanceof HTMLVideoElement;
|
|
39
|
-
}, [controller.videoAgentScene]);
|
|
27
|
+
}, [controller.videoAgentScene, showAvatar]);
|
|
40
28
|
React.useEffect(function () {
|
|
41
29
|
if (!ref.current) throw new Error('React 渲染异常,请稍后重试 ...');
|
|
42
|
-
|
|
43
30
|
if (controller.videoAgentScene) {
|
|
44
31
|
console.warn('VideoAgentScene" 重复初始化,已被过滤');
|
|
45
32
|
return;
|
|
46
33
|
}
|
|
47
|
-
|
|
48
34
|
var videoAgentScene = new _VideoAgentScene.VideoAgentScene(ref.current, props.options);
|
|
49
35
|
controller.videoAgentScene = videoAgentScene;
|
|
50
36
|
return function () {
|
|
51
37
|
var _controller$videoAgen2;
|
|
52
|
-
|
|
53
38
|
controller.dispose();
|
|
54
39
|
(_controller$videoAgen2 = controller.videoAgentScene) === null || _controller$videoAgen2 === void 0 ? void 0 : _controller$videoAgen2.dispose();
|
|
55
40
|
};
|
|
@@ -66,7 +51,6 @@ function VideoAgent(props) {
|
|
|
66
51
|
src: (_controller$avatar2 = controller.avatar) === null || _controller$avatar2 === void 0 ? void 0 : _controller$avatar2.url,
|
|
67
52
|
onClick: function onClick() {
|
|
68
53
|
var _props$onClick;
|
|
69
|
-
|
|
70
54
|
return (_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props);
|
|
71
55
|
}
|
|
72
56
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
@@ -84,7 +68,6 @@ function VideoAgent(props) {
|
|
|
84
68
|
className: "VideoAgent-play",
|
|
85
69
|
onClick: function onClick() {
|
|
86
70
|
var _props$onClick2;
|
|
87
|
-
|
|
88
71
|
return (_props$onClick2 = props.onClick) === null || _props$onClick2 === void 0 ? void 0 : _props$onClick2.call(props);
|
|
89
72
|
}
|
|
90
73
|
}))))));
|