@realsee/vreo 2.6.4-alpha.4 → 2.6.4

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 (31) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/lib/PlayController/createHTMLAudioElement.js +14 -10
  3. package/lib/PlayController/index.js +73 -63
  4. package/lib/Player/Controller.js +56 -50
  5. package/lib/Player/PlaybackLifecycle.js +7 -6
  6. package/lib/Player/custom/SpatialScenePanel/index.js +11 -34
  7. package/lib/Player/index.js +166 -160
  8. package/lib/Player/modules/Drawer/index.js +2 -1
  9. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +157 -146
  10. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +1 -1
  11. package/lib/Player/modules/VideoAgent/index.js +3 -3
  12. package/lib/Player/modules/keyframes/BgMusic/index.js +12 -12
  13. package/lib/Player/modules/keyframes/CameraMovement/index.js +45 -43
  14. package/lib/Player/modules/keyframes/InfoPanel/index.js +8 -8
  15. package/lib/Player/modules/keyframes/ModelVideo/index.js +83 -81
  16. package/lib/Player/modules/keyframes/PanoTag/index.js +1 -1
  17. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +3 -3
  18. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +3 -3
  19. package/lib/Player/modules/keyframes/VideoEffect/index.js +71 -69
  20. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +6 -6
  21. package/lib/fivePlugins/CameraMovementPlugin/index.js +180 -173
  22. package/lib/fivePlugins/CameraMovementPlugin/typings.js +6 -6
  23. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +59 -57
  24. package/lib/react/index.js +1 -1
  25. package/lib/shared-utils/Audio.js +56 -52
  26. package/lib/shared-utils/AudioLike.js +14 -11
  27. package/lib/shared-utils/animationFrame/BetterTween.js +15 -13
  28. package/lib/shared-utils/animationFrame/tween.js +3 -1
  29. package/lib/shared-utils/getMediaInfo.js +1 -0
  30. package/lib/typings/VreoUnit.js +27 -134
  31. package/package.json +3 -3
@@ -4,30 +4,7 @@ import { createRoot } from 'react-dom/client';
4
4
  import { Raycaster, Vector3 } from 'three';
5
5
  import { tweenProgress } from "../../../shared-utils/animationFrame/BetterTween.js";
6
6
  import { CSS3DRenderPlugin } from "../../../fivePlugins/CSS3DRenderPlugin/index.js";
7
- import { VreoKeyframeEnum } from "../../../typings/VreoUnit.js"; // __debug__
8
- // const mockData: SpatialScenePanelData = {
9
- // customType: 'SpatialScenePanel',
10
- // "stateList": [
11
- // {
12
- // "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___fc42f951076607a22fd5c54f005ba553.png",
13
- // "text": "窗帘关闭"
14
- // },
15
- // {
16
- // "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___b331e7ad732debc07250a169a3393b13.png",
17
- // "text": "摄像头休眠"
18
- // },
19
- // {
20
- // "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___2e425a81ac0ad88232d50d4e52a9abfa.png",
21
- // "text": "氛围音乐"
22
- // },
23
- // {
24
- // "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___bff48bb81cde37aa6a319d6f5d56e3a4.png",
25
- // "text": "空调打开"
26
- // }
27
- // ],
28
- // "temperature": "27",
29
- // "title": "沉浸式回家"
30
- // }
7
+ import { VreoKeyframeEnum } from "../../../typings/VreoUnit.js";
31
8
  // const getSphere = (position: Vector3, color = 0xffff00) => {
32
9
  // const geometry = new SphereGeometry(0.05, 32, 16)
33
10
  // const material = new MeshBasicMaterial({ color })
@@ -118,7 +95,7 @@ export function SpatialScenePanel(props) {
118
95
  });
119
96
  if (!container) return;
120
97
  var root = createRoot(container);
121
- root.render(/*#__PURE__*/React.createElement(Panel, {
98
+ root.render( /*#__PURE__*/React.createElement(Panel, {
122
99
  ref: function ref(_ref3) {
123
100
  return panelRef.current = _ref3;
124
101
  },
@@ -130,15 +107,15 @@ export function SpatialScenePanel(props) {
130
107
  var progress = _ref4.progress;
131
108
  var needRotateY = Math.PI / 90 * 11 * progress;
132
109
  var rotateY = needRotateY - lastRotateY;
133
- css3DObject === null || css3DObject === void 0 || css3DObject.rotateY(rotateY);
110
+ css3DObject === null || css3DObject === void 0 ? void 0 : css3DObject.rotateY(rotateY);
134
111
  // css3DObject?.rotateZ
135
112
  lastRotateY = needRotateY;
136
113
  }).onStart(function () {
137
- css3DObject === null || css3DObject === void 0 || css3DObject.rotateY(startRotateY);
114
+ css3DObject === null || css3DObject === void 0 ? void 0 : css3DObject.rotateY(startRotateY);
138
115
  render();
139
116
  }).onDispose(function () {
140
117
  var _panelRef$current;
141
- (_panelRef$current = panelRef.current) === null || _panelRef$current === void 0 || _panelRef$current.classList.add('show');
118
+ (_panelRef$current = panelRef.current) === null || _panelRef$current === void 0 ? void 0 : _panelRef$current.classList.add('show');
142
119
  }).play();
143
120
 
144
121
  // Object.assign(window, { $dispose: () => {
@@ -150,9 +127,9 @@ export function SpatialScenePanel(props) {
150
127
  end = keyframe.end;
151
128
  timeoutRef.current = setTimeout(function () {
152
129
  var _panelRef$current2;
153
- (_panelRef$current2 = panelRef.current) === null || _panelRef$current2 === void 0 || _panelRef$current2.classList.add('hide');
130
+ (_panelRef$current2 = panelRef.current) === null || _panelRef$current2 === void 0 ? void 0 : _panelRef$current2.classList.add('hide');
154
131
  timeoutRef.current = setTimeout(function () {
155
- dispose === null || dispose === void 0 || dispose();
132
+ dispose === null || dispose === void 0 ? void 0 : dispose();
156
133
  timeoutRef.current = null;
157
134
  }, 1500);
158
135
  }, end - start);
@@ -184,10 +161,10 @@ function SpatialScenePanelBg() {
184
161
  if (!ref.current) return;
185
162
  var listener = function listener() {
186
163
  var _ref$current;
187
- (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.setAttribute('class', 'SpatialScenePanel-bg');
164
+ (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.setAttribute('class', 'SpatialScenePanel-bg');
188
165
  timeoutRef.current = setTimeout(function () {
189
166
  var _ref$current2;
190
- (_ref$current2 = ref.current) === null || _ref$current2 === void 0 || _ref$current2.setAttribute('class', 'SpatialScenePanel-bg SpatialScenePanel-bg--animation');
167
+ (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.setAttribute('class', 'SpatialScenePanel-bg SpatialScenePanel-bg--animation');
191
168
  timeoutRef.current = null;
192
169
  }, 3000);
193
170
  };
@@ -203,7 +180,7 @@ function SpatialScenePanelBg() {
203
180
  });
204
181
  }
205
182
  var Panel = /*#__PURE__*/React.forwardRef(function (props, myRef) {
206
- var _props$data, _props$data2, _props$data3;
183
+ var _props$data, _props$data2, _props$data3, _props$data3$stateLis;
207
184
  return /*#__PURE__*/React.createElement("div", {
208
185
  className: "SpatialScenePanel",
209
186
  ref: myRef
@@ -217,7 +194,7 @@ var Panel = /*#__PURE__*/React.forwardRef(function (props, myRef) {
217
194
  className: "SpatialScenePanel-temperature"
218
195
  }, (_props$data2 = props.data) === null || _props$data2 === void 0 ? void 0 : _props$data2.temperature, "\u2103")), /*#__PURE__*/React.createElement("div", {
219
196
  className: "SpatialScenePanel-body"
220
- }, (_props$data3 = props.data) === null || _props$data3 === void 0 || (_props$data3 = _props$data3.stateList) === null || _props$data3 === void 0 ? void 0 : _props$data3.map(function (state, index) {
197
+ }, (_props$data3 = props.data) === null || _props$data3 === void 0 ? void 0 : (_props$data3$stateLis = _props$data3.stateList) === null || _props$data3$stateLis === void 0 ? void 0 : _props$data3$stateLis.map(function (state, index) {
221
198
  return /*#__PURE__*/React.createElement("div", {
222
199
  key: "scene-".concat(state.text),
223
200
  className: "SpatialScenePanel-item index_".concat(index)
@@ -1,15 +1,15 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
5
7
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
6
- import _inherits from "@babel/runtime/helpers/esm/inherits";
7
8
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
9
  var _location$search$matc, _location$search$matc2;
9
- function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
10
- function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
11
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
12
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
11
+ 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); }; }
12
+ 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; } }
13
13
  // 下面这一行不能删
14
14
  import * as React from 'react';
15
15
  import { createRoot } from 'react-dom/client';
@@ -49,6 +49,8 @@ var audioCacheLength = Number((_location$search$matc = (_location$search$matc2 =
49
49
  * ```
50
50
  */
51
51
  export var Player = /*#__PURE__*/function (_Subscribe) {
52
+ _inherits(Player, _Subscribe);
53
+ var _super = _createSuper(Player);
52
54
  /**
53
55
  * 创建 Vreo 播放器实例
54
56
  *
@@ -59,12 +61,10 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
59
61
  var _this;
60
62
  var configs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
61
63
  _classCallCheck(this, Player);
62
- _this = _callSuper(this, Player);
63
- /** Five 渲染引擎实例 */
64
- /** 内部控制器 */
65
- _defineProperty(_this, "disposers", []);
66
- _defineProperty(_this, "loadGeneration", 0);
67
- _defineProperty(_this, "disposed", false);
64
+ _this = _super.call(this);
65
+ _defineProperty(_assertThisInitialized(_this), "disposers", []);
66
+ _defineProperty(_assertThisInitialized(_this), "loadGeneration", 0);
67
+ _defineProperty(_assertThisInitialized(_this), "disposed", false);
68
68
  _this.$five = five;
69
69
  generateBlankAudio(audioCacheLength);
70
70
  if (!configs.container) {
@@ -96,7 +96,7 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
96
96
  configs: _this.configs
97
97
  });
98
98
  _this.root = createRoot(configs.container);
99
- _this.root.render(/*#__PURE__*/React.createElement(ControllerContext.Provider, {
99
+ _this.root.render( /*#__PURE__*/React.createElement(ControllerContext.Provider, {
100
100
  value: _this.controller
101
101
  }, /*#__PURE__*/React.createElement(App, null), /*#__PURE__*/React.createElement(Drawer, null), /*#__PURE__*/React.createElement(PopUp, null), _this.configs.customKeyframes && _this.configs.customKeyframes.map(function (CustomCmpt, key) {
102
102
  return /*#__PURE__*/React.createElement(CustomCmpt, {
@@ -160,18 +160,21 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
160
160
  * await player.load(vreoUnit, 0, false, true)
161
161
  * ```
162
162
  */
163
- _inherits(Player, _Subscribe);
164
- return _createClass(Player, [{
163
+ _createClass(Player, [{
165
164
  key: "getMediaManager",
166
- value: function getMediaManager() {
165
+ value: /** Five 渲染引擎实例 */
166
+
167
+ /** 内部控制器 */
168
+
169
+ function getMediaManager() {
167
170
  var _this$controller$play;
168
171
  return (_this$controller$play = this.controller.playback.capture()) === null || _this$controller$play === void 0 ? void 0 : _this$controller$play.mediaManager;
169
172
  }
170
173
  /** 播放器配置(只读) */
171
174
  }, {
172
175
  key: "load",
173
- value: (function () {
174
- var _load = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(vreoUnit) {
176
+ value: function () {
177
+ var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(vreoUnit) {
175
178
  var _this2 = this;
176
179
  var currentTime,
177
180
  preload,
@@ -181,158 +184,161 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
181
184
  run,
182
185
  valid,
183
186
  _this$controller$vide,
184
- _this$configs$imageOp,
185
187
  _this$controller$vide2,
188
+ _this$configs$imageOp,
186
189
  _this$controller$vide3,
190
+ _this$controller$vide4,
187
191
  panoIndexMap,
188
192
  panoIndexes,
189
193
  i,
190
- _args = arguments,
191
- _t;
192
- return _regenerator().w(function (_context) {
193
- while (1) switch (_context.p = _context.n) {
194
- case 0:
195
- currentTime = _args.length > 1 && _args[1] !== undefined ? _args[1] : 0;
196
- preload = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
197
- force = _args.length > 3 && _args[3] !== undefined ? _args[3] : false;
198
- userAction = _args.length > 4 && _args[4] !== undefined ? _args[4] : false;
199
- generation = ++this.loadGeneration;
200
- this.controller.playback.cancel();
201
- if (!(this.disposed || !this.controller.playback.begin(userAction))) {
202
- _context.n = 1;
203
- break;
204
- }
205
- return _context.a(2, false);
206
- case 1:
207
- run = this.controller.playback.capture();
208
- valid = function valid() {
209
- return run.valid();
210
- };
211
- _context.p = 2;
212
- this.controller.clear();
213
- this.controller.setLoading(true);
214
- if (force) {
215
- vreoUnit = JSON.parse(JSON.stringify(vreoUnit));
216
- }
217
- // if (!this.controller.visible) {
218
- // this.controller.setVisible(true)
219
- // // 延迟 500ms 规避跟 DOM 动画冲突
220
- // await new Promise((resolve) => {
221
- // setTimeout(() => resolve(true), 500)
222
- // })
223
- // }
194
+ _args = arguments;
195
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
196
+ while (1) {
197
+ switch (_context.prev = _context.next) {
198
+ case 0:
199
+ currentTime = _args.length > 1 && _args[1] !== undefined ? _args[1] : 0;
200
+ preload = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
201
+ force = _args.length > 3 && _args[3] !== undefined ? _args[3] : false;
202
+ userAction = _args.length > 4 && _args[4] !== undefined ? _args[4] : false;
203
+ generation = ++this.loadGeneration;
204
+ this.controller.playback.cancel();
205
+ if (!(this.disposed || !this.controller.playback.begin(userAction))) {
206
+ _context.next = 8;
207
+ break;
208
+ }
209
+ return _context.abrupt("return", false);
210
+ case 8:
211
+ run = this.controller.playback.capture();
212
+ valid = function valid() {
213
+ return run.valid();
214
+ };
215
+ _context.prev = 10;
216
+ this.controller.clear();
217
+ this.controller.setLoading(true);
218
+ if (force) {
219
+ vreoUnit = JSON.parse(JSON.stringify(vreoUnit));
220
+ }
221
+ // if (!this.controller.visible) {
222
+ // this.controller.setVisible(true)
223
+ // // 延迟 500ms 规避跟 DOM 动画冲突
224
+ // await new Promise((resolve) => {
225
+ // setTimeout(() => resolve(true), 500)
226
+ // })
227
+ // }
224
228
 
225
- if (this.controller.stopInterval) {
226
- this.controller.stopInterval();
227
- this.controller.stopInterval = undefined;
228
- }
229
- this.controller.vreoUnit = vreoUnit;
230
- (_this$controller$vide = this.controller.videoAgentScene) === null || _this$controller$vide === void 0 || (_this$controller$vide = _this$controller$vide.videoAgentMesh.mediaOperations) === null || _this$controller$vide === void 0 || _this$controller$vide.pause();
229
+ if (this.controller.stopInterval) {
230
+ this.controller.stopInterval();
231
+ this.controller.stopInterval = undefined;
232
+ }
233
+ this.controller.vreoUnit = vreoUnit;
234
+ (_this$controller$vide = this.controller.videoAgentScene) === null || _this$controller$vide === void 0 ? void 0 : (_this$controller$vide2 = _this$controller$vide.videoAgentMesh.mediaOperations) === null || _this$controller$vide2 === void 0 ? void 0 : _this$controller$vide2.pause();
231
235
 
232
- // 预载逻辑
233
- // 是否降低图片分辨率
234
- if (this.$five.imageOptions.size && (_this$configs$imageOp = this.configs.imageOptions) !== null && _this$configs$imageOp !== void 0 && _this$configs$imageOp.size && this.$five.imageOptions.size > this.configs.imageOptions.size) {
235
- this.$five.imageOptions.size = this.configs.imageOptions.size;
236
- }
236
+ // 预载逻辑
237
+ // 是否降低图片分辨率
238
+ if (this.$five.imageOptions.size && (_this$configs$imageOp = this.configs.imageOptions) !== null && _this$configs$imageOp !== void 0 && _this$configs$imageOp.size && this.$five.imageOptions.size > this.configs.imageOptions.size) {
239
+ this.$five.imageOptions.size = this.configs.imageOptions.size;
240
+ }
237
241
 
238
- // 预载数据中的点位
239
- if (!(preload || preload === undefined && this.configs.autoPreload)) {
240
- _context.n = 6;
241
- break;
242
- }
243
- panoIndexMap = vreoUnit.keyframes.filter(function (vreoKeyframe) {
244
- if (vreoKeyframe.type !== VreoKeyframeEnum.CameraMovement) {
245
- return false;
242
+ // 预载数据中的点位
243
+ if (!(preload || preload === undefined && this.configs.autoPreload)) {
244
+ _context.next = 30;
245
+ break;
246
246
  }
247
- var data = vreoKeyframe.data;
248
- if (data.panoIndex === undefined) {
249
- return false;
247
+ panoIndexMap = vreoUnit.keyframes.filter(function (vreoKeyframe) {
248
+ if (vreoKeyframe.type !== VreoKeyframeEnum.CameraMovement) {
249
+ return false;
250
+ }
251
+ var data = vreoKeyframe.data;
252
+ if (data.panoIndex === undefined) {
253
+ return false;
254
+ }
255
+ return true;
256
+ }).reduce(function (accu, curr) {
257
+ var panoIndex = curr.data.panoIndex;
258
+ if (!accu[panoIndex]) {
259
+ accu[panoIndex] = true;
260
+ }
261
+ return accu;
262
+ }, {});
263
+ panoIndexes = Object.keys(panoIndexMap);
264
+ i = 0;
265
+ case 22:
266
+ if (!(i < panoIndexes.length)) {
267
+ _context.next = 30;
268
+ break;
250
269
  }
251
- return true;
252
- }).reduce(function (accu, curr) {
253
- var panoIndex = curr.data.panoIndex;
254
- if (!accu[panoIndex]) {
255
- accu[panoIndex] = true;
270
+ _context.next = 25;
271
+ return this.$five.preloadPano(Number(panoIndexes[i]));
272
+ case 25:
273
+ if (!(!valid() || generation !== this.loadGeneration)) {
274
+ _context.next = 27;
275
+ break;
256
276
  }
257
- return accu;
258
- }, {});
259
- panoIndexes = Object.keys(panoIndexMap);
260
- i = 0;
261
- case 3:
262
- if (!(i < panoIndexes.length)) {
263
- _context.n = 6;
264
- break;
265
- }
266
- _context.n = 4;
267
- return this.$five.preloadPano(Number(panoIndexes[i]));
268
- case 4:
269
- if (!(!valid() || generation !== this.loadGeneration)) {
270
- _context.n = 5;
271
- break;
272
- }
273
- return _context.a(2, false);
274
- case 5:
275
- i++;
276
- _context.n = 3;
277
- break;
278
- case 6:
279
- // 新数据载入就绪
280
- this.emit('loaded', vreoUnit);
281
- this.controller.emit('loaded', vreoUnit);
282
- if (!(!valid() || generation !== this.loadGeneration)) {
283
- _context.n = 7;
284
- break;
285
- }
286
- return _context.a(2, false);
287
- case 7:
288
- if ((_this$controller$vide2 = this.controller.videoAgentScene) !== null && _this$controller$vide2 !== void 0 && _this$controller$vide2.videoAgentMesh.mediaOperations) {
289
- this.controller.videoAgentScene.videoAgentMesh.mediaOperations.currentTime = currentTime / 1000;
290
- }
291
- this.controller.setAvatar(vreoUnit.video.avatar);
292
- _context.n = 8;
293
- return waitForBlankAudioGenerated();
294
- case 8:
295
- if (!(!valid() || generation !== this.loadGeneration)) {
296
- _context.n = 9;
297
- break;
298
- }
299
- return _context.a(2, false);
300
- case 9:
301
- _context.n = 10;
302
- return (_this$controller$vide3 = this.controller.videoAgentScene) === null || _this$controller$vide3 === void 0 ? void 0 : _this$controller$vide3.videoAgentMesh.play(vreoUnit.video.url, currentTime / 1000, vreoUnit.video.duration);
303
- case 10:
304
- if (!(!valid() || generation !== this.loadGeneration)) {
305
- _context.n = 11;
277
+ return _context.abrupt("return", false);
278
+ case 27:
279
+ i++;
280
+ _context.next = 22;
306
281
  break;
307
- }
308
- return _context.a(2, false);
309
- case 11:
310
- this.controller.setEnded(false);
311
- this.play(undefined, userAction);
312
- this.controller.run(function (type, keyframe) {
313
- return _this2.emit(type, keyframe, _this2.controller.currentTime);
314
- });
315
- this.controller.setLoading(false);
316
- return _context.a(2, true);
317
- case 12:
318
- _context.p = 12;
319
- _t = _context.v;
320
- if (valid()) {
321
- _context.n = 13;
322
- break;
323
- }
324
- return _context.a(2, false);
325
- case 13:
326
- this.controller.playback.cancel();
327
- throw _t;
328
- case 14:
329
- _context.p = 14;
330
- if (generation === this.loadGeneration) this.controller.setLoading(false);
331
- return _context.f(14);
332
- case 15:
333
- return _context.a(2);
282
+ case 30:
283
+ // 新数据载入就绪
284
+ this.emit('loaded', vreoUnit);
285
+ this.controller.emit('loaded', vreoUnit);
286
+ if (!(!valid() || generation !== this.loadGeneration)) {
287
+ _context.next = 34;
288
+ break;
289
+ }
290
+ return _context.abrupt("return", false);
291
+ case 34:
292
+ if ((_this$controller$vide3 = this.controller.videoAgentScene) !== null && _this$controller$vide3 !== void 0 && _this$controller$vide3.videoAgentMesh.mediaOperations) {
293
+ this.controller.videoAgentScene.videoAgentMesh.mediaOperations.currentTime = currentTime / 1000;
294
+ }
295
+ this.controller.setAvatar(vreoUnit.video.avatar);
296
+ _context.next = 38;
297
+ return waitForBlankAudioGenerated();
298
+ case 38:
299
+ if (!(!valid() || generation !== this.loadGeneration)) {
300
+ _context.next = 40;
301
+ break;
302
+ }
303
+ return _context.abrupt("return", false);
304
+ case 40:
305
+ _context.next = 42;
306
+ return (_this$controller$vide4 = this.controller.videoAgentScene) === null || _this$controller$vide4 === void 0 ? void 0 : _this$controller$vide4.videoAgentMesh.play(vreoUnit.video.url, currentTime / 1000, vreoUnit.video.duration);
307
+ case 42:
308
+ if (!(!valid() || generation !== this.loadGeneration)) {
309
+ _context.next = 44;
310
+ break;
311
+ }
312
+ return _context.abrupt("return", false);
313
+ case 44:
314
+ this.controller.setEnded(false);
315
+ this.play(undefined, userAction);
316
+ this.controller.run(function (type, keyframe) {
317
+ return _this2.emit(type, keyframe, _this2.controller.currentTime);
318
+ });
319
+ this.controller.setLoading(false);
320
+ return _context.abrupt("return", true);
321
+ case 51:
322
+ _context.prev = 51;
323
+ _context.t0 = _context["catch"](10);
324
+ if (valid()) {
325
+ _context.next = 55;
326
+ break;
327
+ }
328
+ return _context.abrupt("return", false);
329
+ case 55:
330
+ this.controller.playback.cancel();
331
+ throw _context.t0;
332
+ case 57:
333
+ _context.prev = 57;
334
+ if (generation === this.loadGeneration) this.controller.setLoading(false);
335
+ return _context.finish(57);
336
+ case 60:
337
+ case "end":
338
+ return _context.stop();
339
+ }
334
340
  }
335
- }, _callee, this, [[2, 12, 14, 15]]);
341
+ }, _callee, this, [[10, 51, 57, 60]]);
336
342
  }));
337
343
  function load(_x) {
338
344
  return _load.apply(this, arguments);
@@ -343,7 +349,6 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
343
349
  * 获取播放器是否处于暂停状态
344
350
  * @returns 是否暂停中
345
351
  */
346
- )
347
352
  }, {
348
353
  key: "paused",
349
354
  get: function get() {
@@ -368,11 +373,11 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
368
373
  }, {
369
374
  key: "play",
370
375
  value: function play(currentTime) {
371
- var _this$controller$vide4, _this$controller$vreo;
376
+ var _this$controller$vide5, _this$controller$vreo;
372
377
  var userAction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
373
378
  if (this.disposed || !this.controller.playback.begin(userAction)) return false;
374
379
  if (this.controller.playing) return true;
375
- if (currentTime && (_this$controller$vide4 = this.controller.videoAgentScene) !== null && _this$controller$vide4 !== void 0 && _this$controller$vide4.videoAgentMesh.mediaOperations) {
380
+ if (currentTime && (_this$controller$vide5 = this.controller.videoAgentScene) !== null && _this$controller$vide5 !== void 0 && _this$controller$vide5.videoAgentMesh.mediaOperations) {
376
381
  this.controller.videoAgentScene.videoAgentMesh.mediaOperations.currentTime = currentTime / 1000;
377
382
  }
378
383
  Object.assign(window, {
@@ -380,7 +385,7 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
380
385
  });
381
386
  this.controller.setEnded(false);
382
387
  this.controller.setPlaying(true);
383
- (_this$controller$vreo = this.controller.vreoUnit) === null || _this$controller$vreo === void 0 || _this$controller$vreo.keyframes.forEach(function (keyframe) {
388
+ (_this$controller$vreo = this.controller.vreoUnit) === null || _this$controller$vreo === void 0 ? void 0 : _this$controller$vreo.keyframes.forEach(function (keyframe) {
384
389
  if (keyframe.type === VreoKeyframeEnum.BgMusic) {
385
390
  keyframe.parsed = false;
386
391
  }
@@ -462,6 +467,7 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
462
467
  this.root.unmount();
463
468
  }
464
469
  }]);
470
+ return Player;
465
471
  }(Subscribe);
466
472
 
467
473
  // 导出自定义组件
@@ -6,7 +6,8 @@ var DrawerView = observer(function (_ref) {
6
6
  var _controller$drawerCon2;
7
7
  var controller = _ref.controller;
8
8
  var maxHeight = '400px';
9
- var height = function (_controller$drawerCon) {
9
+ var height = function () {
10
+ var _controller$drawerCon;
10
11
  var height = (_controller$drawerCon = controller.drawerConfig) === null || _controller$drawerCon === void 0 ? void 0 : _controller$drawerCon.height;
11
12
  if (!height) {
12
13
  return 'max-content';