@realsee/vreo 2.4.0 → 2.4.1

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 (79) hide show
  1. package/lib/PlayController/createHTMLAudioElement.js +12 -22
  2. package/lib/PlayController/index.js +70 -137
  3. package/lib/Player/App.d.ts +2 -2
  4. package/lib/Player/App.js +1 -28
  5. package/lib/Player/Controller.d.ts +3 -3
  6. package/lib/Player/Controller.js +46 -110
  7. package/lib/Player/custom/SpatialScenePanel/index.d.ts +2 -2
  8. package/lib/Player/custom/SpatialScenePanel/index.js +75 -72
  9. package/lib/Player/hooks.d.ts +3 -3
  10. package/lib/Player/hooks.js +0 -10
  11. package/lib/Player/index.js +109 -175
  12. package/lib/Player/modules/Drawer/index.d.ts +2 -2
  13. package/lib/Player/modules/Drawer/index.js +2 -21
  14. package/lib/Player/modules/PopUp/index.d.ts +2 -2
  15. package/lib/Player/modules/PopUp/index.js +1 -12
  16. package/lib/Player/modules/ResizeObserver/index.d.ts +2 -2
  17. package/lib/Player/modules/ResizeObserver/index.js +0 -8
  18. package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +1 -1
  19. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +148 -247
  20. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +7 -23
  21. package/lib/Player/modules/VideoAgent/index.d.ts +2 -2
  22. package/lib/Player/modules/VideoAgent/index.js +2 -20
  23. package/lib/Player/modules/Wave/index.d.ts +2 -2
  24. package/lib/Player/modules/Wave/index.js +12 -34
  25. package/lib/Player/modules/keyframes/BgMusic/index.d.ts +2 -2
  26. package/lib/Player/modules/keyframes/BgMusic/index.js +41 -64
  27. package/lib/Player/modules/keyframes/CameraMovement/index.d.ts +2 -2
  28. package/lib/Player/modules/keyframes/CameraMovement/index.js +42 -71
  29. package/lib/Player/modules/keyframes/InfoPanel/index.d.ts +2 -2
  30. package/lib/Player/modules/keyframes/InfoPanel/index.js +16 -47
  31. package/lib/Player/modules/keyframes/ModelVideo/index.d.ts +2 -2
  32. package/lib/Player/modules/keyframes/ModelVideo/index.js +52 -83
  33. package/lib/Player/modules/keyframes/PanoEffect/index.d.ts +2 -2
  34. package/lib/Player/modules/keyframes/PanoEffect/index.js +16 -40
  35. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +1 -9
  36. package/lib/Player/modules/keyframes/PanoTag/index.d.ts +1 -1
  37. package/lib/Player/modules/keyframes/PanoTag/index.js +6 -25
  38. package/lib/Player/modules/keyframes/PanoTextLabel/index.d.ts +2 -2
  39. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +31 -50
  40. package/lib/Player/modules/keyframes/Prompter/index.d.ts +2 -2
  41. package/lib/Player/modules/keyframes/Prompter/index.js +11 -29
  42. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.d.ts +2 -2
  43. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +25 -29
  44. package/lib/Player/modules/keyframes/VideoEffect/index.d.ts +2 -2
  45. package/lib/Player/modules/keyframes/VideoEffect/index.js +52 -87
  46. package/lib/Player/typings.d.ts +7 -4
  47. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +0 -2
  48. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +0 -1
  49. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +0 -1
  50. package/lib/fivePlugins/CSS3DRenderPlugin/index.d.ts +1 -1
  51. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +42 -81
  52. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +3 -7
  53. package/lib/fivePlugins/CameraMovementPlugin/index.js +181 -241
  54. package/lib/fivePlugins/CameraMovementPlugin/typings.d.ts +4 -4
  55. package/lib/fivePlugins/CameraMovementPlugin/typings.js +6 -12
  56. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +37 -87
  57. package/lib/index.js +0 -1
  58. package/lib/react/index.d.ts +2 -1
  59. package/lib/react/index.js +10 -35
  60. package/lib/shared-utils/Audio.js +57 -106
  61. package/lib/shared-utils/AudioLike.d.ts +1 -1
  62. package/lib/shared-utils/AudioLike.js +19 -46
  63. package/lib/shared-utils/Preloader.js +2 -10
  64. package/lib/shared-utils/addResizeListener.d.ts +1 -1
  65. package/lib/shared-utils/addResizeListener.js +0 -5
  66. package/lib/shared-utils/animationFrame/BetterTween.d.ts +1 -1
  67. package/lib/shared-utils/animationFrame/BetterTween.js +14 -45
  68. package/lib/shared-utils/animationFrame/index.d.ts +1 -2
  69. package/lib/shared-utils/animationFrame/index.js +3 -12
  70. package/lib/shared-utils/animationFrame/tween.d.ts +2 -2
  71. package/lib/shared-utils/animationFrame/tween.js +3 -14
  72. package/lib/shared-utils/createTransMatrix.js +1 -10
  73. package/lib/shared-utils/getFileExpandedName.js +0 -1
  74. package/lib/shared-utils/getMediaInfo.d.ts +3 -3
  75. package/lib/shared-utils/getMediaInfo.js +0 -10
  76. package/lib/shared-utils/setElementDataset.js +0 -2
  77. package/lib/typings/VreoUnit.d.ts +16 -16
  78. package/lib/typings/VreoUnit.js +115 -47
  79. package/package.json +3 -2
@@ -1,93 +1,63 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.ControllerContext = exports.Controller = void 0;
11
-
12
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
-
14
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
-
16
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
-
18
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
19
-
20
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
21
-
22
12
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
23
-
24
13
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
25
-
14
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
26
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
27
-
28
16
  var _five = require("@realsee/five");
29
-
30
17
  var _mobx = require("mobx");
31
-
32
18
  var React = _interopRequireWildcard(require("react"));
33
-
34
19
  var _animationFrame = require("../shared-utils/animationFrame");
35
-
36
20
  var _VreoUnit = require("../typings/VreoUnit");
37
-
38
21
  var _setElementDataset = _interopRequireDefault(require("../shared-utils/setElementDataset"));
39
-
40
22
  var _getMediaInfo = require("../shared-utils/getMediaInfo");
41
-
42
- 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); }
43
-
44
- 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; }
45
-
46
- 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; }
47
-
48
- 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) { (0, _defineProperty2["default"])(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; }
49
-
50
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
51
-
52
- 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; } }
53
-
23
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
24
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
25
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
26
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
27
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
54
28
  /**
55
29
  * 逻辑控制器:内部状态。
56
30
  */
57
- var Controller = /*#__PURE__*/function (_Subscribe) {
58
- (0, _inherits2["default"])(Controller, _Subscribe);
59
-
60
- var _super = _createSuper(Controller);
61
-
31
+ var Controller = exports.Controller = /*#__PURE__*/function (_Subscribe) {
62
32
  function Controller(_ref) {
63
33
  var _this;
64
-
65
34
  var five = _ref.five,
66
- container = _ref.container,
67
- configs = _ref.configs;
35
+ container = _ref.container,
36
+ configs = _ref.configs;
68
37
  (0, _classCallCheck2["default"])(this, Controller);
69
- _this = _super.call(this);
70
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "playing", false);
71
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "ended", false);
72
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "loading", false);
73
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "containerSize", {
38
+ _this = _callSuper(this, Controller);
39
+ (0, _defineProperty2["default"])(_this, "playing", false);
40
+ (0, _defineProperty2["default"])(_this, "ended", false);
41
+ (0, _defineProperty2["default"])(_this, "loading", false);
42
+ // null 表示加载失败
43
+ (0, _defineProperty2["default"])(_this, "containerSize", {
74
44
  width: 0,
75
45
  height: 0
76
46
  });
77
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "waveAppearance", null);
78
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "appearance", {
47
+ (0, _defineProperty2["default"])(_this, "waveAppearance", null);
48
+ (0, _defineProperty2["default"])(_this, "appearance", {
79
49
  waveStyle: 'wave'
80
50
  });
81
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "avatar", {});
82
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "visible", false);
83
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "popUp", null);
84
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "drawerConfig", null);
51
+ (0, _defineProperty2["default"])(_this, "avatar", {});
52
+ (0, _defineProperty2["default"])(_this, "visible", false);
53
+ (0, _defineProperty2["default"])(_this, "popUp", null);
54
+ (0, _defineProperty2["default"])(_this, "drawerConfig", null);
85
55
  _this.configs = configs;
86
56
  _this.container = container;
87
57
  _this.five = five;
88
58
  _this.appSize = configs.appSize;
89
59
  _this.appearance = _objectSpread(_objectSpread({}, _this.appearance), configs.appearance);
90
- (0, _mobx.makeObservable)((0, _assertThisInitialized2["default"])(_this), {
60
+ (0, _mobx.makeObservable)(_this, {
91
61
  visible: _mobx.observable,
92
62
  setVisible: _mobx.action,
93
63
  playing: _mobx.observable,
@@ -114,20 +84,17 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
114
84
  return [_this.appearance.waveStyle, _this.loading];
115
85
  }, function (_ref2) {
116
86
  var _ref3 = (0, _slicedToArray2["default"])(_ref2, 2),
117
- waveStyle = _ref3[0],
118
- loading = _ref3[1];
119
-
87
+ waveStyle = _ref3[0],
88
+ loading = _ref3[1];
120
89
  if (loading === null) {
121
90
  _this.waveAppearance = null;
122
91
  return;
123
92
  }
124
-
125
93
  if (waveStyle === 'wave') {
126
94
  switch (loading) {
127
95
  case true:
128
96
  _this.waveAppearance = 'double';
129
97
  break;
130
-
131
98
  case false:
132
99
  _this.waveAppearance = 'solid';
133
100
  break;
@@ -137,7 +104,6 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
137
104
  case true:
138
105
  _this.waveAppearance = 'swap';
139
106
  break;
140
-
141
107
  case false:
142
108
  _this.waveAppearance = 'expand';
143
109
  break;
@@ -146,7 +112,6 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
146
112
  }, {
147
113
  fireImmediately: true
148
114
  });
149
-
150
115
  if (!_this.appSize) {
151
116
  (0, _mobx.reaction)(function () {
152
117
  return _this.containerSize;
@@ -154,19 +119,16 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
154
119
  if (!(containerSize !== null && containerSize !== void 0 && containerSize.width)) return;
155
120
  var width = containerSize.width;
156
121
  var height = containerSize.height;
157
-
158
122
  var size = function () {
159
123
  if (width <= 500) return 'S';
160
124
  if (width <= 1024) return 'M';
161
125
  if (width <= 2048) return 'L';
162
126
  return 'XL';
163
127
  }();
164
-
165
128
  var orientation = function () {
166
129
  if (height > width) return 'portrait';
167
130
  return 'landscape';
168
131
  }();
169
-
170
132
  (0, _setElementDataset["default"])(_this.container, {
171
133
  size: size
172
134
  });
@@ -180,9 +142,9 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
180
142
  (0, _setElementDataset["default"])(_this.container, {
181
143
  size: _this.appSize
182
144
  });
183
- } // 监听播放情况:抛出触发时机
184
-
145
+ }
185
146
 
147
+ // 监听播放情况:抛出触发时机
186
148
  (0, _mobx.reaction)(function () {
187
149
  return _this.ended;
188
150
  }, function (ended) {
@@ -199,13 +161,11 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
199
161
  });
200
162
  return _this;
201
163
  }
202
-
203
- (0, _createClass2["default"])(Controller, [{
164
+ (0, _inherits2["default"])(Controller, _Subscribe);
165
+ return (0, _createClass2["default"])(Controller, [{
204
166
  key: "agentType",
205
- get: // null 表示加载失败
206
- function get() {
167
+ get: function get() {
207
168
  var _this$videoAgentScene, _this$avatar;
208
-
209
169
  var type = (0, _getMediaInfo.getMediaType)((_this$videoAgentScene = this.videoAgentScene) === null || _this$videoAgentScene === void 0 ? void 0 : _this$videoAgentScene.videoAgentMesh.videoUrl);
210
170
  if ((_this$avatar = this.avatar) !== null && _this$avatar !== void 0 && _this$avatar.force) return 'avatar';
211
171
  if (type === 'video') return 'video';
@@ -218,7 +178,6 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
218
178
  this.popUp = null;
219
179
  return;
220
180
  }
221
-
222
181
  this.popUp = popUp;
223
182
  }
224
183
  }, {
@@ -264,14 +223,12 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
264
223
  value: function openDrawer(drawerConfig) {
265
224
  if (!drawerConfig) {
266
225
  var _this$drawerConfig;
267
-
268
226
  this.drawerConfig = {
269
227
  content: '',
270
228
  height: (_this$drawerConfig = this.drawerConfig) === null || _this$drawerConfig === void 0 ? void 0 : _this$drawerConfig.height
271
229
  };
272
230
  return;
273
231
  }
274
-
275
232
  this.drawerConfig = drawerConfig;
276
233
  }
277
234
  }, {
@@ -283,25 +240,23 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
283
240
  key: "currentTime",
284
241
  get: function get() {
285
242
  var _this$videoAgentScene2;
286
-
287
243
  return ((_this$videoAgentScene2 = this.videoAgentScene) === null || _this$videoAgentScene2 === void 0 ? void 0 : _this$videoAgentScene2.videoAgentMesh.currentTime) || 0;
288
244
  }
289
245
  }, {
290
246
  key: "currentKeyframes",
291
247
  get: function get() {
292
248
  var _this2 = this;
293
-
294
249
  if (!this.vreoUnit) return [];
295
- var keyframes = this.vreoUnit.keyframes; // 没有被解析过且开始时间低于当前时间戳 100ms
296
-
250
+ var keyframes = this.vreoUnit.keyframes;
251
+ // 没有被解析过且开始时间低于当前时间戳 100ms
297
252
  return keyframes.filter(function (keyframe) {
298
- if (keyframe.parsed) return false; // 检测结束时间
299
-
300
- if (keyframe.end < _this2.currentTime) return false; // 检测开始时间
301
-
253
+ if (keyframe.parsed) return false;
254
+ // 检测结束时间
255
+ if (keyframe.end < _this2.currentTime) return false;
256
+ // 检测开始时间
302
257
  if (keyframe.start > _this2.currentTime) return false;
303
- if (keyframe.type === _VreoUnit.VreoKeyframeEnum.BgMusic) return true; // 开始时间低于当前时间戳 100ms
304
-
258
+ if (keyframe.type === _VreoUnit.VreoKeyframeEnum.BgMusic) return true;
259
+ // 开始时间低于当前时间戳 100ms
305
260
  var dur = _this2.currentTime - keyframe.start;
306
261
  return dur <= 100 && dur >= 0;
307
262
  });
@@ -310,25 +265,22 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
310
265
  key: "mediaInstance",
311
266
  get: function get() {
312
267
  var _this$videoAgentScene3;
313
-
314
268
  return (_this$videoAgentScene3 = this.videoAgentScene) === null || _this$videoAgentScene3 === void 0 ? void 0 : _this$videoAgentScene3.videoAgentMesh.mediaInstance;
315
269
  }
270
+
316
271
  /**
317
272
  * 逐帧任务
318
273
  */
319
-
320
274
  }, {
321
275
  key: "requestAnimationFrameLoop",
322
276
  value: function requestAnimationFrameLoop(callback) {
323
277
  var _this$mediaInstance,
324
- _this$mediaInstance4,
325
- _this3 = this;
326
-
278
+ _this$mediaInstance4,
279
+ _this3 = this;
327
280
  if ((_this$mediaInstance = this.mediaInstance) !== null && _this$mediaInstance !== void 0 && _this$mediaInstance.ended && this.mediaInstance.currentTime !== 0) {
328
281
  var _this$vreoUnit;
329
-
330
282
  if (this.ended) return;
331
- (_this$vreoUnit = this.vreoUnit) === null || _this$vreoUnit === void 0 ? void 0 : _this$vreoUnit.keyframes.forEach(function (keyframe) {
283
+ (_this$vreoUnit = this.vreoUnit) === null || _this$vreoUnit === void 0 || _this$vreoUnit.keyframes.forEach(function (keyframe) {
332
284
  return keyframe.parsed = false;
333
285
  });
334
286
  this.setEnded(true);
@@ -337,30 +289,22 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
337
289
  this.mediaInstance.currentTime = 0;
338
290
  return;
339
291
  }
340
-
341
292
  if (!this.playing) {
342
293
  var _this$mediaInstance2;
343
-
344
294
  if (!((_this$mediaInstance2 = this.mediaInstance) !== null && _this$mediaInstance2 !== void 0 && _this$mediaInstance2.paused)) {
345
295
  var _this$mediaInstance3;
346
-
347
- (_this$mediaInstance3 = this.mediaInstance) === null || _this$mediaInstance3 === void 0 ? void 0 : _this$mediaInstance3.pause();
296
+ (_this$mediaInstance3 = this.mediaInstance) === null || _this$mediaInstance3 === void 0 || _this$mediaInstance3.pause();
348
297
  }
349
-
350
298
  return;
351
299
  }
352
-
353
300
  if ((_this$mediaInstance4 = this.mediaInstance) !== null && _this$mediaInstance4 !== void 0 && _this$mediaInstance4.paused && this.playing) {
354
301
  this.mediaInstance.play();
355
302
  }
356
-
357
303
  var currentKeyframes = this.currentKeyframes;
358
304
  currentKeyframes.forEach(function (keyframe) {
359
305
  if (keyframe.parsed) return;
360
306
  keyframe.parsed = true;
361
-
362
307
  _this3.emit(keyframe.type, keyframe, _this3.currentTime);
363
-
364
308
  if (callback) {
365
309
  callback(keyframe.type, keyframe, _this3.currentTime);
366
310
  }
@@ -370,7 +314,6 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
370
314
  key: "run",
371
315
  value: function run(callback) {
372
316
  var _this4 = this;
373
-
374
317
  if (this.stopInterval) return;
375
318
  this.stopInterval = (0, _animationFrame.requestAnimationFrameInterval)(function () {
376
319
  return _this4.requestAnimationFrameLoop(callback);
@@ -380,23 +323,20 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
380
323
  key: "clear",
381
324
  value: function clear() {
382
325
  var _this$vreoUnit2, _this$stopInterval;
383
-
384
326
  this.setPlaying(false);
385
- (_this$vreoUnit2 = this.vreoUnit) === null || _this$vreoUnit2 === void 0 ? void 0 : _this$vreoUnit2.keyframes.forEach(function (keyframe) {
327
+ (_this$vreoUnit2 = this.vreoUnit) === null || _this$vreoUnit2 === void 0 || _this$vreoUnit2.keyframes.forEach(function (keyframe) {
386
328
  return keyframe.parsed = false;
387
329
  });
330
+
388
331
  /**
389
332
  * 清理掉数据
390
333
  */
391
-
392
334
  this.vreoUnit = undefined;
393
-
394
335
  if (this.mediaInstance) {
395
336
  this.mediaInstance.pause();
396
337
  this.mediaInstance.currentTime = 0;
397
338
  }
398
-
399
- (_this$stopInterval = this.stopInterval) === null || _this$stopInterval === void 0 ? void 0 : _this$stopInterval.call(this);
339
+ (_this$stopInterval = this.stopInterval) === null || _this$stopInterval === void 0 || _this$stopInterval.call(this);
400
340
  this.stopInterval = undefined;
401
341
  }
402
342
  }, {
@@ -405,9 +345,5 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
405
345
  this.clear();
406
346
  }
407
347
  }]);
408
- return Controller;
409
348
  }(_five.Subscribe);
410
-
411
- exports.Controller = Controller;
412
- var ControllerContext = /*#__PURE__*/React.createContext(null);
413
- exports.ControllerContext = ControllerContext;
349
+ var ControllerContext = exports.ControllerContext = /*#__PURE__*/React.createContext(null);
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { CustomVreoKeyframeProps } from '../../typings';
3
3
  export interface SpatialScenePanelData {
4
4
  customType: 'SpatialScenePanel';
@@ -19,4 +19,4 @@ export interface SpatialScenePanelData {
19
19
  * 空间场景面板
20
20
  * @returns
21
21
  */
22
- export declare function SpatialScenePanel(props: CustomVreoKeyframeProps): JSX.Element;
22
+ export declare function SpatialScenePanel(props: CustomVreoKeyframeProps): React.JSX.Element;