@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.
Files changed (166) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/README.md +46 -36
  3. package/lib/PlayController/createHTMLAudioElement.js +6 -11
  4. package/lib/PlayController/index.js +16 -81
  5. package/lib/Player/App.js +0 -24
  6. package/lib/Player/Controller.d.ts +3 -3
  7. package/lib/Player/Controller.js +47 -105
  8. package/lib/Player/custom/SpatialScenePanel/index.js +42 -68
  9. package/lib/Player/hooks.js +0 -10
  10. package/lib/Player/index.js +40 -87
  11. package/lib/Player/modules/Drawer/index.js +0 -17
  12. package/lib/Player/modules/PopUp/index.js +0 -10
  13. package/lib/Player/modules/ResizeObserver/index.js +0 -8
  14. package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +2 -2
  15. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +20 -114
  16. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +2 -24
  17. package/lib/Player/modules/VideoAgent/index.js +1 -18
  18. package/lib/Player/modules/Wave/index.js +160 -36
  19. package/lib/Player/modules/keyframes/BgMusic/index.js +50 -51
  20. package/lib/Player/modules/keyframes/CameraMovement/index.js +3 -27
  21. package/lib/Player/modules/keyframes/InfoPanel/index.js +8 -25
  22. package/lib/Player/modules/keyframes/ModelVideo/index.js +3 -29
  23. package/lib/Player/modules/keyframes/PanoEffect/index.js +15 -43
  24. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +0 -7
  25. package/lib/Player/modules/keyframes/PanoTag/index.js +7 -23
  26. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +22 -47
  27. package/lib/Player/modules/keyframes/Prompter/index.js +10 -32
  28. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +18 -25
  29. package/lib/Player/modules/keyframes/VideoEffect/index.js +12 -47
  30. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +0 -2
  31. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +0 -1
  32. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +0 -1
  33. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +19 -60
  34. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +2 -5
  35. package/lib/fivePlugins/CameraMovementPlugin/index.js +28 -75
  36. package/lib/fivePlugins/CameraMovementPlugin/typings.js +0 -4
  37. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +11 -60
  38. package/lib/index.js +0 -1
  39. package/lib/react/index.js +7 -34
  40. package/lib/shared-utils/Audio.d.ts +14 -0
  41. package/lib/shared-utils/Audio.js +159 -0
  42. package/lib/shared-utils/{AduioLike.d.ts → AudioLike.d.ts} +0 -0
  43. package/lib/shared-utils/{AduioLike.js → AudioLike.js} +9 -45
  44. package/lib/shared-utils/Preloader.js +0 -7
  45. package/lib/shared-utils/addResizeListener.js +0 -5
  46. package/lib/shared-utils/animationFrame/BetterTween.js +2 -38
  47. package/lib/shared-utils/animationFrame/index.js +2 -10
  48. package/lib/shared-utils/animationFrame/tween.js +2 -15
  49. package/lib/shared-utils/createTransMatrix.js +2 -17
  50. package/lib/shared-utils/getFileExpandedName.js +0 -1
  51. package/lib/shared-utils/getMediaInfo.js +0 -9
  52. package/lib/shared-utils/setElementDataset.js +0 -2
  53. package/lib/typings/VreoUnit.d.ts +5 -5
  54. package/lib/typings/VreoUnit.js +0 -15
  55. package/package.json +2 -4
  56. package/stylesheets/default.css +11 -4
  57. package/docs/.nojekyll +0 -1
  58. package/docs/assets/custom.css +0 -78
  59. package/docs/assets/highlight.css +0 -127
  60. package/docs/assets/icons.css +0 -1043
  61. package/docs/assets/icons.png +0 -0
  62. package/docs/assets/icons@2x.png +0 -0
  63. package/docs/assets/main.js +0 -52
  64. package/docs/assets/search.js +0 -1
  65. package/docs/assets/style.css +0 -1414
  66. package/docs/assets/widgets.png +0 -0
  67. package/docs/assets/widgets@2x.png +0 -0
  68. package/docs/classes/Player.AudioLike.html +0 -52
  69. package/docs/classes/Player.Controller.html +0 -54
  70. package/docs/classes/Player.Player-1.html +0 -50
  71. package/docs/classes/Player.VideoAgentMesh.html +0 -142
  72. package/docs/classes/Player.VideoAgentScene.html +0 -1
  73. package/docs/demo/assets/AppReact.39bef668.js +0 -1
  74. package/docs/demo/assets/default.9bbb3329.js +0 -3984
  75. package/docs/demo/assets/default.f3f3ca8c.css +0 -1
  76. package/docs/demo/assets/dynamic.5e9275ce.js +0 -1
  77. package/docs/demo/assets/examples.2ac45f33.js +0 -25
  78. package/docs/demo/assets/examples.dac4a6fe.css +0 -1
  79. package/docs/demo/assets/index.6699bd11.js +0 -1
  80. package/docs/demo/assets/index.9331038f.css +0 -1
  81. package/docs/demo/assets/main.a0741cbc.js +0 -1
  82. package/docs/demo/assets/react.2ee8565f.css +0 -1
  83. package/docs/demo/assets/react.a3f20ea9.js +0 -25
  84. package/docs/demo/assets/znRoyv06SZQeqA7m.0057e8ae.js +0 -1
  85. package/docs/demo/examples.html +0 -17
  86. package/docs/demo/index-react-dynamic.html +0 -20
  87. package/docs/demo/index-react.html +0 -20
  88. package/docs/demo/index.html +0 -19
  89. package/docs/enums/Player.InfoPanelStyleEnum.html +0 -1
  90. package/docs/enums/Player.InfoPanelTypeEnum.html +0 -3
  91. package/docs/enums/Player.PanoEffectEnum.html +0 -5
  92. package/docs/enums/Player.PanoTagEnum.html +0 -3
  93. package/docs/enums/Player.PanoTagStyleEnum.html +0 -7
  94. package/docs/enums/Player.VreoKeyframeEnum.html +0 -25
  95. package/docs/enums/fivePlugins.CameraMovementEffect.html +0 -1
  96. package/docs/enums/fivePlugins.Rotation.html +0 -1
  97. package/docs/index.html +0 -245
  98. package/docs/interfaces/Player.CustomVreoKeyframeProps.html +0 -1
  99. package/docs/interfaces/Player.PlayerConfigs.html +0 -7
  100. package/docs/interfaces/Player.Vertex.html +0 -3
  101. package/docs/interfaces/Player.VideoAgentMeshOptions.html +0 -8
  102. package/docs/interfaces/Player.VreoKeyframe.html +0 -3
  103. package/docs/interfaces/Player.VreoUnit.html +0 -3
  104. package/docs/interfaces/Player.VreoVideo.html +0 -3
  105. package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +0 -4
  106. package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +0 -1
  107. package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +0 -7
  108. package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +0 -1
  109. package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +0 -1
  110. package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +0 -1
  111. package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +0 -1
  112. package/docs/interfaces/fivePlugins.Vector3Position.html +0 -3
  113. package/docs/interfaces/react.VreoActionCallbacks.html +0 -23
  114. package/docs/interfaces/react.VreoProviderProps.html +0 -1
  115. package/docs/modules/Player.html +0 -37
  116. package/docs/modules/custom.html +0 -3
  117. package/docs/modules/fivePlugins.html +0 -6
  118. package/docs/modules/react.html +0 -1
  119. package/docs/modules.html +0 -1
  120. package/resources/PlayController/createHTMLAudioElement.ts +0 -53
  121. package/resources/PlayController/index.ts +0 -154
  122. package/resources/Player/App.tsx +0 -66
  123. package/resources/Player/Controller.ts +0 -297
  124. package/resources/Player/custom/SpatialScenePanel/index.tsx +0 -264
  125. package/resources/Player/hooks.ts +0 -26
  126. package/resources/Player/index.tsx +0 -225
  127. package/resources/Player/modules/Drawer/index.tsx +0 -40
  128. package/resources/Player/modules/PopUp/index.tsx +0 -26
  129. package/resources/Player/modules/ResizeObserver/index.tsx +0 -23
  130. package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +0 -302
  131. package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +0 -56
  132. package/resources/Player/modules/VideoAgent/index.tsx +0 -53
  133. package/resources/Player/modules/Wave/index.tsx +0 -18
  134. package/resources/Player/modules/keyframes/BgMusic/index.tsx +0 -66
  135. package/resources/Player/modules/keyframes/CameraMovement/index.tsx +0 -37
  136. package/resources/Player/modules/keyframes/InfoPanel/index.tsx +0 -165
  137. package/resources/Player/modules/keyframes/ModelVideo/index.tsx +0 -77
  138. package/resources/Player/modules/keyframes/PanoEffect/index.tsx +0 -99
  139. package/resources/Player/modules/keyframes/PanoEffect/lineAnime.ts +0 -31
  140. package/resources/Player/modules/keyframes/PanoTag/index.tsx +0 -83
  141. package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +0 -117
  142. package/resources/Player/modules/keyframes/Prompter/index.tsx +0 -56
  143. package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +0 -99
  144. package/resources/Player/modules/keyframes/VideoEffect/index.tsx +0 -115
  145. package/resources/Player/typings.ts +0 -49
  146. package/resources/fivePlugins/CSS3DRenderPlugin/centerPoint.ts +0 -5
  147. package/resources/fivePlugins/CSS3DRenderPlugin/createResizeObserver.ts +0 -17
  148. package/resources/fivePlugins/CSS3DRenderPlugin/evenNumber.ts +0 -4
  149. package/resources/fivePlugins/CSS3DRenderPlugin/index.ts +0 -254
  150. package/resources/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.ts +0 -5
  151. package/resources/fivePlugins/CameraMovementPlugin/index.ts +0 -226
  152. package/resources/fivePlugins/CameraMovementPlugin/typings.ts +0 -59
  153. package/resources/fivePlugins/ModelTVVideoPlugin/index.ts +0 -278
  154. package/resources/index.ts +0 -1
  155. package/resources/react/index.tsx +0 -121
  156. package/resources/shared-utils/AduioLike.ts +0 -109
  157. package/resources/shared-utils/Preloader.ts +0 -35
  158. package/resources/shared-utils/addResizeListener.ts +0 -46
  159. package/resources/shared-utils/animationFrame/BetterTween.ts +0 -33
  160. package/resources/shared-utils/animationFrame/index.ts +0 -48
  161. package/resources/shared-utils/animationFrame/tween.ts +0 -51
  162. package/resources/shared-utils/createTransMatrix.ts +0 -12
  163. package/resources/shared-utils/getFileExpandedName.ts +0 -6
  164. package/resources/shared-utils/getMediaInfo.ts +0 -52
  165. package/resources/shared-utils/setElementDataset.ts +0 -18
  166. package/resources/typings/VreoUnit.ts +0 -314
@@ -1,107 +1,67 @@
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.ControllerContext = exports.Controller = void 0;
9
-
10
8
  var _five = require("@realsee/five");
11
-
12
9
  var _mobx = require("mobx");
13
-
14
10
  var React = _interopRequireWildcard(require("react"));
15
-
16
11
  var _animationFrame = require("../shared-utils/animationFrame");
17
-
12
+ var _VreoUnit = require("../typings/VreoUnit");
18
13
  var _setElementDataset = _interopRequireDefault(require("../shared-utils/setElementDataset"));
19
-
20
14
  var _getMediaInfo = require("../shared-utils/getMediaInfo");
21
-
22
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
23
-
24
16
  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
17
  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
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
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
41
-
42
25
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
43
-
44
26
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
45
-
46
27
  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); } }
47
-
48
28
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
49
-
50
29
  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); }
51
-
52
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
53
-
30
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
54
31
  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); }; }
55
-
56
32
  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); }
57
-
58
33
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
59
-
60
34
  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; } }
61
-
62
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
63
-
35
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
64
36
  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; }
65
-
66
37
  /**
67
38
  * 逻辑控制器:内部状态。
68
39
  */
69
40
  var Controller = /*#__PURE__*/function (_Subscribe) {
70
41
  _inherits(Controller, _Subscribe);
71
-
72
42
  var _super = _createSuper(Controller);
73
-
74
43
  function Controller(_ref) {
75
44
  var _this;
76
-
77
45
  var five = _ref.five,
78
- container = _ref.container,
79
- configs = _ref.configs;
80
-
46
+ container = _ref.container,
47
+ configs = _ref.configs;
81
48
  _classCallCheck(this, Controller);
82
-
83
49
  _this = _super.call(this);
84
-
85
50
  _defineProperty(_assertThisInitialized(_this), "playing", false);
86
-
87
51
  _defineProperty(_assertThisInitialized(_this), "ended", false);
88
-
89
52
  _defineProperty(_assertThisInitialized(_this), "loading", false);
90
-
53
+ _defineProperty(_assertThisInitialized(_this), "containerSize", {
54
+ width: 0,
55
+ height: 0
56
+ });
91
57
  _defineProperty(_assertThisInitialized(_this), "waveAppearance", null);
92
-
93
58
  _defineProperty(_assertThisInitialized(_this), "appearance", {
94
- waveStyle: 'solid'
59
+ waveStyle: 'wave'
95
60
  });
96
-
97
61
  _defineProperty(_assertThisInitialized(_this), "avatar", {});
98
-
99
62
  _defineProperty(_assertThisInitialized(_this), "visible", false);
100
-
101
63
  _defineProperty(_assertThisInitialized(_this), "popUp", null);
102
-
103
64
  _defineProperty(_assertThisInitialized(_this), "drawerConfig", null);
104
-
105
65
  _this.configs = configs;
106
66
  _this.container = container;
107
67
  _this.five = five;
@@ -113,6 +73,7 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
113
73
  playing: _mobx.observable,
114
74
  setPlaying: _mobx.action,
115
75
  loading: _mobx.observable,
76
+ // videoAgentScene: observable.ref,
116
77
  setLoading: _mobx.action,
117
78
  popUp: _mobx.observable.ref,
118
79
  openPopUp: _mobx.action,
@@ -133,20 +94,17 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
133
94
  return [_this.appearance.waveStyle, _this.loading];
134
95
  }, function (_ref2) {
135
96
  var _ref3 = _slicedToArray(_ref2, 2),
136
- waveStyle = _ref3[0],
137
- loading = _ref3[1];
138
-
97
+ waveStyle = _ref3[0],
98
+ loading = _ref3[1];
139
99
  if (loading === null) {
140
100
  _this.waveAppearance = null;
141
101
  return;
142
102
  }
143
-
144
103
  if (waveStyle === 'wave') {
145
104
  switch (loading) {
146
105
  case true:
147
106
  _this.waveAppearance = 'double';
148
107
  break;
149
-
150
108
  case false:
151
109
  _this.waveAppearance = 'solid';
152
110
  break;
@@ -156,7 +114,6 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
156
114
  case true:
157
115
  _this.waveAppearance = 'swap';
158
116
  break;
159
-
160
117
  case false:
161
118
  _this.waveAppearance = 'expand';
162
119
  break;
@@ -165,27 +122,23 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
165
122
  }, {
166
123
  fireImmediately: true
167
124
  });
168
-
169
125
  if (!_this.appSize) {
170
126
  (0, _mobx.reaction)(function () {
171
127
  return _this.containerSize;
172
128
  }, function (containerSize) {
173
- if (!containerSize) return;
129
+ if (!(containerSize !== null && containerSize !== void 0 && containerSize.width)) return;
174
130
  var width = containerSize.width;
175
131
  var height = containerSize.height;
176
-
177
132
  var size = function () {
178
133
  if (width <= 500) return 'S';
179
134
  if (width <= 1024) return 'M';
180
135
  if (width <= 2048) return 'L';
181
136
  return 'XL';
182
137
  }();
183
-
184
138
  var orientation = function () {
185
139
  if (height > width) return 'portrait';
186
140
  return 'landscape';
187
141
  }();
188
-
189
142
  (0, _setElementDataset["default"])(_this.container, {
190
143
  size: size
191
144
  });
@@ -199,9 +152,9 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
199
152
  (0, _setElementDataset["default"])(_this.container, {
200
153
  size: _this.appSize
201
154
  });
202
- } // 监听播放情况:抛出触发时机
203
-
155
+ }
204
156
 
157
+ // 监听播放情况:抛出触发时机
205
158
  (0, _mobx.reaction)(function () {
206
159
  return _this.ended;
207
160
  }, function (ended) {
@@ -218,12 +171,13 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
218
171
  });
219
172
  return _this;
220
173
  }
221
-
222
174
  _createClass(Controller, [{
223
175
  key: "agentType",
224
- get: function get() {
225
- var _this$videoAgentScene, _this$avatar;
176
+ get:
177
+ // null 表示加载失败
226
178
 
179
+ function get() {
180
+ var _this$videoAgentScene, _this$avatar;
227
181
  var type = (0, _getMediaInfo.getMediaType)((_this$videoAgentScene = this.videoAgentScene) === null || _this$videoAgentScene === void 0 ? void 0 : _this$videoAgentScene.videoAgentMesh.videoUrl);
228
182
  if ((_this$avatar = this.avatar) !== null && _this$avatar !== void 0 && _this$avatar.force) return 'avatar';
229
183
  if (type === 'video') return 'video';
@@ -236,7 +190,6 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
236
190
  this.popUp = null;
237
191
  return;
238
192
  }
239
-
240
193
  this.popUp = popUp;
241
194
  }
242
195
  }, {
@@ -282,14 +235,12 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
282
235
  value: function openDrawer(drawerConfig) {
283
236
  if (!drawerConfig) {
284
237
  var _this$drawerConfig;
285
-
286
238
  this.drawerConfig = {
287
239
  content: '',
288
240
  height: (_this$drawerConfig = this.drawerConfig) === null || _this$drawerConfig === void 0 ? void 0 : _this$drawerConfig.height
289
241
  };
290
242
  return;
291
243
  }
292
-
293
244
  this.drawerConfig = drawerConfig;
294
245
  }
295
246
  }, {
@@ -301,19 +252,23 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
301
252
  key: "currentTime",
302
253
  get: function get() {
303
254
  var _this$videoAgentScene2;
304
-
305
255
  return ((_this$videoAgentScene2 = this.videoAgentScene) === null || _this$videoAgentScene2 === void 0 ? void 0 : _this$videoAgentScene2.videoAgentMesh.currentTime) || 0;
306
256
  }
307
257
  }, {
308
258
  key: "currentKeyframes",
309
259
  get: function get() {
310
260
  var _this2 = this;
311
-
312
261
  if (!this.vreoUnit) return [];
313
- var keyframes = this.vreoUnit.keyframes; // 没有被解析过且开始时间低于当前时间戳 100ms
314
-
262
+ var keyframes = this.vreoUnit.keyframes;
263
+ // 没有被解析过且开始时间低于当前时间戳 100ms
315
264
  return keyframes.filter(function (keyframe) {
316
265
  if (keyframe.parsed) return false;
266
+ // 检测结束时间
267
+ if (keyframe.end < _this2.currentTime) return false;
268
+ // 检测开始时间
269
+ if (keyframe.start > _this2.currentTime) return false;
270
+ if (keyframe.type === _VreoUnit.VreoKeyframeEnum.BgMusic) return true;
271
+ // 开始时间低于当前时间戳 100ms
317
272
  var dur = _this2.currentTime - keyframe.start;
318
273
  return dur <= 100 && dur >= 0;
319
274
  });
@@ -322,52 +277,48 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
322
277
  key: "mediaInstance",
323
278
  get: function get() {
324
279
  var _this$videoAgentScene3;
325
-
326
280
  return (_this$videoAgentScene3 = this.videoAgentScene) === null || _this$videoAgentScene3 === void 0 ? void 0 : _this$videoAgentScene3.videoAgentMesh.mediaInstance;
327
281
  }
282
+
328
283
  /**
329
284
  * 逐帧任务
330
285
  */
331
-
332
286
  }, {
333
287
  key: "requestAnimationFrameLoop",
334
288
  value: function requestAnimationFrameLoop(callback) {
335
289
  var _this$mediaInstance,
336
- _this$mediaInstance4,
337
- _this3 = this;
338
-
339
- if ((_this$mediaInstance = this.mediaInstance) !== null && _this$mediaInstance !== void 0 && _this$mediaInstance.ended) {
290
+ _this$mediaInstance4,
291
+ _this3 = this;
292
+ if ((_this$mediaInstance = this.mediaInstance) !== null && _this$mediaInstance !== void 0 && _this$mediaInstance.ended && this.mediaInstance.currentTime !== 0) {
293
+ var _this$vreoUnit;
294
+ if (this.ended) return;
295
+ (_this$vreoUnit = this.vreoUnit) === null || _this$vreoUnit === void 0 ? void 0 : _this$vreoUnit.keyframes.forEach(function (keyframe) {
296
+ return keyframe.parsed = false;
297
+ });
340
298
  this.setEnded(true);
341
299
  this.setPlaying(false);
342
300
  this.mediaInstance.pause();
301
+ this.mediaInstance.currentTime = 0;
343
302
  return;
344
303
  }
345
-
346
304
  if (!this.playing) {
347
305
  var _this$mediaInstance2;
348
-
349
306
  if (!((_this$mediaInstance2 = this.mediaInstance) !== null && _this$mediaInstance2 !== void 0 && _this$mediaInstance2.paused)) {
350
307
  var _this$mediaInstance3;
351
-
352
308
  (_this$mediaInstance3 = this.mediaInstance) === null || _this$mediaInstance3 === void 0 ? void 0 : _this$mediaInstance3.pause();
353
309
  }
354
-
355
310
  return;
356
311
  }
357
-
358
312
  if ((_this$mediaInstance4 = this.mediaInstance) !== null && _this$mediaInstance4 !== void 0 && _this$mediaInstance4.paused && this.playing) {
359
313
  this.mediaInstance.play();
360
314
  }
361
-
362
315
  var currentKeyframes = this.currentKeyframes;
363
316
  currentKeyframes.forEach(function (keyframe) {
364
317
  if (keyframe.parsed) return;
365
318
  keyframe.parsed = true;
366
-
367
- _this3.emit(keyframe.type, keyframe);
368
-
319
+ _this3.emit(keyframe.type, keyframe, _this3.currentTime);
369
320
  if (callback) {
370
- callback(keyframe.type, keyframe);
321
+ callback(keyframe.type, keyframe, _this3.currentTime);
371
322
  }
372
323
  });
373
324
  }
@@ -375,7 +326,6 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
375
326
  key: "run",
376
327
  value: function run(callback) {
377
328
  var _this4 = this;
378
-
379
329
  if (this.stopInterval) return;
380
330
  this.stopInterval = (0, _animationFrame.requestAnimationFrameInterval)(function () {
381
331
  return _this4.requestAnimationFrameLoop(callback);
@@ -384,34 +334,26 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
384
334
  }, {
385
335
  key: "dispose",
386
336
  value: function dispose() {
337
+ var _this$vreoUnit2, _this$stopInterval;
387
338
  this.setPlaying(false);
339
+ (_this$vreoUnit2 = this.vreoUnit) === null || _this$vreoUnit2 === void 0 ? void 0 : _this$vreoUnit2.keyframes.forEach(function (keyframe) {
340
+ return keyframe.parsed = false;
341
+ });
388
342
 
389
- if (this.currentKeyframes) {
390
- this.currentKeyframes.forEach(function (keyframe) {
391
- return keyframe.parsed = false;
392
- });
393
- }
394
343
  /**
395
344
  * 清理掉数据
396
345
  */
397
-
398
-
399
346
  this.vreoUnit = undefined;
400
-
401
347
  if (this.mediaInstance) {
348
+ this.mediaInstance.pause();
402
349
  this.mediaInstance.currentTime = 0;
403
350
  }
404
-
405
- if (this.stopInterval) {
406
- this.stopInterval();
407
- this.stopInterval = undefined;
408
- }
351
+ (_this$stopInterval = this.stopInterval) === null || _this$stopInterval === void 0 ? void 0 : _this$stopInterval.call(this);
352
+ this.stopInterval = undefined;
409
353
  }
410
354
  }]);
411
-
412
355
  return Controller;
413
356
  }(_five.Subscribe);
414
-
415
357
  exports.Controller = Controller;
416
358
  var ControllerContext = /*#__PURE__*/React.createContext(null);
417
359
  exports.ControllerContext = ControllerContext;
@@ -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.SpatialScenePanel = SpatialScenePanel;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var _reactDom = _interopRequireDefault(require("react-dom"));
13
-
14
10
  var _three = require("three");
15
-
16
11
  var _BetterTween = require("../../../shared-utils/animationFrame/BetterTween");
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
  // const getSphere = (position: Vector3, color = 0xffff00) => {
41
24
  // const geometry = new SphereGeometry(0.05, 32, 16)
42
25
  // const material = new MeshBasicMaterial({ color })
@@ -44,28 +27,27 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
44
27
  // sphere.position.copy(position)
45
28
  // return sphere
46
29
  // }
30
+
47
31
  var searchV1 = function searchV1(_ref) {
48
32
  var five = _ref.five,
49
- dom = _ref.dom;
33
+ dom = _ref.dom;
50
34
  var cameraDirection = new _three.Vector3();
51
35
  five.camera.getWorldDirection(cameraDirection);
52
36
  var cameraPosition = five.camera.position;
53
-
54
37
  var _five$model$intersect = five.model.intersectRaycaster(new _three.Raycaster(cameraPosition, cameraDirection)),
55
- _five$model$intersect2 = _slicedToArray(_five$model$intersect, 1),
56
- intersect = _five$model$intersect2[0];
57
-
38
+ _five$model$intersect2 = _slicedToArray(_five$model$intersect, 1),
39
+ intersect = _five$model$intersect2[0];
58
40
  var point = five.project2d(intersect.point);
59
- var widescreen = window.innerWidth > 560 ? true : false; // const width = dom!.clientWidth
60
-
41
+ var widescreen = window.innerWidth > 560 ? true : false;
42
+ // const width = dom!.clientWidth
61
43
  var height = dom.clientHeight;
62
44
  dom.style.left = point.x + 'px';
63
45
  dom.style.top = point.y - height / 2 + 'px';
64
46
  var rect = dom.getBoundingClientRect();
65
47
  var left = rect.left,
66
- top = rect.top,
67
- bottom = rect.bottom,
68
- right = rect.right;
48
+ top = rect.top,
49
+ bottom = rect.bottom,
50
+ right = rect.right;
69
51
  var leftBottom = new _three.Vector3(left, bottom);
70
52
  var leftTop = new _three.Vector3(left, top);
71
53
  var rightTop = new _three.Vector3(right, top);
@@ -75,23 +57,24 @@ var searchV1 = function searchV1(_ref) {
75
57
  point.setY(-(point.y / window.innerHeight) * 2 + (widescreen ? 1.35 : 1.125));
76
58
  point.setZ(0.5);
77
59
  return point.unproject(five.camera).addScaledVector(cameraDirection, 0.2);
78
- }); // __debug__
60
+ });
61
+
62
+ // __debug__
79
63
  // const colors = [0xdc143c, 0xffff00, 0x0000ff, 0x008000]
80
64
  // points.forEach((p, index) => five.scene.add(getSphere(p, colors[index])))
81
- // 判断是手机 150
82
65
 
66
+ // 判断是手机 150
83
67
  var ratio = leftBottom.distanceTo(rightBottom) / (widescreen ? 150 : 120);
84
68
  return {
85
69
  points: points,
86
70
  ratio: ratio
87
71
  };
88
72
  };
73
+
89
74
  /**
90
75
  * 空间场景面板
91
76
  * @returns
92
77
  */
93
-
94
-
95
78
  function SpatialScenePanel(props) {
96
79
  var timeoutRef = React.useRef(null);
97
80
  var ref = React.useRef(null);
@@ -101,68 +84,63 @@ function SpatialScenePanel(props) {
101
84
  if (!ref.current) {
102
85
  return;
103
86
  }
104
-
105
87
  var callback = function callback(keyframe) {
106
88
  if (keyframe.data.customType !== 'SpatialScenePanel') {
107
89
  return;
108
90
  }
91
+ var data = keyframe.data;
109
92
 
110
- var data = keyframe.data; // const data = mockData
111
-
93
+ // const data = mockData
112
94
  var _searchV = searchV1({
113
- five: props.five,
114
- dom: ref.current
115
- }),
116
- points = _searchV.points,
117
- ratio = _searchV.ratio;
118
-
95
+ five: props.five,
96
+ dom: ref.current
97
+ }),
98
+ points = _searchV.points,
99
+ ratio = _searchV.ratio;
119
100
  var _ref2 = rendererRef.current.create3DDomContainer(points, {
120
- ratio: ratio,
121
- autoRender: false
122
- }) || {},
123
- container = _ref2.container,
124
- dispose = _ref2.dispose,
125
- css3DObject = _ref2.css3DObject,
126
- render = _ref2.render;
127
-
101
+ ratio: ratio,
102
+ autoRender: false
103
+ }) || {},
104
+ container = _ref2.container,
105
+ dispose = _ref2.dispose,
106
+ css3DObject = _ref2.css3DObject,
107
+ render = _ref2.render;
128
108
  Object.assign(window, {
129
109
  $css3DObject: css3DObject
130
110
  });
131
111
  if (!container) return;
132
-
133
112
  _reactDom["default"].render( /*#__PURE__*/React.createElement(Panel, {
134
113
  ref: function ref(_ref3) {
135
114
  return panelRef.current = _ref3;
136
115
  },
137
116
  data: data
138
117
  }), container);
139
-
140
118
  var startRotateY = -(Math.PI * 2) / 9;
141
119
  var lastRotateY = 0;
142
120
  (0, _BetterTween.tweenProgress)(1000).onUpdate(function (_ref4) {
143
121
  var progress = _ref4.progress;
144
122
  var needRotateY = Math.PI / 90 * 11 * progress;
145
123
  var rotateY = needRotateY - lastRotateY;
146
- css3DObject === null || css3DObject === void 0 ? void 0 : css3DObject.rotateY(rotateY); // css3DObject?.rotateZ
147
-
124
+ css3DObject === null || css3DObject === void 0 ? void 0 : css3DObject.rotateY(rotateY);
125
+ // css3DObject?.rotateZ
148
126
  lastRotateY = needRotateY;
149
127
  }).onStart(function () {
150
128
  css3DObject === null || css3DObject === void 0 ? void 0 : css3DObject.rotateY(startRotateY);
151
129
  render();
152
130
  }).onDispose(function () {
153
131
  var _panelRef$current;
154
-
155
132
  (_panelRef$current = panelRef.current) === null || _panelRef$current === void 0 ? void 0 : _panelRef$current.classList.add('show');
156
- }).play(); // Object.assign(window, { $dispose: () => {
133
+ }).play();
134
+
135
+ // Object.assign(window, { $dispose: () => {
157
136
  // panelRef.current?.classList.add('hide')
158
137
  // setTimeout(() => dispose?.(), 1500)
159
138
  // } })
160
139
 
161
140
  var start = keyframe.start,
162
- end = keyframe.end;
141
+ end = keyframe.end;
163
142
  timeoutRef.current = setTimeout(function () {
164
143
  var _panelRef$current2;
165
-
166
144
  (_panelRef$current2 = panelRef.current) === null || _panelRef$current2 === void 0 ? void 0 : _panelRef$current2.classList.add('hide');
167
145
  timeoutRef.current = setTimeout(function () {
168
146
  dispose === null || dispose === void 0 ? void 0 : dispose();
@@ -170,15 +148,14 @@ function SpatialScenePanel(props) {
170
148
  }, 1500);
171
149
  }, end - start);
172
150
  };
173
-
174
151
  Object.assign(window, {
175
152
  $callback: callback
176
- }); // setTimeout(() => {callback()}, 8000)
153
+ });
177
154
 
155
+ // setTimeout(() => {callback()}, 8000)
178
156
  props.subscribe.on(_VreoUnit.VreoKeyframeEnum.Custom, callback);
179
157
  return function () {
180
158
  props.subscribe.off(_VreoUnit.VreoKeyframeEnum.Custom, callback);
181
-
182
159
  if (timeoutRef.current) {
183
160
  clearTimeout(timeoutRef.current);
184
161
  }
@@ -189,27 +166,22 @@ function SpatialScenePanel(props) {
189
166
  ref: ref
190
167
  });
191
168
  }
192
- /** 背景动画:控制延迟 */
193
-
194
169
 
170
+ /** 背景动画:控制延迟 */
195
171
  function SpatialScenePanelBg() {
196
172
  var ref = React.useRef(null);
197
173
  var timeoutRef = React.useRef(null);
198
174
  React.useEffect(function () {
199
175
  if (!ref.current) return;
200
-
201
176
  var listener = function listener() {
202
177
  var _ref$current;
203
-
204
178
  (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.setAttribute('class', 'SpatialScenePanel-bg');
205
179
  timeoutRef.current = setTimeout(function () {
206
180
  var _ref$current2;
207
-
208
181
  (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.setAttribute('class', 'SpatialScenePanel-bg SpatialScenePanel-bg--animation');
209
182
  timeoutRef.current = null;
210
183
  }, 3000);
211
184
  };
212
-
213
185
  ref.current.addEventListener('animationend', listener);
214
186
  return function () {
215
187
  if (ref.current) ref.current.removeEventListener('animationend', listener);
@@ -221,10 +193,8 @@ function SpatialScenePanelBg() {
221
193
  className: "SpatialScenePanel-bg SpatialScenePanel-bg--animation"
222
194
  });
223
195
  }
224
-
225
196
  var Panel = /*#__PURE__*/React.forwardRef(function (props, myRef) {
226
197
  var _props$data, _props$data2, _props$data3, _props$data3$stateLis;
227
-
228
198
  return /*#__PURE__*/React.createElement("div", {
229
199
  className: "SpatialScenePanel",
230
200
  ref: myRef
@@ -254,8 +224,11 @@ var Panel = /*#__PURE__*/React.forwardRef(function (props, myRef) {
254
224
  }))), /*#__PURE__*/React.createElement("div", {
255
225
  className: "SpatialScenePanel-disappear-area"
256
226
  }));
257
- }); // export function SpatialScenePanel() {
227
+ });
228
+
229
+ // export function SpatialScenePanel() {
258
230
  // // const data = mockData
231
+
259
232
  // return (
260
233
  // <div className="SpatialScenePanel" >
261
234
  // <div className="SpatialScenePanel-show-area">
@@ -274,6 +247,7 @@ var Panel = /*#__PURE__*/React.forwardRef(function (props, myRef) {
274
247
  // ))}
275
248
  // </div>
276
249
  // </div>
250
+
277
251
  // <div className="SpatialScenePanel-disappear-area"></div>
278
252
  // </div>
279
253
  // )