@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
@@ -1,6 +1,5 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
- 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 }; })(); }
3
- 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); }
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
3
  import { Five } from '@realsee/five';
5
4
  import { Rotation } from "./typings.js";
6
5
  var PI = Math.PI;
@@ -29,83 +28,86 @@ export var CameraMovementPlugin = function CameraMovementPlugin(five) {
29
28
  var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
30
29
  preload: true
31
30
  };
32
- return new Promise(/*#__PURE__*/function () {
33
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(resolve, reject) {
31
+ return new Promise( /*#__PURE__*/function () {
32
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(resolve, reject) {
34
33
  var _opts$asyncEndCallbac;
35
34
  var panoIndex, start, movePanoOptions;
36
- return _regenerator().w(function (_context) {
37
- while (1) switch (_context.n) {
38
- case 0:
39
- moving = true;
40
- if (opts.asyncStartCallback) {
41
- opts.asyncStartCallback();
42
- }
43
- if (!(five.panoIndex === undefined)) {
44
- _context.n = 1;
45
- break;
46
- }
47
- return _context.a(2, reject(false));
48
- case 1:
49
- if (!(args.mode && args.mode !== five.currentMode)) {
50
- _context.n = 3;
51
- break;
52
- }
53
- _context.n = 2;
54
- return five.changeMode(args.mode, args, duration);
55
- case 2:
56
- return _context.a(2, resolve(true));
57
- case 3:
58
- if (!(args.mode === Five.Mode.Floorplan)) {
59
- _context.n = 4;
60
- break;
61
- }
62
- return _context.a(2, resolve(true));
63
- case 4:
64
- if (!(opts.preload && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
65
- _context.n = 5;
66
- break;
67
- }
68
- _context.n = 5;
69
- return five.preloadPano(args.panoIndex);
70
- case 5:
71
- (_opts$asyncEndCallbac = opts.asyncEndCallback) === null || _opts$asyncEndCallbac === void 0 || _opts$asyncEndCallbac.call(opts);
72
- if (!(args.panoIndex === undefined && args.fov === undefined && args.latitude === undefined && args.longitude === undefined)) {
73
- _context.n = 6;
35
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
36
+ while (1) {
37
+ switch (_context.prev = _context.next) {
38
+ case 0:
39
+ moving = true;
40
+ if (opts.asyncStartCallback) {
41
+ opts.asyncStartCallback();
42
+ }
43
+ if (!(five.panoIndex === undefined)) {
44
+ _context.next = 4;
45
+ break;
46
+ }
47
+ return _context.abrupt("return", reject(false));
48
+ case 4:
49
+ if (!(args.mode && args.mode !== five.currentMode)) {
50
+ _context.next = 8;
51
+ break;
52
+ }
53
+ _context.next = 7;
54
+ return five.changeMode(args.mode, args, duration);
55
+ case 7:
56
+ return _context.abrupt("return", resolve(true));
57
+ case 8:
58
+ if (!(args.mode === Five.Mode.Floorplan)) {
59
+ _context.next = 10;
60
+ break;
61
+ }
62
+ return _context.abrupt("return", resolve(true));
63
+ case 10:
64
+ if (!(opts.preload && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
65
+ _context.next = 13;
66
+ break;
67
+ }
68
+ _context.next = 13;
69
+ return five.preloadPano(args.panoIndex);
70
+ case 13:
71
+ (_opts$asyncEndCallbac = opts.asyncEndCallback) === null || _opts$asyncEndCallbac === void 0 ? void 0 : _opts$asyncEndCallbac.call(opts);
72
+ if (!(args.panoIndex === undefined && args.fov === undefined && args.latitude === undefined && args.longitude === undefined)) {
73
+ _context.next = 16;
74
+ break;
75
+ }
76
+ return _context.abrupt("return", resolve(true));
77
+ case 16:
78
+ panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex;
79
+ if (!(panoIndex !== undefined)) {
80
+ _context.next = 26;
81
+ break;
82
+ }
83
+ start = performance.now();
84
+ _context.next = 21;
85
+ return five.ready();
86
+ case 21:
87
+ movePanoOptions = Object.assign({}, args, {
88
+ duration: duration - (performance.now() - start),
89
+ // 移动耗时
90
+ moveEndCallback: function moveEndCallback() {
91
+ return resolve(true);
92
+ },
93
+ // 移动结束
94
+ moveCancelCallback: function moveCancelCallback() {
95
+ resolve(true);
96
+ },
97
+ // 移动开始
98
+ effect: args.transEffect || 'fly'
99
+ });
100
+ _context.next = 24;
101
+ return five.moveToPano(panoIndex, movePanoOptions);
102
+ case 24:
103
+ _context.next = 27;
74
104
  break;
75
- }
76
- return _context.a(2, resolve(true));
77
- case 6:
78
- panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex;
79
- if (!(panoIndex !== undefined)) {
80
- _context.n = 9;
81
- break;
82
- }
83
- start = performance.now();
84
- _context.n = 7;
85
- return five.ready();
86
- case 7:
87
- movePanoOptions = Object.assign({}, args, {
88
- duration: duration - (performance.now() - start),
89
- // 移动耗时
90
- moveEndCallback: function moveEndCallback() {
91
- return resolve(true);
92
- },
93
- // 移动结束
94
- moveCancelCallback: function moveCancelCallback() {
95
- resolve(true);
96
- },
97
- // 移动开始
98
- effect: args.transEffect || 'fly'
99
- });
100
- _context.n = 8;
101
- return five.moveToPano(panoIndex, movePanoOptions);
102
- case 8:
103
- _context.n = 10;
104
- break;
105
- case 9:
106
- reject(false);
107
- case 10:
108
- return _context.a(2);
105
+ case 26:
106
+ reject(false);
107
+ case 27:
108
+ case "end":
109
+ return _context.stop();
110
+ }
109
111
  }
110
112
  }, _callee);
111
113
  }));
@@ -115,7 +117,7 @@ export var CameraMovementPlugin = function CameraMovementPlugin(five) {
115
117
  }());
116
118
  };
117
119
  var rotate = /*#__PURE__*/function () {
118
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(args, duration) {
120
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(args, duration) {
119
121
  var _opts$asyncStartCallb, _opts$asyncEndCallbac2;
120
122
  var opts,
121
123
  from,
@@ -123,107 +125,112 @@ export var CameraMovementPlugin = function CameraMovementPlugin(five) {
123
125
  timeEnd,
124
126
  start,
125
127
  animeDuration,
126
- _onFiveRenderFrame,
128
+ onFiveRenderFrame,
127
129
  _args2 = arguments;
128
- return _regenerator().w(function (_context2) {
129
- while (1) switch (_context2.n) {
130
- case 0:
131
- opts = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
132
- moving = false;
133
- (_opts$asyncStartCallb = opts.asyncStartCallback) === null || _opts$asyncStartCallb === void 0 || _opts$asyncStartCallb.call(opts);
130
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
131
+ while (1) {
132
+ switch (_context2.prev = _context2.next) {
133
+ case 0:
134
+ opts = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
135
+ moving = false;
136
+ (_opts$asyncStartCallb = opts.asyncStartCallback) === null || _opts$asyncStartCallb === void 0 ? void 0 : _opts$asyncStartCallb.call(opts);
134
137
 
135
- // 先切换模型再出旋转效果
136
- if (!(args.mode && five.currentMode !== args.mode)) {
137
- _context2.n = 1;
138
- break;
139
- }
140
- _context2.n = 1;
141
- return five.changeMode(args.mode, args.mode === Five.Mode.Panorama ? {
142
- latitude: 0
143
- } : undefined);
144
- case 1:
145
- if (!(args.mode === Five.Mode.Panorama && five.currentMode === Five.Mode.Panorama && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
146
- _context2.n = 3;
147
- break;
148
- }
149
- if (!opts.preload) {
150
- _context2.n = 2;
151
- break;
152
- }
153
- _context2.n = 2;
154
- return five.preloadPano(args.panoIndex);
155
- case 2:
156
- _context2.n = 3;
157
- return new Promise(function (resolve, reject) {
158
- five.moveToPano(args.panoIndex, {
159
- moveEndCallback: function moveEndCallback() {
160
- return resolve(true);
161
- },
162
- // 移动结束
163
- moveCancelCallback: function moveCancelCallback() {
164
- return reject(false);
165
- },
166
- // 移动开始
167
- effect: 'fade'
138
+ // 先切换模型再出旋转效果
139
+ if (!(args.mode && five.currentMode !== args.mode)) {
140
+ _context2.next = 6;
141
+ break;
142
+ }
143
+ _context2.next = 6;
144
+ return five.changeMode(args.mode, args.mode === Five.Mode.Panorama ? {
145
+ latitude: 0
146
+ } : undefined);
147
+ case 6:
148
+ if (!(args.mode === Five.Mode.Panorama && five.currentMode === Five.Mode.Panorama && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
149
+ _context2.next = 12;
150
+ break;
151
+ }
152
+ if (!opts.preload) {
153
+ _context2.next = 10;
154
+ break;
155
+ }
156
+ _context2.next = 10;
157
+ return five.preloadPano(args.panoIndex);
158
+ case 10:
159
+ _context2.next = 12;
160
+ return new Promise(function (resolve, reject) {
161
+ five.moveToPano(args.panoIndex, {
162
+ moveEndCallback: function moveEndCallback() {
163
+ return resolve(true);
164
+ },
165
+ // 移动结束
166
+ moveCancelCallback: function moveCancelCallback() {
167
+ return reject(false);
168
+ },
169
+ // 移动开始
170
+ effect: 'fade'
171
+ });
168
172
  });
169
- });
170
- case 3:
171
- _context2.n = 4;
172
- return five.ready();
173
- case 4:
174
- (_opts$asyncEndCallbac2 = opts.asyncEndCallback) === null || _opts$asyncEndCallbac2 === void 0 || _opts$asyncEndCallbac2.call(opts);
173
+ case 12:
174
+ _context2.next = 14;
175
+ return five.ready();
176
+ case 14:
177
+ (_opts$asyncEndCallbac2 = opts.asyncEndCallback) === null || _opts$asyncEndCallbac2 === void 0 ? void 0 : _opts$asyncEndCallbac2.call(opts);
175
178
 
176
- // 计算to
177
- from = five.getCurrentState();
178
- to = function () {
179
- return args;
180
- }();
181
- timeEnd = false; // 开始时间
182
- start = performance.now();
183
- animeDuration = duration;
184
- if (args.rotation === Rotation.Loop) {
185
- animeDuration = args.rotateSpeed ? Math.ceil(Math.abs(to.longitude - from.longitude) / args.rotateSpeed * 1000) : duration;
186
- animeDuration = Math.min(duration, animeDuration);
187
- }
188
- _onFiveRenderFrame = function onFiveRenderFrame() {
189
- if (timeEnd || moving) {
190
- five.off('renderFrame', _onFiveRenderFrame);
191
- return;
192
- }
193
- var targetState = {};
194
- if (args.rotation !== Rotation.Loop) {
195
- var progress = (performance.now() - start) / duration;
196
- targetState = {
197
- fov: progressNumber(from.fov, to.fov, progress),
198
- latitude: progressNumber(from.latitude, to.latitude, progress),
199
- longitude: progressLongitude(from.longitude, to.longitude, args.rotation, progress)
200
- };
201
- } else {
202
- var _progress = (performance.now() - start) / animeDuration; // 可能大于1
203
- var times = Math.floor(_progress);
204
- var progress2 = _progress - times; // 一定小于1
205
- var isNegative = times % 2 === 1; // 是否为反向旋转, 0: 正, 1: 反, 2: 正, 3: 反 以此类推
206
- var resultProgress = isNegative ? 1 - progress2 : progress2;
207
- targetState = {
208
- fov: progressNumber(from.fov, to.fov, resultProgress),
209
- latitude: progressNumber(from.latitude, to.latitude, resultProgress),
210
- longitude: progressNumber(from.longitude, to.longitude, resultProgress)
211
- };
179
+ // 计算to
180
+ from = five.getCurrentState();
181
+ to = function () {
182
+ return args;
183
+ }();
184
+ timeEnd = false; // 开始时间
185
+ start = performance.now();
186
+ animeDuration = duration;
187
+ if (args.rotation === Rotation.Loop) {
188
+ animeDuration = args.rotateSpeed ? Math.ceil(Math.abs(to.longitude - from.longitude) / args.rotateSpeed * 1000) : duration;
189
+ animeDuration = Math.min(duration, animeDuration);
212
190
  }
213
- five.setState(targetState, true);
214
- };
215
- five.on('renderFrame', _onFiveRenderFrame);
216
- _context2.n = 5;
217
- return new Promise(function (resolve) {
218
- setTimeout(function () {
219
- timeEnd = true;
220
- five.off('renderFrame', _onFiveRenderFrame);
221
- // 总时间到了之后强制结束,同时也是 Loop 模式的结束方式
222
- resolve(true);
223
- }, duration);
224
- });
225
- case 5:
226
- return _context2.a(2, _context2.v);
191
+ onFiveRenderFrame = function onFiveRenderFrame() {
192
+ if (timeEnd || moving) {
193
+ five.off('renderFrame', onFiveRenderFrame);
194
+ return;
195
+ }
196
+ var targetState = {};
197
+ if (args.rotation !== Rotation.Loop) {
198
+ var progress = (performance.now() - start) / duration;
199
+ targetState = {
200
+ fov: progressNumber(from.fov, to.fov, progress),
201
+ latitude: progressNumber(from.latitude, to.latitude, progress),
202
+ longitude: progressLongitude(from.longitude, to.longitude, args.rotation, progress)
203
+ };
204
+ } else {
205
+ var _progress = (performance.now() - start) / animeDuration; // 可能大于1
206
+ var times = Math.floor(_progress);
207
+ var progress2 = _progress - times; // 一定小于1
208
+ var isNegative = times % 2 === 1; // 是否为反向旋转, 0: 正, 1: 反, 2: 正, 3: 反 以此类推
209
+ var resultProgress = isNegative ? 1 - progress2 : progress2;
210
+ targetState = {
211
+ fov: progressNumber(from.fov, to.fov, resultProgress),
212
+ latitude: progressNumber(from.latitude, to.latitude, resultProgress),
213
+ longitude: progressNumber(from.longitude, to.longitude, resultProgress)
214
+ };
215
+ }
216
+ five.setState(targetState, true);
217
+ };
218
+ five.on('renderFrame', onFiveRenderFrame);
219
+ _context2.next = 25;
220
+ return new Promise(function (resolve) {
221
+ setTimeout(function () {
222
+ timeEnd = true;
223
+ five.off('renderFrame', onFiveRenderFrame);
224
+ // 总时间到了之后强制结束,同时也是 Loop 模式的结束方式
225
+ resolve(true);
226
+ }, duration);
227
+ });
228
+ case 25:
229
+ return _context2.abrupt("return", _context2.sent);
230
+ case 26:
231
+ case "end":
232
+ return _context2.stop();
233
+ }
227
234
  }
228
235
  }, _callee2);
229
236
  }));
@@ -2,14 +2,14 @@
2
2
 
3
3
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
4
4
 
5
- export var CameraMovementEffect = /*#__PURE__*/function (CameraMovementEffect) {
5
+ export var CameraMovementEffect;
6
+ (function (CameraMovementEffect) {
6
7
  CameraMovementEffect["Move"] = "Move";
7
8
  CameraMovementEffect["Rotate"] = "Rotate";
8
- return CameraMovementEffect;
9
- }({});
10
- export var Rotation = /*#__PURE__*/function (Rotation) {
9
+ })(CameraMovementEffect || (CameraMovementEffect = {}));
10
+ export var Rotation;
11
+ (function (Rotation) {
11
12
  Rotation["Clockwise"] = "Clockwise";
12
13
  Rotation["Anticlockwise"] = "Anticlockwise";
13
14
  Rotation["Loop"] = "Loop";
14
- return Rotation;
15
- }({});
15
+ })(Rotation || (Rotation = {}));
@@ -1,7 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
- 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 }; })(); }
4
- 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); }
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
5
4
  import * as THREE from 'three';
6
5
  export var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
7
6
  var videoElement = _ref.videoElement,
@@ -29,7 +28,7 @@ export var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
29
28
  var stop = function stop() {
30
29
  var _removeReady;
31
30
  ++generation;
32
- (_removeReady = removeReady) === null || _removeReady === void 0 || _removeReady();
31
+ (_removeReady = removeReady) === null || _removeReady === void 0 ? void 0 : _removeReady();
33
32
  removeReady = undefined;
34
33
  if (output) {
35
34
  output.muted = true;
@@ -103,8 +102,8 @@ export var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
103
102
  state.videoMeshes.forEach(function (mesh) {
104
103
  return five.scene.add(mesh);
105
104
  });
106
- var _timeupdate = function timeupdate() {
107
- element.removeEventListener('timeupdate', _timeupdate);
105
+ var timeupdate = function timeupdate() {
106
+ element.removeEventListener('timeupdate', timeupdate);
108
107
  if (!valid()) return;
109
108
  state.videoTextureEnabled = true;
110
109
  state.videoMeshes.forEach(function (mesh) {
@@ -112,10 +111,10 @@ export var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
112
111
  });
113
112
  five.needsRender = true;
114
113
  };
115
- var _play = function play() {
116
- five.off('modelLoaded', _play);
114
+ var play = function play() {
115
+ five.off('modelLoaded', play);
117
116
  if (!valid()) return;
118
- element.addEventListener('timeupdate', _timeupdate);
117
+ element.addEventListener('timeupdate', timeupdate);
119
118
  void media.play().catch(function (error) {
120
119
  if (valid()) {
121
120
  disable();
@@ -124,13 +123,13 @@ export var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
124
123
  });
125
124
  };
126
125
  removeReady = function removeReady() {
127
- five.off('modelLoaded', _play);
128
- element.removeEventListener('timeupdate', _timeupdate);
126
+ five.off('modelLoaded', play);
127
+ element.removeEventListener('timeupdate', timeupdate);
129
128
  };
130
- if (five.model.loaded) _play();else five.on('modelLoaded', _play);
129
+ if (five.model.loaded) play();else five.on('modelLoaded', play);
131
130
  };
132
131
  var disable = function disable() {
133
- controller === null || controller === void 0 || controller.cancel();
132
+ controller === null || controller === void 0 ? void 0 : controller.cancel();
134
133
  stop();
135
134
  };
136
135
  var createPanoVideoMeshes = function createPanoVideoMeshes() {
@@ -225,51 +224,54 @@ export var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
225
224
  });
226
225
  };
227
226
  var load = /*#__PURE__*/function () {
228
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(data, videoElement) {
227
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data, videoElement) {
229
228
  var current, video_src, video_poster_src, points, texture;
230
- return _regenerator().w(function (_context) {
231
- while (1) switch (_context.n) {
232
- case 0:
233
- current = ++generation;
234
- video_src = data.video_src, video_poster_src = data.video_poster_src, points = data.points;
235
- state.videoSource = video_src;
236
- state.rectPoints = points.map(function (items) {
237
- return items.map(function (_ref3) {
238
- var x = _ref3.x,
239
- y = _ref3.y,
240
- z = _ref3.z;
241
- return new THREE.Vector3(x, y, z);
229
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
230
+ while (1) {
231
+ switch (_context.prev = _context.next) {
232
+ case 0:
233
+ current = ++generation;
234
+ video_src = data.video_src, video_poster_src = data.video_poster_src, points = data.points;
235
+ state.videoSource = video_src;
236
+ state.rectPoints = points.map(function (items) {
237
+ return items.map(function (_ref3) {
238
+ var x = _ref3.x,
239
+ y = _ref3.y,
240
+ z = _ref3.z;
241
+ return new THREE.Vector3(x, y, z);
242
+ });
242
243
  });
243
- });
244
- state.imageTexture = getImageTexture(video_poster_src);
245
- if (videoElement) {
246
- state.videoElement = videoElement;
247
- }
248
- _context.n = 1;
249
- return getVideoTexture(state.videoSource, state.videoElement, function () {
250
- return !disposed && current === generation;
251
- });
252
- case 1:
253
- texture = _context.v;
254
- if (!(disposed || current !== generation)) {
255
- _context.n = 2;
256
- break;
257
- }
258
- texture.image.muted = true;
259
- texture.image.pause();
260
- URL.revokeObjectURL(texture.image.src);
261
- texture.dispose();
262
- return _context.a(2);
263
- case 2:
264
- if (state.videoTexture) {
265
- state.videoTexture.image.pause();
266
- URL.revokeObjectURL(state.videoTexture.image.src);
267
- state.videoTexture.dispose();
268
- }
269
- state.videoTexture = texture;
270
- if (data.enable) enable();
271
- case 3:
272
- return _context.a(2);
244
+ state.imageTexture = getImageTexture(video_poster_src);
245
+ if (videoElement) {
246
+ state.videoElement = videoElement;
247
+ }
248
+ _context.next = 8;
249
+ return getVideoTexture(state.videoSource, state.videoElement, function () {
250
+ return !disposed && current === generation;
251
+ });
252
+ case 8:
253
+ texture = _context.sent;
254
+ if (!(disposed || current !== generation)) {
255
+ _context.next = 15;
256
+ break;
257
+ }
258
+ texture.image.muted = true;
259
+ texture.image.pause();
260
+ URL.revokeObjectURL(texture.image.src);
261
+ texture.dispose();
262
+ return _context.abrupt("return");
263
+ case 15:
264
+ if (state.videoTexture) {
265
+ state.videoTexture.image.pause();
266
+ URL.revokeObjectURL(state.videoTexture.image.src);
267
+ state.videoTexture.dispose();
268
+ }
269
+ state.videoTexture = texture;
270
+ if (data.enable) enable();
271
+ case 18:
272
+ case "end":
273
+ return _context.stop();
274
+ }
273
275
  }
274
276
  }, _callee);
275
277
  }));
@@ -328,11 +330,11 @@ export var ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
328
330
  disposed = true;
329
331
  ++generation;
330
332
  disable();
331
- controller === null || controller === void 0 || controller.dispose();
333
+ controller === null || controller === void 0 ? void 0 : controller.dispose();
332
334
  listeners.splice(0).forEach(function (remove) {
333
335
  return remove();
334
336
  });
335
- (_state$imageTexture = state.imageTexture) === null || _state$imageTexture === void 0 || _state$imageTexture.dispose();
337
+ (_state$imageTexture = state.imageTexture) === null || _state$imageTexture === void 0 ? void 0 : _state$imageTexture.dispose();
336
338
  if (state.videoTexture) {
337
339
  URL.revokeObjectURL(state.videoTexture.image.src);
338
340
  state.videoTexture.dispose();
@@ -38,7 +38,7 @@ export var VreoProvider = function VreoProvider(props) {
38
38
  setPlayer(playerRef.current);
39
39
  return function () {
40
40
  var _playerRef$current;
41
- (_playerRef$current = playerRef.current) === null || _playerRef$current === void 0 || _playerRef$current.dispose();
41
+ (_playerRef$current = playerRef.current) === null || _playerRef$current === void 0 ? void 0 : _playerRef$current.dispose();
42
42
  };
43
43
  }, []);
44
44
  if (!player) return /*#__PURE__*/React.createElement(React.Fragment, null);