@realsee/vreo 1.0.0-alpha.1 → 1.0.0-alpha.11

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 (115) hide show
  1. package/docs/assets/search.js +1 -1
  2. package/docs/classes/Player.AudioLike.html +6 -6
  3. package/docs/classes/Player.Controller.html +12 -12
  4. package/docs/classes/Player.Player-1.html +11 -11
  5. package/docs/classes/Player.VideoAgentMesh.html +12 -12
  6. package/docs/classes/Player.VideoAgentScene.html +1 -1
  7. package/docs/demo/assets/{AppReact.d0ee843a.js → AppReact.e6e509fc.js} +1 -1
  8. package/docs/demo/assets/default.bc4c715d.css +1 -0
  9. package/docs/demo/assets/default.e9102488.js +3988 -0
  10. package/docs/demo/assets/{dynamic.76506c2c.js → dynamic.0dd42f6c.js} +1 -1
  11. package/docs/demo/assets/{examples.3d8323db.js → examples.e70954e5.js} +1 -1
  12. package/docs/demo/assets/{index.7e31122c.js → index.62e9f091.js} +1 -1
  13. package/docs/demo/assets/{main.79b11b9d.js → main.c6fa1444.js} +1 -1
  14. package/docs/demo/assets/{react.c1c07c14.js → react.89edd358.js} +1 -1
  15. package/docs/demo/examples.html +3 -3
  16. package/docs/demo/index-react-dynamic.html +5 -5
  17. package/docs/demo/index-react.html +5 -5
  18. package/docs/demo/index.html +4 -4
  19. package/docs/enums/Player.InfoPanelStyleEnum.html +1 -1
  20. package/docs/enums/Player.InfoPanelTypeEnum.html +1 -1
  21. package/docs/enums/Player.PanoEffectEnum.html +1 -1
  22. package/docs/enums/Player.PanoTagEnum.html +1 -1
  23. package/docs/enums/Player.PanoTagStyleEnum.html +2 -2
  24. package/docs/enums/Player.VreoKeyframeEnum.html +12 -12
  25. package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -1
  26. package/docs/enums/fivePlugins.Rotation.html +1 -1
  27. package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -1
  28. package/docs/interfaces/Player.PlayerConfigs.html +4 -3
  29. package/docs/interfaces/Player.Vertex.html +1 -1
  30. package/docs/interfaces/Player.VideoAgentMeshOptions.html +3 -3
  31. package/docs/interfaces/Player.VreoKeyframe.html +1 -1
  32. package/docs/interfaces/Player.VreoUnit.html +1 -1
  33. package/docs/interfaces/Player.VreoVideo.html +1 -1
  34. package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +2 -2
  35. package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +1 -1
  36. package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +2 -2
  37. package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +1 -1
  38. package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +1 -1
  39. package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +1 -1
  40. package/docs/interfaces/fivePlugins.Vector3Position.html +1 -1
  41. package/docs/interfaces/react.VreoActionCallbacks.html +6 -6
  42. package/docs/interfaces/react.VreoProviderProps.html +1 -1
  43. package/docs/modules/Player.html +16 -16
  44. package/docs/modules/custom.html +1 -1
  45. package/docs/modules/fivePlugins.html +3 -3
  46. package/docs/modules/react.html +1 -1
  47. package/lib/PlayController/createHTMLAudioElement.js +6 -11
  48. package/lib/PlayController/index.js +16 -82
  49. package/lib/Player/App.js +6 -28
  50. package/lib/Player/Controller.d.ts +27 -8
  51. package/lib/Player/Controller.js +163 -84
  52. package/lib/Player/custom/SpatialScenePanel/index.js +44 -69
  53. package/lib/Player/hooks.js +2 -12
  54. package/lib/Player/index.d.ts +2 -1
  55. package/lib/Player/index.js +63 -108
  56. package/lib/Player/modules/Drawer/index.js +0 -17
  57. package/lib/Player/modules/PopUp/index.js +0 -10
  58. package/lib/Player/modules/ResizeObserver/index.d.ts +2 -0
  59. package/lib/Player/modules/ResizeObserver/index.js +29 -0
  60. package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +1 -1
  61. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +58 -151
  62. package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +3 -7
  63. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +21 -52
  64. package/lib/Player/modules/VideoAgent/index.js +45 -21
  65. package/lib/Player/modules/Wave/index.d.ts +5 -0
  66. package/lib/Player/modules/Wave/index.js +158 -0
  67. package/lib/Player/modules/keyframes/BgMusic/index.js +2 -15
  68. package/lib/Player/modules/keyframes/CameraMovement/index.js +3 -27
  69. package/lib/Player/modules/keyframes/InfoPanel/index.js +28 -33
  70. package/lib/Player/modules/keyframes/ModelVideo/index.js +3 -29
  71. package/lib/Player/modules/keyframes/PanoEffect/index.js +15 -43
  72. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +0 -7
  73. package/lib/Player/modules/keyframes/PanoTag/index.d.ts +1 -2
  74. package/lib/Player/modules/keyframes/PanoTag/index.js +74 -144
  75. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +22 -48
  76. package/lib/Player/modules/keyframes/Prompter/index.js +14 -35
  77. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +18 -25
  78. package/lib/Player/modules/keyframes/VideoEffect/index.js +12 -47
  79. package/lib/Player/typings.d.ts +9 -2
  80. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +0 -2
  81. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +0 -1
  82. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +0 -1
  83. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +19 -60
  84. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +2 -5
  85. package/lib/fivePlugins/CameraMovementPlugin/index.js +30 -80
  86. package/lib/fivePlugins/CameraMovementPlugin/typings.js +0 -4
  87. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +11 -60
  88. package/lib/index.js +0 -1
  89. package/lib/react/index.d.ts +2 -2
  90. package/lib/react/index.js +7 -34
  91. package/lib/shared-utils/AduioLike.js +12 -45
  92. package/lib/shared-utils/Preloader.js +0 -7
  93. package/lib/shared-utils/addResizeListener.d.ts +4 -0
  94. package/lib/shared-utils/addResizeListener.js +46 -0
  95. package/lib/shared-utils/animationFrame/BetterTween.js +2 -38
  96. package/lib/shared-utils/animationFrame/index.js +2 -10
  97. package/lib/shared-utils/animationFrame/tween.js +2 -15
  98. package/lib/shared-utils/createTransMatrix.js +2 -17
  99. package/lib/shared-utils/getFileExpandedName.d.ts +1 -0
  100. package/lib/shared-utils/getFileExpandedName.js +12 -0
  101. package/lib/shared-utils/getMediaInfo.d.ts +9 -0
  102. package/lib/shared-utils/getMediaInfo.js +66 -0
  103. package/lib/shared-utils/setElementDataset.d.ts +1 -0
  104. package/lib/shared-utils/setElementDataset.js +22 -0
  105. package/lib/typings/VreoUnit.d.ts +4 -0
  106. package/lib/typings/VreoUnit.js +0 -15
  107. package/package.json +2 -2
  108. package/resources/Player/Controller.ts +4 -7
  109. package/resources/Player/index.tsx +2 -0
  110. package/resources/Player/modules/Wave/index.tsx +133 -12
  111. package/resources/Player/modules/keyframes/PanoTag/index.tsx +1 -2
  112. package/resources/typings/VreoUnit.ts +1 -1
  113. package/stylesheets/default.css +4 -2
  114. package/docs/demo/assets/default.63925584.js +0 -3984
  115. package/docs/demo/assets/default.f3f3ca8c.css +0 -1
@@ -1,42 +1,25 @@
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.PanoTextLabel = PanoTextLabel;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var THREE = _interopRequireWildcard(require("three"));
13
-
14
10
  var _reactDom = _interopRequireDefault(require("react-dom"));
15
-
16
11
  var _hooks = require("../../../hooks");
17
-
18
12
  var _CSS3DRenderPlugin = require("../../../../fivePlugins/CSS3DRenderPlugin");
19
-
20
13
  var _VreoUnit = require("../../../../typings/VreoUnit");
21
-
22
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
23
-
24
15
  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); }
25
-
26
16
  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; }
27
-
28
17
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
29
-
30
18
  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
-
32
19
  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
-
34
20
  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
-
36
21
  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
-
38
22
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
39
-
40
23
  /**
41
24
  * 通过传入中心点确定矩形框架容器的四个点:
42
25
  * 1. 已知矩形长宽和中心点
@@ -48,19 +31,17 @@ var calcPoints = function calcPoints(centerPoint, normal, wrapperLength, wrapper
48
31
  var length = wrapperLength / 375;
49
32
  var width = wrapperWidth / 375;
50
33
  var geometry = new THREE.PlaneGeometry(length, width);
51
-
52
34
  if (normal) {
53
35
  var lookPoint = new THREE.Vector3(normal.x + centerPoint.x, normal.y + centerPoint.y, normal.z + centerPoint.z);
54
36
  geometry.lookAt(lookPoint);
55
- } // const pointgeometry = new THREE.Geometry()
37
+ }
38
+ // const pointgeometry = new THREE.Geometry()
56
39
  // pointgeometry.vertices.push(cameraPosition)
57
40
  // const pointmaterial = new THREE.PointsMaterial({
58
41
  // color: 0xffffff,
59
42
  // size: 0.4,
60
43
  // })
61
44
  // _point = new THREE.Points(pointgeometry, pointmaterial)
62
- // console.log(cameraPosition)
63
-
64
45
 
65
46
  var material = new THREE.MeshBasicMaterial({
66
47
  color: 0xffff00,
@@ -68,26 +49,26 @@ var calcPoints = function calcPoints(centerPoint, normal, wrapperLength, wrapper
68
49
  });
69
50
  var plane = new THREE.Mesh(geometry, material);
70
51
  var v0 = centerPoint.clone();
71
- plane.position.copy(v0); // 计算传入的四个点的坐标
52
+ plane.position.copy(v0);
72
53
 
54
+ // 计算传入的四个点的坐标
73
55
  var _plane$geometry$verti = _slicedToArray(plane.geometry.vertices, 4),
74
- v1 = _plane$geometry$verti[0],
75
- v2 = _plane$geometry$verti[1],
76
- v3 = _plane$geometry$verti[2],
77
- v4 = _plane$geometry$verti[3];
78
-
56
+ v1 = _plane$geometry$verti[0],
57
+ v2 = _plane$geometry$verti[1],
58
+ v3 = _plane$geometry$verti[2],
59
+ v4 = _plane$geometry$verti[3];
79
60
  var downLeft = v0.clone().add(v4);
80
61
  var downRight = v0.clone().add(v3);
81
62
  var upLeft = v0.clone().add(v2);
82
- var upRight = v0.clone().add(v1); // 插件使用要求:矩形四个点位数据,顺序为**必须**为左下、右下、右上、左上
63
+ var upRight = v0.clone().add(v1);
83
64
 
65
+ // 插件使用要求:矩形四个点位数据,顺序为**必须**为左下、右下、右上、左上
84
66
  return [downLeft, downRight, upRight, upLeft];
85
67
  };
68
+
86
69
  /**
87
70
  * 空间文本标签。
88
71
  */
89
-
90
-
91
72
  function PanoTextLabel() {
92
73
  var timeoutRef = React.useRef();
93
74
  var controller = (0, _hooks.useController)();
@@ -95,39 +76,35 @@ function PanoTextLabel() {
95
76
  var ref = React.useRef();
96
77
  React.useEffect(function () {
97
78
  var _controller$configs;
98
-
99
79
  if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.PanoTextLabel) === false) {
100
80
  return;
101
81
  }
102
-
103
82
  var callback = function callback(keyframe) {
104
83
  var _panoTextLabelData$no, _panoTextLabelData$no2, _panoTextLabelData$no3;
105
-
106
84
  var start = keyframe.start,
107
- end = keyframe.end,
108
- data = keyframe.data;
109
- var panoTextLabelData = data; // 增加无文本情况的判断
110
-
85
+ end = keyframe.end,
86
+ data = keyframe.data;
87
+ var panoTextLabelData = data;
88
+ // 增加无文本情况的判断
111
89
  if (data.text === '') return;
112
90
  var _panoTextLabelData$ve = panoTextLabelData.vertex,
113
- x = _panoTextLabelData$ve.x,
114
- y = _panoTextLabelData$ve.y,
115
- z = _panoTextLabelData$ve.z;
91
+ x = _panoTextLabelData$ve.x,
92
+ y = _panoTextLabelData$ve.y,
93
+ z = _panoTextLabelData$ve.z;
116
94
  var centerPoint = new THREE.Vector3(x, y, z);
117
- var normal = new THREE.Vector3((_panoTextLabelData$no = panoTextLabelData.normal) === null || _panoTextLabelData$no === void 0 ? void 0 : _panoTextLabelData$no.x, (_panoTextLabelData$no2 = panoTextLabelData.normal) === null || _panoTextLabelData$no2 === void 0 ? void 0 : _panoTextLabelData$no2.y, (_panoTextLabelData$no3 = panoTextLabelData.normal) === null || _panoTextLabelData$no3 === void 0 ? void 0 : _panoTextLabelData$no3.z); // 生成传入的四个点,将文本框最大宽度定在200px,最高高度在30px
118
-
95
+ var normal = new THREE.Vector3((_panoTextLabelData$no = panoTextLabelData.normal) === null || _panoTextLabelData$no === void 0 ? void 0 : _panoTextLabelData$no.x, (_panoTextLabelData$no2 = panoTextLabelData.normal) === null || _panoTextLabelData$no2 === void 0 ? void 0 : _panoTextLabelData$no2.y, (_panoTextLabelData$no3 = panoTextLabelData.normal) === null || _panoTextLabelData$no3 === void 0 ? void 0 : _panoTextLabelData$no3.z);
96
+ // 生成传入的四个点,将文本框最大宽度定在200px,最高高度在30px
119
97
  var wrapperLength = 200;
120
98
  var wrapperWidth = 30;
121
99
  var points = calcPoints(centerPoint, panoTextLabelData.normal && normal, wrapperLength, wrapperWidth);
122
100
  if (!ref.current) ref.current = (0, _CSS3DRenderPlugin.CSS3DRenderPlugin)(five);
123
101
  var container = ref.current.create3DDomContainer(points);
124
- var css3DObject = container === null || container === void 0 ? void 0 : container.css3DObject; // 将获取的mesh进行旋转操作,根据欧拉角去进行mesh的变换
125
-
102
+ var css3DObject = container === null || container === void 0 ? void 0 : container.css3DObject;
103
+ // 将获取的mesh进行旋转操作,根据欧拉角去进行mesh的变换
126
104
  if (data.quaternion) {
127
105
  var quaternion = new THREE.Quaternion(data.quaternion.x, data.quaternion.y, data.quaternion.z, data.quaternion.w);
128
106
  css3DObject === null || css3DObject === void 0 ? void 0 : css3DObject.quaternion.copy(quaternion);
129
107
  }
130
-
131
108
  if (container !== null && container !== void 0 && container.container) _reactDom["default"].render( /*#__PURE__*/React.createElement("div", {
132
109
  className: "PanoTextLabel PanoTextLabel--notHidden"
133
110
  }, /*#__PURE__*/React.createElement("div", {
@@ -140,15 +117,12 @@ function PanoTextLabel() {
140
117
  }, data.text || ''))), container === null || container === void 0 ? void 0 : container.container);
141
118
  timeoutRef.current = setTimeout(function () {
142
119
  var _ref$current;
143
-
144
120
  (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.disposeAll();
145
121
  }, end - start);
146
122
  };
147
-
148
123
  controller.on(_VreoUnit.VreoKeyframeEnum.PanoTextLabel, callback);
149
124
  return function () {
150
125
  controller.off(_VreoUnit.VreoKeyframeEnum.PanoTextLabel, callback);
151
-
152
126
  if (timeoutRef.current) {
153
127
  clearTimeout(timeoutRef.current);
154
128
  }
@@ -1,89 +1,68 @@
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.Prompter = Prompter;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var _classnames = _interopRequireDefault(require("classnames"));
13
-
14
10
  var _hooks = require("../../../hooks");
15
-
16
11
  var _VreoUnit = require("../../../../typings/VreoUnit");
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
-
15
+ 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; }
24
16
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
25
-
26
17
  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."); }
27
-
28
18
  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); }
29
-
30
19
  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; }
31
-
32
20
  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; }
33
-
34
21
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
35
-
36
22
  function Prompter() {
37
23
  var _React$useState = React.useState(''),
38
- _React$useState2 = _slicedToArray(_React$useState, 2),
39
- text = _React$useState2[0],
40
- setText = _React$useState2[1];
41
-
24
+ _React$useState2 = _slicedToArray(_React$useState, 2),
25
+ text = _React$useState2[0],
26
+ setText = _React$useState2[1];
42
27
  var _React$useState3 = React.useState(true),
43
- _React$useState4 = _slicedToArray(_React$useState3, 2),
44
- hidden = _React$useState4[0],
45
- setHidden = _React$useState4[1];
46
-
28
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
29
+ hidden = _React$useState4[0],
30
+ setHidden = _React$useState4[1];
47
31
  var ref = React.useRef(null);
48
32
  var controller = (0, _hooks.useController)();
49
33
  React.useEffect(function () {
50
34
  var _controller$configs;
51
-
52
35
  if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.Prompter) === false) {
53
36
  return;
54
37
  }
55
-
56
38
  var callback = function callback(keyframe) {
57
39
  var start = keyframe.start,
58
- end = keyframe.end,
59
- data = keyframe.data;
40
+ end = keyframe.end,
41
+ data = keyframe.data;
60
42
  setText(data.text);
61
43
  setHidden(false);
62
-
63
44
  if (ref.current) {
64
45
  clearTimeout(ref.current);
65
46
  ref.current = null;
66
47
  }
67
-
68
48
  ref.current = setTimeout(function () {
69
49
  setHidden(true);
70
- setText(''); // setTimeout(() => setText(''), 500)
50
+ setText('');
51
+ // setTimeout(() => setText(''), 500)
71
52
 
72
53
  if (ref.current) clearTimeout(ref.current);
73
54
  ref.current = null;
74
55
  }, end - start);
75
56
  };
76
-
77
57
  controller.on(_VreoUnit.VreoKeyframeEnum.Prompter, callback);
78
58
  return function () {
79
59
  controller.off(_VreoUnit.VreoKeyframeEnum.Prompter, callback);
80
60
  };
81
61
  }, [controller]);
82
62
  return /*#__PURE__*/React.createElement("div", {
83
- className: (0, _classnames["default"])('vreo-prompter', {
84
- 'vreo-prompter--hidden': hidden,
85
- 'vreo-prompter--audio': controller.isAudio
86
- })
63
+ className: (0, _classnames["default"])('vreo-prompter', _defineProperty({
64
+ 'vreo-prompter--hidden': hidden
65
+ }, "vreo-prompter-left--".concat(controller.agentType), true))
87
66
  }, /*#__PURE__*/React.createElement("div", {
88
67
  className: "vreo-prompter-text"
89
68
  }, /*#__PURE__*/React.createElement("div", {
@@ -1,40 +1,33 @@
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.UpdateVRPanorama = UpdateVRPanorama;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var _five = require("@realsee/five");
13
-
14
10
  var _hooks = require("../../../hooks");
15
-
16
11
  var _VreoUnit = require("../../../../typings/VreoUnit");
17
-
18
12
  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
-
20
13
  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
-
22
14
  function UpdateVRPanorama() {
23
15
  var controller = (0, _hooks.useController)();
24
16
  var five = (0, _hooks.useFiveInstance)();
25
17
  var deafultWorkRef = React.useRef(null);
26
- var updateWorkRef = React.useRef(null); // 恢复默认 VR
18
+ var updateWorkRef = React.useRef(null);
27
19
 
20
+ // 恢复默认 VR
28
21
  var restoreCallback = React.useCallback(function () {
29
22
  // 先清理掉 之前的 VR 数据备份
30
23
  updateWorkRef.current = null;
31
-
32
24
  if (deafultWorkRef.current) {
33
25
  var work = (0, _five.parseWork)(deafultWorkRef.current);
34
26
  five.load(work);
35
27
  }
36
- }, []); // 暂停时: 恢复默认 VR
28
+ }, []);
37
29
 
30
+ // 暂停时: 恢复默认 VR
38
31
  var pausedCallback = React.useCallback(function () {
39
32
  if (deafultWorkRef.current) {
40
33
  var work = (0, _five.parseWork)(deafultWorkRef.current);
@@ -43,33 +36,32 @@ function UpdateVRPanorama() {
43
36
  });
44
37
  five.load(work);
45
38
  }
46
- }, []); // 播放时:如果暂停前有更新 VR 需要还原
39
+ }, []);
47
40
 
41
+ // 播放时:如果暂停前有更新 VR 需要还原
48
42
  var playingCallback = React.useCallback(function () {
49
43
  if (!updateWorkRef.current) {
50
44
  return;
51
45
  }
52
-
53
46
  five.load(updateWorkRef.current);
54
47
  }, []);
55
48
  React.useEffect(function () {
56
49
  var callback = function callback(keyframe) {
57
50
  var _five$work;
58
-
59
51
  if (!deafultWorkRef.current) {
60
52
  deafultWorkRef.current = five.work.raw.works;
61
53
  }
54
+ var data = keyframe.data;
62
55
 
63
- var data = keyframe.data; // 如果数据中有新 work 数据,则直接载入
64
-
56
+ // 如果数据中有新 work 数据,则直接载入
65
57
  if (data.work) {
66
58
  updateWorkRef.current = (0, _five.parseWork)(data.work);
67
59
  five.load(updateWorkRef.current);
68
60
  return;
69
61
  }
62
+ var lastRawWork = (_five$work = five.work) === null || _five$work === void 0 ? void 0 : _five$work.raw.works[0];
70
63
 
71
- var lastRawWork = (_five$work = five.work) === null || _five$work === void 0 ? void 0 : _five$work.raw.works[0]; // 动态场景:不提供完成的签名数据,需重新整理
72
-
64
+ // 动态场景:不提供完成的签名数据,需重新整理
73
65
  if (data.dynamic_scene && !data.panorama) {
74
66
  var lastWork = JSON.parse(lastRawWork);
75
67
  var panorama = lastWork.panorama;
@@ -78,7 +70,6 @@ function UpdateVRPanorama() {
78
70
  data.panorama = panorama;
79
71
  delete data.dynamic_scene;
80
72
  }
81
-
82
73
  Object.assign(window, {
83
74
  $work1: JSON.parse(lastRawWork),
84
75
  $work2: data,
@@ -87,15 +78,17 @@ function UpdateVRPanorama() {
87
78
  updateWorkRef.current = (0, _five.parseWork)([lastRawWork, data]);
88
79
  five.load(updateWorkRef.current);
89
80
  };
81
+ controller.on(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback);
90
82
 
91
- controller.on(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback); // 离开 将之前的内容清空
92
-
93
- controller.on(_VreoUnit.VreoKeyframeEnum.Exit, restoreCallback); // 新载入数据 将之前的内容清空
94
-
95
- controller.on('loaded', restoreCallback); // 暂停 回到默认状态
83
+ // 离开 将之前的内容清空
84
+ controller.on(_VreoUnit.VreoKeyframeEnum.Exit, restoreCallback);
96
85
 
97
- controller.on('paused', pausedCallback); // 播放 回归暂停前状态
86
+ // 新载入数据 将之前的内容清空
87
+ controller.on('loaded', restoreCallback);
98
88
 
89
+ // 暂停 回到默认状态
90
+ controller.on('paused', pausedCallback);
91
+ // 播放 回归暂停前状态
99
92
  controller.on('playing', playingCallback);
100
93
  return function () {
101
94
  // 清理事件监听
@@ -1,85 +1,60 @@
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.VideoEffect = VideoEffect;
9
-
10
8
  var _classnames = _interopRequireDefault(require("classnames"));
11
-
12
9
  var React = _interopRequireWildcard(require("react"));
13
-
14
10
  var _VreoUnit = require("../../../../typings/VreoUnit");
15
-
16
11
  var _hooks = require("../../../hooks");
17
-
18
12
  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
-
20
13
  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
-
22
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
23
-
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; }
24
16
  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
-
26
17
  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
-
28
18
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
29
-
30
19
  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
-
32
20
  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
-
34
21
  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
-
36
22
  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
-
38
23
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
39
-
40
24
  var inlinePlay = function inlinePlay(videoInstance) {
41
25
  if (!videoInstance) return;
42
-
43
26
  var canplaythrough = function canplaythrough() {
44
27
  videoInstance.removeEventListener('canplaythrough', canplaythrough);
45
-
46
28
  try {
47
29
  videoInstance.play();
48
30
  } catch (error) {}
49
31
  };
50
-
51
32
  videoInstance.addEventListener('canplaythrough', canplaythrough);
52
33
  videoInstance.load();
53
- }; // const emptyVideo = '//vrlab-static.ljcdn.com/release/web/leisure.69fd3522.mov'
54
-
34
+ };
55
35
 
36
+ // const emptyVideo = '//vrlab-static.ljcdn.com/release/web/leisure.69fd3522.mov'
56
37
  var PI = Math.PI;
57
38
  var PI_2 = PI * 2;
58
-
59
39
  function VideoEffect() {
60
40
  var ref = React.useRef(null);
61
41
  var videoRef = React.useRef();
62
42
  var controller = (0, _hooks.useController)();
63
43
  var timeoutRef = React.useRef();
64
-
65
44
  var _React$useState = React.useState(false),
66
- _React$useState2 = _slicedToArray(_React$useState, 2),
67
- visible = _React$useState2[0],
68
- setVisible = _React$useState2[1];
69
-
45
+ _React$useState2 = _slicedToArray(_React$useState, 2),
46
+ visible = _React$useState2[0],
47
+ setVisible = _React$useState2[1];
70
48
  var five = (0, _hooks.useFiveInstance)();
71
-
72
49
  var setBlobSrc = function setBlobSrc(blob) {
73
50
  if (!videoRef.current) return;
74
51
  videoRef.current.src = blob;
75
52
  };
76
-
77
53
  React.useEffect(function () {
78
54
  var callback = /*#__PURE__*/function () {
79
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(keyframe) {
55
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(keyframe) {
80
56
  var start, end, _ref2, videoSrc, fov, direction, panoIndex, vector, _ref3, _ref4, longitude, latitude;
81
-
82
- return regeneratorRuntime.wrap(function _callee$(_context) {
57
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
83
58
  while (1) {
84
59
  switch (_context.prev = _context.next) {
85
60
  case 0:
@@ -89,11 +64,9 @@ function VideoEffect() {
89
64
  if (vector) {
90
65
  return [vector.longitude, vector.latitude];
91
66
  }
92
-
93
67
  if (!direction) {
94
68
  return [0, 0];
95
69
  }
96
-
97
70
  var longitude = -Math.atan2(direction.x, -direction.z);
98
71
  longitude = (longitude % PI_2 + PI_2) % PI_2;
99
72
  var latitude = -Math.asin(direction.y / 1);
@@ -110,17 +83,13 @@ function VideoEffect() {
110
83
  setVisible(true);
111
84
  timeoutRef.current = setTimeout(function () {
112
85
  var _videoRef$current;
113
-
114
86
  if (!((_videoRef$current = videoRef.current) !== null && _videoRef$current !== void 0 && _videoRef$current.paused)) {
115
87
  var _videoRef$current2;
116
-
117
88
  (_videoRef$current2 = videoRef.current) === null || _videoRef$current2 === void 0 ? void 0 : _videoRef$current2.pause();
118
89
  }
119
-
120
90
  setVisible(false);
121
91
  setBlobSrc('');
122
92
  }, end - start);
123
-
124
93
  case 8:
125
94
  case "end":
126
95
  return _context.stop();
@@ -128,16 +97,13 @@ function VideoEffect() {
128
97
  }
129
98
  }, _callee);
130
99
  }));
131
-
132
100
  return function callback(_x) {
133
101
  return _ref.apply(this, arguments);
134
102
  };
135
103
  }();
136
-
137
104
  controller.on(_VreoUnit.VreoKeyframeEnum.VideoEffect, callback);
138
105
  return function () {
139
106
  controller.off(_VreoUnit.VreoKeyframeEnum.VideoEffect, callback);
140
-
141
107
  if (timeoutRef.current) {
142
108
  clearTimeout(timeoutRef.current);
143
109
  }
@@ -145,10 +111,9 @@ function VideoEffect() {
145
111
  }, [controller]);
146
112
  React.useEffect(function () {
147
113
  var _controller$configs, _controller$configs$v;
148
-
149
114
  if (!ref.current) return;
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
-
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} />
152
117
  video.setAttribute('playsinline', 'true');
153
118
  video.setAttribute('webkit-playsinline', 'true');
154
119
  video.setAttribute('autoplay', 'true');
@@ -158,10 +123,10 @@ function VideoEffect() {
158
123
  ref.current.append(videoRef.current);
159
124
  document.addEventListener('WeixinJSBridgeReady', function () {
160
125
  var _videoRef$current3;
161
-
162
126
  (_videoRef$current3 = videoRef.current) === null || _videoRef$current3 === void 0 ? void 0 : _videoRef$current3.play();
163
127
  }, false);
164
- if (!ref.current) return; // const asyncfunc = async () => {
128
+ if (!ref.current) return;
129
+ // const asyncfunc = async () => {
165
130
  // setBlobSrc(await URL.createObjectURL(await Preloader.blob(emptyVideo)))
166
131
  // inlinePlay(videoRef.current)
167
132
  // }
@@ -6,8 +6,8 @@ export interface PlayerConfigs {
6
6
  /**
7
7
  * @deprecated rename to container
8
8
  */
9
- containter?: ReactDOM.Container;
10
- container?: ReactDOM.Container;
9
+ containter?: Element;
10
+ container?: Element;
11
11
  keyframeMap: VreoKeyframeConfigMap;
12
12
  /**
13
13
  * 微信端自动播放功能实现需要提前初始化 Video 实例。
@@ -28,6 +28,13 @@ export interface PlayerConfigs {
28
28
  size: number;
29
29
  };
30
30
  autoPreload?: boolean;
31
+ appSize?: AppSize;
32
+ appearance?: Appearance;
33
+ }
34
+ export declare type AppSize = 'S' | 'M' | 'L' | 'XL';
35
+ export declare type WaveAppearance = 'single' | 'double' | 'solid' | 'swap' | 'expand';
36
+ export interface Appearance {
37
+ waveStyle?: 'wave' | 'solid';
31
38
  }
32
39
  export declare type VreoSubscribe = Pick<Subscribe<VreoKeyframeEvent>, 'on' | 'once' | 'off'>;
33
40
  export interface CustomVreoKeyframeProps {
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = centerPoint;
7
-
8
7
  var _three = require("three");
9
-
10
8
  function centerPoint(point1, point2) {
11
9
  return new _three.Vector3((point1.x + point2.x) / 2, (point1.y + point2.y) / 2, (point1.z + point2.z) / 2);
12
10
  }
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = createResizeObserver;
7
-
8
7
  /**
9
8
  * @description: 简陋的 ResizeObserver polyfill
10
9
  */
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = evenNumber;
7
-
8
7
  function evenNumber(num, config) {
9
8
  var roundNum = Math.round(num);
10
9
  return roundNum % 2 === 0 ? roundNum : roundNum + Number(config !== null && config !== void 0 && config.smaller ? -1 : 1);