@realsee/vreo 1.0.0-alpha.17 → 1.0.0-alpha.19

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 (73) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/docs/demo/assets/{AppReact.a3fc45d3.js → AppReact.20163f9a.js} +1 -1
  3. package/docs/demo/assets/default.5069891b.js +3988 -0
  4. package/docs/demo/assets/{dynamic.714b9eb8.js → dynamic.c8118cc9.js} +1 -1
  5. package/docs/demo/assets/{examples.1a6f5a2c.js → examples.5391fc1f.js} +1 -1
  6. package/docs/demo/assets/{index.0ca9e9d3.js → index.2272a9ef.js} +1 -1
  7. package/docs/demo/assets/main.b335b989.js +1 -0
  8. package/docs/demo/assets/{react.fca6a967.js → react.efea3f3f.js} +1 -1
  9. package/docs/demo/examples.html +2 -2
  10. package/docs/demo/index-react-dynamic.html +4 -4
  11. package/docs/demo/index-react.html +4 -4
  12. package/docs/demo/index.html +3 -3
  13. package/lib/PlayController/createHTMLAudioElement.js +11 -6
  14. package/lib/PlayController/index.js +81 -16
  15. package/lib/Player/App.js +24 -0
  16. package/lib/Player/Controller.d.ts +2 -2
  17. package/lib/Player/Controller.js +95 -19
  18. package/lib/Player/custom/SpatialScenePanel/index.js +68 -42
  19. package/lib/Player/hooks.js +10 -0
  20. package/lib/Player/index.js +85 -25
  21. package/lib/Player/modules/Drawer/index.js +17 -0
  22. package/lib/Player/modules/PopUp/index.js +10 -0
  23. package/lib/Player/modules/ResizeObserver/index.js +8 -0
  24. package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +2 -2
  25. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +114 -20
  26. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +24 -2
  27. package/lib/Player/modules/VideoAgent/index.js +17 -0
  28. package/lib/Player/modules/Wave/index.js +32 -7
  29. package/lib/Player/modules/keyframes/BgMusic/index.js +44 -14
  30. package/lib/Player/modules/keyframes/CameraMovement/index.js +27 -3
  31. package/lib/Player/modules/keyframes/InfoPanel/index.js +25 -8
  32. package/lib/Player/modules/keyframes/ModelVideo/index.js +29 -3
  33. package/lib/Player/modules/keyframes/PanoEffect/index.js +43 -15
  34. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +7 -0
  35. package/lib/Player/modules/keyframes/PanoTag/index.js +21 -4
  36. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +47 -22
  37. package/lib/Player/modules/keyframes/Prompter/index.js +32 -10
  38. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +25 -18
  39. package/lib/Player/modules/keyframes/VideoEffect/index.js +47 -12
  40. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +2 -0
  41. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +1 -0
  42. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +1 -0
  43. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +60 -19
  44. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +5 -2
  45. package/lib/fivePlugins/CameraMovementPlugin/index.js +75 -28
  46. package/lib/fivePlugins/CameraMovementPlugin/typings.js +4 -0
  47. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +60 -11
  48. package/lib/index.js +1 -0
  49. package/lib/react/index.js +34 -7
  50. package/lib/shared-utils/{AduioLike.d.ts → AudioLike.d.ts} +0 -0
  51. package/lib/shared-utils/{AduioLike.js → AudioLike.js} +43 -11
  52. package/lib/shared-utils/Preloader.js +7 -0
  53. package/lib/shared-utils/addResizeListener.js +5 -0
  54. package/lib/shared-utils/animationFrame/BetterTween.js +38 -2
  55. package/lib/shared-utils/animationFrame/index.js +10 -2
  56. package/lib/shared-utils/animationFrame/tween.js +15 -2
  57. package/lib/shared-utils/createTransMatrix.js +17 -2
  58. package/lib/shared-utils/getFileExpandedName.js +1 -0
  59. package/lib/shared-utils/getMediaInfo.js +9 -0
  60. package/lib/shared-utils/setElementDataset.js +2 -0
  61. package/lib/typings/VreoUnit.d.ts +5 -5
  62. package/lib/typings/VreoUnit.js +15 -0
  63. package/package.json +1 -1
  64. package/resources/PlayController/index.ts +1 -1
  65. package/resources/Player/Controller.ts +3 -3
  66. package/resources/Player/index.tsx +1 -1
  67. package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +2 -2
  68. package/resources/Player/modules/keyframes/BgMusic/index.tsx +23 -14
  69. package/resources/Player/modules/keyframes/PanoTag/index.tsx +1 -0
  70. package/resources/shared-utils/{AduioLike.ts → AudioLike.ts} +4 -6
  71. package/resources/typings/VreoUnit.ts +5 -5
  72. package/docs/demo/assets/default.9985006b.js +0 -3988
  73. package/docs/demo/assets/main.7963f418.js +0 -1
@@ -1,19 +1,30 @@
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
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.Wave = Wave;
9
+
8
10
  var _react = _interopRequireWildcard(require("react"));
11
+
9
12
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
+
10
14
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
+
11
16
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
17
+
12
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."); }
19
+
13
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); }
21
+
14
22
  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; }
23
+
15
24
  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; }
25
+
16
26
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
27
+
17
28
  var prefix = 'https://vr-public.realsee-cdn.cn/release/static/image/release/';
18
29
  var WAVES = {
19
30
  single: {
@@ -63,16 +74,21 @@ var isSafari = /safari/i.test(userAgent) && !/chrome/i.test(userAgent) && /versi
63
74
  var isMicroMessenger = /microMessenger/i.test(userAgent);
64
75
  var canPlayHevc = isAppleDevice || isSafari;
65
76
  var canPlayVp9 = typeof MediaSource !== 'undefined' && MediaSource.isTypeSupported("video/webm; codecs=vp9");
77
+
66
78
  function Wave(props) {
67
79
  var wave = _react["default"].useMemo(function () {
68
80
  var _props$appearance;
81
+
69
82
  var appearance = (_props$appearance = props === null || props === void 0 ? void 0 : props.appearance) !== null && _props$appearance !== void 0 ? _props$appearance : 'solid';
70
83
  return WAVES[appearance];
71
84
  }, [props === null || props === void 0 ? void 0 : props.appearance]);
85
+
72
86
  var heightWidthRatio = _react["default"].useMemo(function () {
73
87
  return wave.height / wave.width;
74
88
  }, [wave]);
89
+
75
90
  var content = null;
91
+
76
92
  if (isMicroMessenger) {
77
93
  content = /*#__PURE__*/_react["default"].createElement(KeyframeWaveContent, {
78
94
  wave: wave
@@ -92,6 +108,7 @@ function Wave(props) {
92
108
  wave: wave
93
109
  });
94
110
  }
111
+
95
112
  return /*#__PURE__*/_react["default"].createElement("div", {
96
113
  className: "vreo-wave"
97
114
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -110,18 +127,22 @@ function Wave(props) {
110
127
  }
111
128
  }, content)));
112
129
  }
130
+
113
131
  var VideoWaveContent = function VideoWaveContent(_ref) {
114
132
  var wave = _ref.wave,
115
- format = _ref.format;
133
+ format = _ref.format;
116
134
  var videoRef = (0, _react.useRef)(null);
135
+
117
136
  var _useState = (0, _react.useState)(false),
118
- _useState2 = _slicedToArray(_useState, 2),
119
- canPlay = _useState2[0],
120
- setCanPlay = _useState2[1];
137
+ _useState2 = _slicedToArray(_useState, 2),
138
+ canPlay = _useState2[0],
139
+ setCanPlay = _useState2[1];
140
+
121
141
  var _useState3 = (0, _react.useState)(false),
122
- _useState4 = _slicedToArray(_useState3, 2),
123
- errored = _useState4[0],
124
- setErrored = _useState4[1];
142
+ _useState4 = _slicedToArray(_useState3, 2),
143
+ errored = _useState4[0],
144
+ setErrored = _useState4[1];
145
+
125
146
  var source = prefix + wave[format];
126
147
  (0, _react.useEffect)(function () {
127
148
  setCanPlay(false);
@@ -130,16 +151,19 @@ var VideoWaveContent = function VideoWaveContent(_ref) {
130
151
  if (videoRef.current) {
131
152
  videoRef.current.play();
132
153
  }
154
+
133
155
  setCanPlay(true);
134
156
  }, []);
135
157
  var errorHandler = (0, _react.useCallback)(function () {
136
158
  setErrored(true);
137
159
  }, []);
160
+
138
161
  if (errored) {
139
162
  return /*#__PURE__*/_react["default"].createElement(KeyframeWaveContent, {
140
163
  wave: wave
141
164
  });
142
165
  }
166
+
143
167
  return /*#__PURE__*/_react["default"].createElement("video", {
144
168
  style: {
145
169
  opacity: canPlay ? 1 : 0
@@ -157,6 +181,7 @@ var VideoWaveContent = function VideoWaveContent(_ref) {
157
181
  src: source
158
182
  });
159
183
  };
184
+
160
185
  var KeyframeWaveContent = function KeyframeWaveContent(_ref2) {
161
186
  var wave = _ref2.wave;
162
187
  var source = prefix + wave.png;
@@ -1,15 +1,45 @@
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
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.BgMusic = BgMusic;
9
+
8
10
  var React = _interopRequireWildcard(require("react"));
11
+
9
12
  var _VreoUnit = require("../../../../typings/VreoUnit");
13
+
10
14
  var _hooks = require("../../../hooks");
15
+
11
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); }
17
+
12
18
  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; }
19
+
20
+ var audioList = [];
21
+
22
+ function getAudio() {
23
+ var src = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
24
+ var currentTime = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
25
+
26
+ var audio = function () {
27
+ var audio = audioList.find(function (audio) {
28
+ return audio.src === src;
29
+ });
30
+ if (audio) return audio;else {
31
+ var newAudio = new Audio(src);
32
+ audioList.push(newAudio);
33
+ return newAudio;
34
+ }
35
+ }();
36
+
37
+ audio.currentTime = currentTime;
38
+ audio.setAttribute('playsinline', 'true');
39
+ audio.loop = true;
40
+ return audio;
41
+ }
42
+
13
43
  function BgMusic() {
14
44
  var controller = (0, _hooks.useController)();
15
45
  var timeoutIdRef = React.useRef(null);
@@ -20,42 +50,42 @@ function BgMusic() {
20
50
  }
21
51
  }, []);
22
52
  React.useEffect(function () {
23
- var audio = new Audio();
24
- audio.setAttribute('id', 'vreo-singleton-bgmusic');
25
- audio.style.display = 'none';
26
- audio.setAttribute('playsinline', 'true');
27
- audio.loop = true;
28
- document.body.append(audio);
29
- var callback = function callback(keyframe) {
53
+ var callback = function callback(keyframe, currentTime) {
54
+ console.log({
55
+ currentTime: currentTime
56
+ });
30
57
  var start = keyframe.start,
31
- end = keyframe.end;
32
- var _ref = keyframe.data,
33
- url = _ref.url;
34
- audio.src = url;
58
+ end = keyframe.end;
59
+ var audio = getAudio(keyframe.data.url, Math.max(currentTime - start, 0));
60
+
35
61
  var playCallback = function playCallback() {
36
62
  audio.play();
37
63
  };
64
+
38
65
  audio.addEventListener('canplaythrough', playCallback);
39
66
  cleanTimeout();
67
+
40
68
  var cleanAudio = function cleanAudio() {
69
+ console.log('cleanAudio', keyframe.start);
41
70
  audio.pause();
42
- audio.currentTime = 0;
43
71
  audio.src = '';
44
72
  cleanTimeout();
45
73
  audio.removeEventListener('canplaythrough', playCallback);
46
74
  };
47
- var duration = end - start || 5000;
75
+
76
+ var duration = end - start;
48
77
  timeoutIdRef.current = setTimeout(function () {
78
+ console.log('timeout', duration);
49
79
  cleanAudio();
50
80
  }, duration);
51
81
  controller.once('paused', function () {
52
82
  cleanAudio();
53
83
  });
54
84
  };
85
+
55
86
  controller.on(_VreoUnit.VreoKeyframeEnum.BgMusic, callback);
56
87
  return function () {
57
88
  controller.off(_VreoUnit.VreoKeyframeEnum.BgMusic, callback);
58
- document.body.removeChild(audio);
59
89
  cleanTimeout();
60
90
  };
61
91
  });
@@ -1,70 +1,92 @@
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
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.CameraMovement = CameraMovement;
9
+
8
10
  var React = _interopRequireWildcard(require("react"));
11
+
9
12
  var _CameraMovementPlugin = require("../../../../fivePlugins/CameraMovementPlugin");
13
+
10
14
  var _typings = require("../../../../fivePlugins/CameraMovementPlugin/typings");
15
+
11
16
  var _VreoUnit = require("../../../../typings/VreoUnit");
17
+
12
18
  var _hooks = require("../../../hooks");
19
+
13
20
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
+
14
22
  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; }
15
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
23
+
16
24
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
25
+
17
26
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
27
+
18
28
  function CameraMovement() {
19
29
  var controller = (0, _hooks.useController)();
20
30
  var five = (0, _hooks.useFiveInstance)();
21
31
  var ref = React.useRef();
22
32
  React.useEffect(function () {
23
33
  var callback = /*#__PURE__*/function () {
24
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(keyframe) {
34
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(keyframe) {
25
35
  var start, end, data, cameraMovementData, effect;
26
- return _regeneratorRuntime().wrap(function _callee$(_context) {
36
+ return regeneratorRuntime.wrap(function _callee$(_context) {
27
37
  while (1) {
28
38
  switch (_context.prev = _context.next) {
29
39
  case 0:
30
40
  if (!ref.current) {
31
41
  ref.current = (0, _CameraMovementPlugin.CameraMovementPlugin)(five, {});
32
42
  }
43
+
33
44
  start = keyframe.start, end = keyframe.end, data = keyframe.data;
34
45
  cameraMovementData = data;
35
46
  effect = cameraMovementData.effect;
47
+
36
48
  if (!(effect === _typings.CameraMovementEffect.Rotate)) {
37
49
  _context.next = 9;
38
50
  break;
39
51
  }
52
+
40
53
  _context.next = 7;
41
54
  return ref.current.rotate(data, end - start);
55
+
42
56
  case 7:
43
57
  _context.next = 21;
44
58
  break;
59
+
45
60
  case 9:
46
61
  if (!(effect === _typings.CameraMovementEffect.Move)) {
47
62
  _context.next = 14;
48
63
  break;
49
64
  }
65
+
50
66
  _context.next = 12;
51
67
  return ref.current.move(data, end - start);
68
+
52
69
  case 12:
53
70
  _context.next = 21;
54
71
  break;
72
+
55
73
  case 14:
56
74
  if (!(cameraMovementData.panoIndex !== undefined && cameraMovementData.panoIndex !== five.panoIndex)) {
57
75
  _context.next = 19;
58
76
  break;
59
77
  }
78
+
60
79
  _context.next = 17;
61
80
  return ref.current.move(data, end - start);
81
+
62
82
  case 17:
63
83
  _context.next = 21;
64
84
  break;
85
+
65
86
  case 19:
66
87
  _context.next = 21;
67
88
  return ref.current.rotate(data, end - start);
89
+
68
90
  case 21:
69
91
  case "end":
70
92
  return _context.stop();
@@ -72,10 +94,12 @@ function CameraMovement() {
72
94
  }
73
95
  }, _callee);
74
96
  }));
97
+
75
98
  return function callback(_x) {
76
99
  return _ref.apply(this, arguments);
77
100
  };
78
101
  }();
102
+
79
103
  controller.on(_VreoUnit.VreoKeyframeEnum.CameraMovement, callback);
80
104
  return function () {
81
105
  controller.off(_VreoUnit.VreoKeyframeEnum.CameraMovement, callback);
@@ -1,18 +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
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.InfoPanel = InfoPanel;
9
+
8
10
  var React = _interopRequireWildcard(require("react"));
11
+
9
12
  var _VreoUnit = require("../../../../typings/VreoUnit");
13
+
10
14
  var _hooks = require("../../../hooks");
15
+
11
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); }
17
+
12
18
  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; }
19
+
13
20
  function InfoPanelImg(_ref) {
14
21
  var url = _ref.url,
15
- children = _ref.children;
22
+ children = _ref.children;
16
23
  return /*#__PURE__*/React.createElement("div", {
17
24
  className: "vreo-infoPanel-container"
18
25
  }, /*#__PURE__*/React.createElement("div", {
@@ -26,9 +33,10 @@ function InfoPanelImg(_ref) {
26
33
  src: url
27
34
  })))));
28
35
  }
36
+
29
37
  function InfoPanelVideo(_ref2) {
30
38
  var url = _ref2.url,
31
- children = _ref2.children;
39
+ children = _ref2.children;
32
40
  return /*#__PURE__*/React.createElement("div", {
33
41
  className: "vreo-infoPanel-container"
34
42
  }, /*#__PURE__*/React.createElement("div", {
@@ -46,10 +54,12 @@ function InfoPanelVideo(_ref2) {
46
54
  src: url
47
55
  }))))));
48
56
  }
57
+
49
58
  var Title = function Title(props) {
50
59
  if (!props.title && !props.subTitle) {
51
60
  return null;
52
61
  }
62
+
53
63
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
54
64
  className: "vreo-infoPanel-title-shadow"
55
65
  }), /*#__PURE__*/React.createElement("div", {
@@ -60,22 +70,26 @@ var Title = function Title(props) {
60
70
  className: "vreo-infoPanel-t2"
61
71
  }, props.subTitle)));
62
72
  };
73
+
63
74
  function InfoPanel() {
64
75
  var timeoutRef = React.useRef();
65
76
  var controller = (0, _hooks.useController)();
66
77
  React.useEffect(function () {
67
78
  var _controller$configs;
79
+
68
80
  if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.InfoPanel) === false) {
69
81
  return;
70
82
  }
83
+
71
84
  var callback = function callback(keyframe) {
72
85
  var start = keyframe.start,
73
- end = keyframe.end,
74
- data = keyframe.data;
86
+ end = keyframe.end,
87
+ data = keyframe.data;
75
88
  var infoPanelData = data;
76
89
  var title = infoPanelData.title,
77
- subTitle = infoPanelData.subTitle,
78
- style = infoPanelData.style;
90
+ subTitle = infoPanelData.subTitle,
91
+ style = infoPanelData.style;
92
+
79
93
  do {
80
94
  if (style === _VreoUnit.InfoPanelStyleEnum.PopUp) {
81
95
  if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
@@ -93,8 +107,10 @@ function InfoPanel() {
93
107
  subTitle: subTitle
94
108
  })));
95
109
  }
110
+
96
111
  break;
97
112
  }
113
+
98
114
  if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
99
115
  controller.openDrawer({
100
116
  content: /*#__PURE__*/React.createElement(InfoPanelImg, {
@@ -117,14 +133,14 @@ function InfoPanel() {
117
133
  });
118
134
  }
119
135
  } while (false);
136
+
120
137
  timeoutRef.current = setTimeout(function () {
121
138
  controller.openDrawer(false);
122
139
  controller.openPopUp(false);
123
140
  }, end - start);
124
141
  };
125
- controller.on(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback);
126
142
 
127
- // Object.assign(window, {
143
+ controller.on(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback); // Object.assign(window, {
128
144
  // $setInfoPanel: () => {
129
145
  // controller.openPopUp(
130
146
  // // <InfoPanelImg url='//vrlab-static.ljcdn.com/release/web/psq/a.8e868cb2.gif' />
@@ -157,6 +173,7 @@ function InfoPanel() {
157
173
 
158
174
  return function () {
159
175
  controller.off(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback);
176
+
160
177
  if (timeoutRef.current) {
161
178
  clearTimeout(timeoutRef.current);
162
179
  }
@@ -1,21 +1,32 @@
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
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.ModelVideo = ModelVideo;
9
+
8
10
  var React = _interopRequireWildcard(require("react"));
11
+
9
12
  var THREE = _interopRequireWildcard(require("three"));
13
+
10
14
  var _hooks = require("../../../hooks");
15
+
11
16
  var _ModelTVVideoPlugin = require("../../../../fivePlugins/ModelTVVideoPlugin");
17
+
12
18
  var _createTransMatrix = require("../../../../shared-utils/createTransMatrix");
19
+
13
20
  var _VreoUnit = require("../../../../typings/VreoUnit");
21
+
14
22
  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); }
23
+
15
24
  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; }
16
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
25
+
17
26
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
27
+
18
28
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
29
+
19
30
  function ModelVideo() {
20
31
  var controller = (0, _hooks.useController)();
21
32
  var five = (0, _hooks.useFiveInstance)();
@@ -23,31 +34,38 @@ function ModelVideo() {
23
34
  var timeoutRef = React.useRef();
24
35
  React.useEffect(function () {
25
36
  var callback = /*#__PURE__*/function () {
26
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(keyframe) {
37
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(keyframe) {
27
38
  var _controller$configs, _controller$configs$v;
39
+
28
40
  var start, end, _ref2, videoSrc, videoPosterSrc, vertexs, matrixWorld, position, points;
29
- return _regeneratorRuntime().wrap(function _callee$(_context) {
41
+
42
+ return regeneratorRuntime.wrap(function _callee$(_context) {
30
43
  while (1) {
31
44
  switch (_context.prev = _context.next) {
32
45
  case 0:
33
46
  if (!ref.current) {
34
47
  ref.current = (0, _ModelTVVideoPlugin.ModelTVVideoPlugin)(five, {});
35
48
  }
49
+
36
50
  start = keyframe.start, end = keyframe.end;
37
51
  _ref2 = keyframe.data, videoSrc = _ref2.videoSrc, videoPosterSrc = _ref2.videoPosterSrc, vertexs = _ref2.vertexs, matrixWorld = _ref2.matrixWorld;
52
+
38
53
  position = function () {
39
54
  if (vertexs.length < 4) {
40
55
  throw new Error('ModelVideo: 顶点数据集合不够,无法组成矩形 ....');
41
56
  }
57
+
42
58
  if (vertexs.length === 4) {
43
59
  return vertexs;
44
60
  }
61
+
45
62
  var box = new THREE.Box3();
46
63
  vertexs.forEach(function (v) {
47
64
  return box.expandByPoint(new THREE.Vector3(v.x, v.y, v.z));
48
65
  });
49
66
  return [new THREE.Vector3(box.min.x, box.max.y, box.max.z), new THREE.Vector3(box.min.x, box.min.y, box.max.z), new THREE.Vector3(box.max.x, box.min.y, box.max.z), new THREE.Vector3(box.max.x, box.max.y, box.max.z)];
50
67
  }();
68
+
51
69
  points = function () {
52
70
  if (matrixWorld) {
53
71
  var transMatrix = (0, _createTransMatrix.createTransMatrix)(matrixWorld);
@@ -60,8 +78,10 @@ function ModelVideo() {
60
78
  };
61
79
  })];
62
80
  }
81
+
63
82
  return [position];
64
83
  }();
84
+
65
85
  ref.current.disable();
66
86
  _context.next = 8;
67
87
  return ref.current.load({
@@ -69,12 +89,15 @@ function ModelVideo() {
69
89
  video_poster_src: videoPosterSrc,
70
90
  points: points
71
91
  }, (_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : (_controller$configs$v = _controller$configs.videos) === null || _controller$configs$v === void 0 ? void 0 : _controller$configs$v.modelTVVideo);
92
+
72
93
  case 8:
73
94
  ref.current.enable();
74
95
  timeoutRef.current = setTimeout(function () {
75
96
  var _ref$current;
97
+
76
98
  return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.disable();
77
99
  }, end - start);
100
+
78
101
  case 10:
79
102
  case "end":
80
103
  return _context.stop();
@@ -82,13 +105,16 @@ function ModelVideo() {
82
105
  }
83
106
  }, _callee);
84
107
  }));
108
+
85
109
  return function callback(_x) {
86
110
  return _ref.apply(this, arguments);
87
111
  };
88
112
  }();
113
+
89
114
  controller.on(_VreoUnit.VreoKeyframeEnum.ModelVideo, callback);
90
115
  return function () {
91
116
  controller.off(_VreoUnit.VreoKeyframeEnum.ModelVideo, callback);
117
+
92
118
  if (timeoutRef.current) {
93
119
  clearTimeout(timeoutRef.current);
94
120
  }