@realsee/vreo 1.1.0-dev.2 → 1.2.1-alpha.0

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.
Files changed (49) hide show
  1. package/lib/PlayController/createHTMLAudioElement.js +11 -6
  2. package/lib/PlayController/index.js +80 -15
  3. package/lib/Player/App.js +26 -1
  4. package/lib/Player/Controller.js +100 -23
  5. package/lib/Player/custom/SpatialScenePanel/index.js +68 -42
  6. package/lib/Player/hooks.js +10 -0
  7. package/lib/Player/index.js +86 -24
  8. package/lib/Player/modules/Drawer/index.js +17 -0
  9. package/lib/Player/modules/PopUp/index.js +10 -0
  10. package/lib/Player/modules/ResizeObserver/index.js +8 -0
  11. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +108 -17
  12. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +24 -2
  13. package/lib/Player/modules/VideoAgent/index.js +17 -0
  14. package/lib/Player/modules/Wave/index.js +32 -7
  15. package/lib/Player/modules/keyframes/BgMusic/index.js +23 -7
  16. package/lib/Player/modules/keyframes/CameraMovement/index.js +27 -3
  17. package/lib/Player/modules/keyframes/InfoPanel/index.d.ts +1 -0
  18. package/lib/Player/modules/keyframes/InfoPanel/index.js +55 -10
  19. package/lib/Player/modules/keyframes/ModelVideo/index.js +29 -3
  20. package/lib/Player/modules/keyframes/PanoEffect/index.js +43 -15
  21. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +7 -0
  22. package/lib/Player/modules/keyframes/PanoTag/index.js +26 -8
  23. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +47 -22
  24. package/lib/Player/modules/keyframes/Prompter/index.js +32 -10
  25. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +25 -18
  26. package/lib/Player/modules/keyframes/VideoEffect/index.js +47 -12
  27. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +2 -0
  28. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +1 -0
  29. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +1 -0
  30. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +60 -19
  31. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +5 -2
  32. package/lib/fivePlugins/CameraMovementPlugin/index.js +76 -28
  33. package/lib/fivePlugins/CameraMovementPlugin/typings.js +4 -0
  34. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +60 -11
  35. package/lib/index.js +1 -0
  36. package/lib/react/index.js +34 -7
  37. package/lib/shared-utils/Audio.js +69 -15
  38. package/lib/shared-utils/AudioLike.js +39 -5
  39. package/lib/shared-utils/Preloader.js +7 -0
  40. package/lib/shared-utils/addResizeListener.js +5 -0
  41. package/lib/shared-utils/animationFrame/BetterTween.js +38 -2
  42. package/lib/shared-utils/animationFrame/index.js +10 -2
  43. package/lib/shared-utils/animationFrame/tween.js +11 -2
  44. package/lib/shared-utils/createTransMatrix.js +17 -2
  45. package/lib/shared-utils/getFileExpandedName.js +1 -0
  46. package/lib/shared-utils/getMediaInfo.js +9 -0
  47. package/lib/shared-utils/setElementDataset.js +2 -0
  48. package/lib/typings/VreoUnit.js +15 -0
  49. package/package.json +1 -1
@@ -1,59 +1,81 @@
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
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.Prompter = Prompter;
9
+
8
10
  var React = _interopRequireWildcard(require("react"));
11
+
9
12
  var _classnames = _interopRequireDefault(require("classnames"));
13
+
10
14
  var _hooks = require("../../../hooks");
15
+
11
16
  var _VreoUnit = require("../../../../typings/VreoUnit");
17
+
12
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
+
13
20
  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
+
14
22
  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
+
15
24
  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; }
25
+
16
26
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
27
+
17
28
  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
+
18
30
  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
+
19
32
  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
+
20
34
  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
+
21
36
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
37
+
22
38
  function Prompter() {
23
39
  var _React$useState = React.useState(''),
24
- _React$useState2 = _slicedToArray(_React$useState, 2),
25
- text = _React$useState2[0],
26
- setText = _React$useState2[1];
40
+ _React$useState2 = _slicedToArray(_React$useState, 2),
41
+ text = _React$useState2[0],
42
+ setText = _React$useState2[1];
43
+
27
44
  var _React$useState3 = React.useState(true),
28
- _React$useState4 = _slicedToArray(_React$useState3, 2),
29
- hidden = _React$useState4[0],
30
- setHidden = _React$useState4[1];
45
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
46
+ hidden = _React$useState4[0],
47
+ setHidden = _React$useState4[1];
48
+
31
49
  var ref = React.useRef(null);
32
50
  var controller = (0, _hooks.useController)();
33
51
  React.useEffect(function () {
34
52
  var _controller$configs;
53
+
35
54
  if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.Prompter) === false) {
36
55
  return;
37
56
  }
57
+
38
58
  var callback = function callback(keyframe) {
39
59
  var start = keyframe.start,
40
- end = keyframe.end,
41
- data = keyframe.data;
60
+ end = keyframe.end,
61
+ data = keyframe.data;
42
62
  setText(data.text);
43
63
  setHidden(false);
64
+
44
65
  if (ref.current) {
45
66
  clearTimeout(ref.current);
46
67
  ref.current = null;
47
68
  }
69
+
48
70
  ref.current = setTimeout(function () {
49
71
  setHidden(true);
50
- setText('');
51
- // setTimeout(() => setText(''), 500)
72
+ setText(''); // setTimeout(() => setText(''), 500)
52
73
 
53
74
  if (ref.current) clearTimeout(ref.current);
54
75
  ref.current = null;
55
76
  }, end - start);
56
77
  };
78
+
57
79
  controller.on(_VreoUnit.VreoKeyframeEnum.Prompter, callback);
58
80
  return function () {
59
81
  controller.off(_VreoUnit.VreoKeyframeEnum.Prompter, callback);
@@ -1,33 +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
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.UpdateVRPanorama = UpdateVRPanorama;
9
+
8
10
  var React = _interopRequireWildcard(require("react"));
11
+
9
12
  var _five = require("@realsee/five");
13
+
10
14
  var _hooks = require("../../../hooks");
15
+
11
16
  var _VreoUnit = require("../../../../typings/VreoUnit");
17
+
12
18
  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); }
19
+
13
20
  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; }
21
+
14
22
  function UpdateVRPanorama() {
15
23
  var controller = (0, _hooks.useController)();
16
24
  var five = (0, _hooks.useFiveInstance)();
17
25
  var deafultWorkRef = React.useRef(null);
18
- var updateWorkRef = React.useRef(null);
26
+ var updateWorkRef = React.useRef(null); // 恢复默认 VR
19
27
 
20
- // 恢复默认 VR
21
28
  var restoreCallback = React.useCallback(function () {
22
29
  // 先清理掉 之前的 VR 数据备份
23
30
  updateWorkRef.current = null;
31
+
24
32
  if (deafultWorkRef.current) {
25
33
  var work = (0, _five.parseWork)(deafultWorkRef.current);
26
34
  five.load(work);
27
35
  }
28
- }, []);
36
+ }, []); // 暂停时: 恢复默认 VR
29
37
 
30
- // 暂停时: 恢复默认 VR
31
38
  var pausedCallback = React.useCallback(function () {
32
39
  if (deafultWorkRef.current) {
33
40
  var work = (0, _five.parseWork)(deafultWorkRef.current);
@@ -36,32 +43,33 @@ function UpdateVRPanorama() {
36
43
  });
37
44
  five.load(work);
38
45
  }
39
- }, []);
46
+ }, []); // 播放时:如果暂停前有更新 VR 需要还原
40
47
 
41
- // 播放时:如果暂停前有更新 VR 需要还原
42
48
  var playingCallback = React.useCallback(function () {
43
49
  if (!updateWorkRef.current) {
44
50
  return;
45
51
  }
52
+
46
53
  five.load(updateWorkRef.current);
47
54
  }, []);
48
55
  React.useEffect(function () {
49
56
  var callback = function callback(keyframe) {
50
57
  var _five$work;
58
+
51
59
  if (!deafultWorkRef.current) {
52
60
  deafultWorkRef.current = five.work.raw.works;
53
61
  }
54
- var data = keyframe.data;
55
62
 
56
- // 如果数据中有新 work 数据,则直接载入
63
+ var data = keyframe.data; // 如果数据中有新 work 数据,则直接载入
64
+
57
65
  if (data.work) {
58
66
  updateWorkRef.current = (0, _five.parseWork)(data.work);
59
67
  five.load(updateWorkRef.current);
60
68
  return;
61
69
  }
62
- var lastRawWork = (_five$work = five.work) === null || _five$work === void 0 ? void 0 : _five$work.raw.works[0];
63
70
 
64
- // 动态场景:不提供完成的签名数据,需重新整理
71
+ var lastRawWork = (_five$work = five.work) === null || _five$work === void 0 ? void 0 : _five$work.raw.works[0]; // 动态场景:不提供完成的签名数据,需重新整理
72
+
65
73
  if (data.dynamic_scene && !data.panorama) {
66
74
  var lastWork = JSON.parse(lastRawWork);
67
75
  var panorama = lastWork.panorama;
@@ -70,6 +78,7 @@ function UpdateVRPanorama() {
70
78
  data.panorama = panorama;
71
79
  delete data.dynamic_scene;
72
80
  }
81
+
73
82
  Object.assign(window, {
74
83
  $work1: JSON.parse(lastRawWork),
75
84
  $work2: data,
@@ -78,17 +87,15 @@ function UpdateVRPanorama() {
78
87
  updateWorkRef.current = (0, _five.parseWork)([lastRawWork, data]);
79
88
  five.load(updateWorkRef.current);
80
89
  };
81
- controller.on(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback);
82
90
 
83
- // 离开 将之前的内容清空
84
- controller.on(_VreoUnit.VreoKeyframeEnum.Exit, restoreCallback);
91
+ controller.on(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback); // 离开 将之前的内容清空
92
+
93
+ controller.on(_VreoUnit.VreoKeyframeEnum.Exit, restoreCallback); // 新载入数据 将之前的内容清空
94
+
95
+ controller.on('loaded', restoreCallback); // 暂停 回到默认状态
85
96
 
86
- // 新载入数据 将之前的内容清空
87
- controller.on('loaded', restoreCallback);
97
+ controller.on('paused', pausedCallback); // 播放 回归暂停前状态
88
98
 
89
- // 暂停 回到默认状态
90
- controller.on('paused', pausedCallback);
91
- // 播放 回归暂停前状态
92
99
  controller.on('playing', playingCallback);
93
100
  return function () {
94
101
  // 清理事件监听
@@ -1,60 +1,85 @@
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
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.VideoEffect = VideoEffect;
9
+
8
10
  var _classnames = _interopRequireDefault(require("classnames"));
11
+
9
12
  var React = _interopRequireWildcard(require("react"));
13
+
10
14
  var _VreoUnit = require("../../../../typings/VreoUnit");
15
+
11
16
  var _hooks = require("../../../hooks");
17
+
12
18
  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); }
19
+
13
20
  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; }
21
+
14
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
- 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; }
23
+
16
24
  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); } }
25
+
17
26
  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); }); }; }
27
+
18
28
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
29
+
19
30
  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."); }
31
+
20
32
  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); }
33
+
21
34
  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; }
35
+
22
36
  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; }
37
+
23
38
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
39
+
24
40
  var inlinePlay = function inlinePlay(videoInstance) {
25
41
  if (!videoInstance) return;
42
+
26
43
  var canplaythrough = function canplaythrough() {
27
44
  videoInstance.removeEventListener('canplaythrough', canplaythrough);
45
+
28
46
  try {
29
47
  videoInstance.play();
30
48
  } catch (error) {}
31
49
  };
50
+
32
51
  videoInstance.addEventListener('canplaythrough', canplaythrough);
33
52
  videoInstance.load();
34
- };
53
+ }; // const emptyVideo = '//vrlab-static.ljcdn.com/release/web/leisure.69fd3522.mov'
54
+
35
55
 
36
- // const emptyVideo = '//vrlab-static.ljcdn.com/release/web/leisure.69fd3522.mov'
37
56
  var PI = Math.PI;
38
57
  var PI_2 = PI * 2;
58
+
39
59
  function VideoEffect() {
40
60
  var ref = React.useRef(null);
41
61
  var videoRef = React.useRef();
42
62
  var controller = (0, _hooks.useController)();
43
63
  var timeoutRef = React.useRef();
64
+
44
65
  var _React$useState = React.useState(false),
45
- _React$useState2 = _slicedToArray(_React$useState, 2),
46
- visible = _React$useState2[0],
47
- setVisible = _React$useState2[1];
66
+ _React$useState2 = _slicedToArray(_React$useState, 2),
67
+ visible = _React$useState2[0],
68
+ setVisible = _React$useState2[1];
69
+
48
70
  var five = (0, _hooks.useFiveInstance)();
71
+
49
72
  var setBlobSrc = function setBlobSrc(blob) {
50
73
  if (!videoRef.current) return;
51
74
  videoRef.current.src = blob;
52
75
  };
76
+
53
77
  React.useEffect(function () {
54
78
  var callback = /*#__PURE__*/function () {
55
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(keyframe) {
79
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(keyframe) {
56
80
  var start, end, _ref2, videoSrc, fov, direction, panoIndex, vector, _ref3, _ref4, longitude, latitude;
57
- return _regeneratorRuntime().wrap(function _callee$(_context) {
81
+
82
+ return regeneratorRuntime.wrap(function _callee$(_context) {
58
83
  while (1) {
59
84
  switch (_context.prev = _context.next) {
60
85
  case 0:
@@ -64,9 +89,11 @@ function VideoEffect() {
64
89
  if (vector) {
65
90
  return [vector.longitude, vector.latitude];
66
91
  }
92
+
67
93
  if (!direction) {
68
94
  return [0, 0];
69
95
  }
96
+
70
97
  var longitude = -Math.atan2(direction.x, -direction.z);
71
98
  longitude = (longitude % PI_2 + PI_2) % PI_2;
72
99
  var latitude = -Math.asin(direction.y / 1);
@@ -83,13 +110,17 @@ function VideoEffect() {
83
110
  setVisible(true);
84
111
  timeoutRef.current = setTimeout(function () {
85
112
  var _videoRef$current;
113
+
86
114
  if (!((_videoRef$current = videoRef.current) !== null && _videoRef$current !== void 0 && _videoRef$current.paused)) {
87
115
  var _videoRef$current2;
116
+
88
117
  (_videoRef$current2 = videoRef.current) === null || _videoRef$current2 === void 0 ? void 0 : _videoRef$current2.pause();
89
118
  }
119
+
90
120
  setVisible(false);
91
121
  setBlobSrc('');
92
122
  }, end - start);
123
+
93
124
  case 8:
94
125
  case "end":
95
126
  return _context.stop();
@@ -97,13 +128,16 @@ function VideoEffect() {
97
128
  }
98
129
  }, _callee);
99
130
  }));
131
+
100
132
  return function callback(_x) {
101
133
  return _ref.apply(this, arguments);
102
134
  };
103
135
  }();
136
+
104
137
  controller.on(_VreoUnit.VreoKeyframeEnum.VideoEffect, callback);
105
138
  return function () {
106
139
  controller.off(_VreoUnit.VreoKeyframeEnum.VideoEffect, callback);
140
+
107
141
  if (timeoutRef.current) {
108
142
  clearTimeout(timeoutRef.current);
109
143
  }
@@ -111,9 +145,10 @@ function VideoEffect() {
111
145
  }, [controller]);
112
146
  React.useEffect(function () {
113
147
  var _controller$configs, _controller$configs$v;
148
+
114
149
  if (!ref.current) return;
115
- var video = ((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : (_controller$configs$v = _controller$configs.videos) === null || _controller$configs$v === void 0 ? void 0 : _controller$configs$v.videoEffect) || document.createElement('video');
116
- // <video playsInline key="VideoEffect-video" className="VideoEffect-video" src={blobSrc} />
150
+ var video = ((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : (_controller$configs$v = _controller$configs.videos) === null || _controller$configs$v === void 0 ? void 0 : _controller$configs$v.videoEffect) || document.createElement('video'); // <video playsInline key="VideoEffect-video" className="VideoEffect-video" src={blobSrc} />
151
+
117
152
  video.setAttribute('playsinline', 'true');
118
153
  video.setAttribute('webkit-playsinline', 'true');
119
154
  video.setAttribute('autoplay', 'true');
@@ -123,10 +158,10 @@ function VideoEffect() {
123
158
  ref.current.append(videoRef.current);
124
159
  document.addEventListener('WeixinJSBridgeReady', function () {
125
160
  var _videoRef$current3;
161
+
126
162
  (_videoRef$current3 = videoRef.current) === null || _videoRef$current3 === void 0 ? void 0 : _videoRef$current3.play();
127
163
  }, false);
128
- if (!ref.current) return;
129
- // const asyncfunc = async () => {
164
+ if (!ref.current) return; // const asyncfunc = async () => {
130
165
  // setBlobSrc(await URL.createObjectURL(await Preloader.blob(emptyVideo)))
131
166
  // inlinePlay(videoRef.current)
132
167
  // }
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = centerPoint;
7
+
7
8
  var _three = require("three");
9
+
8
10
  function centerPoint(point1, point2) {
9
11
  return new _three.Vector3((point1.x + point2.x) / 2, (point1.y + point2.y) / 2, (point1.z + point2.z) / 2);
10
12
  }
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = createResizeObserver;
7
+
7
8
  /**
8
9
  * @description: 简陋的 ResizeObserver polyfill
9
10
  */
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = evenNumber;
7
+
7
8
  function evenNumber(num, config) {
8
9
  var roundNum = Math.round(num);
9
10
  return roundNum % 2 === 0 ? roundNum : roundNum + Number(config !== null && config !== void 0 && config.smaller ? -1 : 1);