@realsee/vreo 2.2.5 → 2.2.7

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 (48) hide show
  1. package/lib/PlayController/createHTMLAudioElement.js +11 -6
  2. package/lib/PlayController/index.js +80 -15
  3. package/lib/Player/App.js +26 -0
  4. package/lib/Player/Controller.js +100 -23
  5. package/lib/Player/custom/SpatialScenePanel/index.js +68 -42
  6. package/lib/Player/hooks.js +10 -0
  7. package/lib/Player/index.js +88 -24
  8. package/lib/Player/modules/Drawer/index.js +17 -0
  9. package/lib/Player/modules/PopUp/index.js +10 -0
  10. package/lib/Player/modules/ResizeObserver/index.js +8 -0
  11. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +108 -17
  12. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +24 -2
  13. package/lib/Player/modules/VideoAgent/index.js +17 -0
  14. package/lib/Player/modules/Wave/index.js +32 -7
  15. package/lib/Player/modules/keyframes/BgMusic/index.js +25 -7
  16. package/lib/Player/modules/keyframes/CameraMovement/index.js +27 -3
  17. package/lib/Player/modules/keyframes/InfoPanel/index.js +29 -6
  18. package/lib/Player/modules/keyframes/ModelVideo/index.js +29 -3
  19. package/lib/Player/modules/keyframes/PanoEffect/index.js +43 -15
  20. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +7 -0
  21. package/lib/Player/modules/keyframes/PanoTag/index.js +22 -4
  22. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +47 -22
  23. package/lib/Player/modules/keyframes/Prompter/index.js +32 -10
  24. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +25 -18
  25. package/lib/Player/modules/keyframes/VideoEffect/index.js +65 -16
  26. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +2 -0
  27. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +1 -0
  28. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +1 -0
  29. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +60 -19
  30. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +5 -2
  31. package/lib/fivePlugins/CameraMovementPlugin/index.js +73 -20
  32. package/lib/fivePlugins/CameraMovementPlugin/typings.js +4 -0
  33. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +60 -11
  34. package/lib/index.js +1 -0
  35. package/lib/react/index.js +34 -7
  36. package/lib/shared-utils/Audio.js +69 -15
  37. package/lib/shared-utils/AudioLike.js +39 -5
  38. package/lib/shared-utils/Preloader.js +7 -0
  39. package/lib/shared-utils/addResizeListener.js +5 -0
  40. package/lib/shared-utils/animationFrame/BetterTween.js +38 -2
  41. package/lib/shared-utils/animationFrame/index.js +10 -2
  42. package/lib/shared-utils/animationFrame/tween.js +11 -2
  43. package/lib/shared-utils/createTransMatrix.js +17 -2
  44. package/lib/shared-utils/getFileExpandedName.js +1 -0
  45. package/lib/shared-utils/getMediaInfo.js +9 -0
  46. package/lib/shared-utils/setElementDataset.js +2 -0
  47. package/lib/typings/VreoUnit.js +15 -0
  48. package/package.json +4 -2
@@ -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
  onClick: props === null || props === void 0 ? void 0 : props.onClick
@@ -111,18 +128,22 @@ function Wave(props) {
111
128
  }
112
129
  }, content)));
113
130
  }
131
+
114
132
  var VideoWaveContent = function VideoWaveContent(_ref) {
115
133
  var wave = _ref.wave,
116
- format = _ref.format;
134
+ format = _ref.format;
117
135
  var videoRef = (0, _react.useRef)(null);
136
+
118
137
  var _useState = (0, _react.useState)(false),
119
- _useState2 = _slicedToArray(_useState, 2),
120
- canPlay = _useState2[0],
121
- setCanPlay = _useState2[1];
138
+ _useState2 = _slicedToArray(_useState, 2),
139
+ canPlay = _useState2[0],
140
+ setCanPlay = _useState2[1];
141
+
122
142
  var _useState3 = (0, _react.useState)(false),
123
- _useState4 = _slicedToArray(_useState3, 2),
124
- errored = _useState4[0],
125
- setErrored = _useState4[1];
143
+ _useState4 = _slicedToArray(_useState3, 2),
144
+ errored = _useState4[0],
145
+ setErrored = _useState4[1];
146
+
126
147
  var source = prefix + wave[format];
127
148
  (0, _react.useEffect)(function () {
128
149
  setCanPlay(false);
@@ -131,16 +152,19 @@ var VideoWaveContent = function VideoWaveContent(_ref) {
131
152
  if (videoRef.current) {
132
153
  videoRef.current.play();
133
154
  }
155
+
134
156
  setCanPlay(true);
135
157
  }, []);
136
158
  var errorHandler = (0, _react.useCallback)(function () {
137
159
  setErrored(true);
138
160
  }, []);
161
+
139
162
  if (errored) {
140
163
  return /*#__PURE__*/_react["default"].createElement(KeyframeWaveContent, {
141
164
  wave: wave
142
165
  });
143
166
  }
167
+
144
168
  return /*#__PURE__*/_react["default"].createElement("video", {
145
169
  style: {
146
170
  opacity: canPlay ? 1 : 0
@@ -158,6 +182,7 @@ var VideoWaveContent = function VideoWaveContent(_ref) {
158
182
  src: source
159
183
  });
160
184
  };
185
+
161
186
  var KeyframeWaveContent = function KeyframeWaveContent(_ref2) {
162
187
  var wave = _ref2.wave;
163
188
  var source = prefix + wave.png;
@@ -1,64 +1,80 @@
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 _Audio = require("../../../../shared-utils/Audio");
13
+
10
14
  var _VreoUnit = require("../../../../typings/VreoUnit");
15
+
11
16
  var _hooks = require("../../../hooks");
17
+
12
18
  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); }
19
+
13
20
  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; }
14
- 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; }
21
+
15
22
  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); } }
23
+
16
24
  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); }); }; }
25
+
17
26
  function BgMusic() {
18
27
  var controller = (0, _hooks.useController)();
19
28
  React.useEffect(function () {
20
29
  var callback = /*#__PURE__*/function () {
21
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(keyframe, currentTime) {
30
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(keyframe, currentTime) {
22
31
  var start, end, _currentTime, audio, cleanAudio, play;
23
- return _regeneratorRuntime().wrap(function _callee$(_context) {
32
+
33
+ return regeneratorRuntime.wrap(function _callee$(_context) {
24
34
  while (1) {
25
35
  switch (_context.prev = _context.next) {
26
36
  case 0:
27
37
  start = keyframe.start, end = keyframe.end;
28
38
  _currentTime = (currentTime - start) / 1000;
39
+
29
40
  if (!(_currentTime < 0 || _currentTime >= keyframe.end - keyframe.start)) {
30
41
  _context.next = 4;
31
42
  break;
32
43
  }
44
+
33
45
  return _context.abrupt("return");
46
+
34
47
  case 4:
35
48
  audio = (0, _Audio.getAudio)(keyframe.data.url);
36
- audio.currentTime = Math.max(0, _currentTime);
37
- // console.log('play', audio.src)
49
+ audio.currentTime = Math.max(0, _currentTime); // console.log('play', audio.src)
38
50
  // const play = () => audio.play()
39
51
 
40
52
  audio.play();
53
+
41
54
  cleanAudio = function cleanAudio() {
42
55
  // audio.removeEventListener('canplaythrough', play)
43
56
  audio.removeEventListener('pause', play);
44
57
  audio.pause();
45
- audio.src = '';
46
- // cleanTimeout()
58
+ audio.src = ''; // cleanTimeout()
47
59
  }; // audio.addEventListener('canplaythrough', play)
48
60
 
61
+
49
62
  audio.addEventListener('ended', function () {
50
63
  cleanAudio();
51
64
  });
65
+
52
66
  play = function play() {
53
67
  if (audio.realSrc === keyframe.data.url) {
54
68
  // 有可能会被其他音轨打断
55
69
  audio.play();
56
70
  }
57
71
  };
72
+
58
73
  audio.addEventListener('pause', play);
59
74
  controller.once('paused', function () {
60
75
  cleanAudio();
61
76
  });
77
+
62
78
  case 12:
63
79
  case "end":
64
80
  return _context.stop();
@@ -66,10 +82,12 @@ function BgMusic() {
66
82
  }
67
83
  }, _callee);
68
84
  }));
85
+
69
86
  return function callback(_x, _x2) {
70
87
  return _ref.apply(this, arguments);
71
88
  };
72
89
  }();
90
+
73
91
  controller.on(_VreoUnit.VreoKeyframeEnum.BgMusic, callback);
74
92
  return function () {
75
93
  controller.off(_VreoUnit.VreoKeyframeEnum.BgMusic, callback);
@@ -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,19 +1,27 @@
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
  var isWX = navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1;
14
21
  var isIOS = navigator.userAgent.toLowerCase().indexOf('iphone') !== -1;
15
22
  var isIOSorWX = isIOS || isWX;
16
23
  var videoElement = document.createElement('video');
24
+
17
25
  if (isIOSorWX) {
18
26
  videoElement.playsInline = true;
19
27
  videoElement.classList.add('vreo-infoPanelVideo');
@@ -23,9 +31,10 @@ if (isIOSorWX) {
23
31
  once: true
24
32
  });
25
33
  }
34
+
26
35
  function InfoPanelImg(_ref) {
27
36
  var url = _ref.url,
28
- children = _ref.children;
37
+ children = _ref.children;
29
38
  return /*#__PURE__*/React.createElement("div", {
30
39
  className: "vreo-infoPanel-container"
31
40
  }, /*#__PURE__*/React.createElement("div", {
@@ -34,17 +43,20 @@ function InfoPanelImg(_ref) {
34
43
  src: url
35
44
  })));
36
45
  }
46
+
37
47
  function InfoPanelVideo(_ref2) {
38
48
  var url = _ref2.url,
39
- children = _ref2.children;
49
+ children = _ref2.children;
40
50
  var videoWrapperRef = React.useRef(null);
41
51
  React.useEffect(function () {
42
52
  if (!isIOSorWX) return;
43
53
  if (!videoWrapperRef.current) return;
44
54
  videoElement.src = url;
55
+
45
56
  if (!videoWrapperRef.current.contains(videoElement)) {
46
57
  videoWrapperRef.current.appendChild(videoElement);
47
58
  }
59
+
48
60
  videoElement.play();
49
61
  }, [videoWrapperRef.current]);
50
62
  return /*#__PURE__*/React.createElement("div", {
@@ -60,10 +72,12 @@ function InfoPanelVideo(_ref2) {
60
72
  src: url
61
73
  }))));
62
74
  }
75
+
63
76
  var Title = function Title(props) {
64
77
  if (!props.title && !props.subTitle) {
65
78
  return null;
66
79
  }
80
+
67
81
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
68
82
  className: "vreo-infoPanel-title"
69
83
  }, /*#__PURE__*/React.createElement("div", {
@@ -72,22 +86,26 @@ var Title = function Title(props) {
72
86
  className: "vreo-infoPanel-t2"
73
87
  }, props.subTitle)));
74
88
  };
89
+
75
90
  function InfoPanel() {
76
91
  var timeoutRef = React.useRef();
77
92
  var controller = (0, _hooks.useController)();
78
93
  React.useEffect(function () {
79
94
  var _controller$configs;
95
+
80
96
  if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.InfoPanel) === false) {
81
97
  return;
82
98
  }
99
+
83
100
  var callback = function callback(keyframe) {
84
101
  var start = keyframe.start,
85
- end = keyframe.end,
86
- data = keyframe.data;
102
+ end = keyframe.end,
103
+ data = keyframe.data;
87
104
  var infoPanelData = data;
88
105
  var title = infoPanelData.title,
89
- subTitle = infoPanelData.subTitle,
90
- style = infoPanelData.style;
106
+ subTitle = infoPanelData.subTitle,
107
+ style = infoPanelData.style;
108
+
91
109
  do {
92
110
  if (style === _VreoUnit.InfoPanelStyleEnum.PopUp) {
93
111
  if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
@@ -105,8 +123,10 @@ function InfoPanel() {
105
123
  subTitle: subTitle
106
124
  })));
107
125
  }
126
+
108
127
  break;
109
128
  }
129
+
110
130
  if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
111
131
  controller.openDrawer({
112
132
  content: /*#__PURE__*/React.createElement(InfoPanelImg, {
@@ -129,11 +149,13 @@ function InfoPanel() {
129
149
  });
130
150
  }
131
151
  } while (false);
152
+
132
153
  timeoutRef.current = setTimeout(function () {
133
154
  controller.openDrawer(false);
134
155
  controller.openPopUp(false);
135
156
  }, end - start);
136
157
  };
158
+
137
159
  controller.on(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback);
138
160
  controller.on('ended', function () {
139
161
  controller.openPopUp(false);
@@ -143,6 +165,7 @@ function InfoPanel() {
143
165
  });
144
166
  return function () {
145
167
  controller.off(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback);
168
+
146
169
  if (timeoutRef.current) {
147
170
  clearTimeout(timeoutRef.current);
148
171
  }