@realsee/vreo 1.1.0-dev.2 → 1.2.1-alpha.0

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 (49) 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 -1
  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 +86 -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 +23 -7
  16. package/lib/Player/modules/keyframes/CameraMovement/index.js +27 -3
  17. package/lib/Player/modules/keyframes/InfoPanel/index.d.ts +1 -0
  18. package/lib/Player/modules/keyframes/InfoPanel/index.js +55 -10
  19. package/lib/Player/modules/keyframes/ModelVideo/index.js +29 -3
  20. package/lib/Player/modules/keyframes/PanoEffect/index.js +43 -15
  21. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +7 -0
  22. package/lib/Player/modules/keyframes/PanoTag/index.js +26 -8
  23. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +47 -22
  24. package/lib/Player/modules/keyframes/Prompter/index.js +32 -10
  25. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +25 -18
  26. package/lib/Player/modules/keyframes/VideoEffect/index.js +47 -12
  27. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +2 -0
  28. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +1 -0
  29. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +1 -0
  30. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +60 -19
  31. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +5 -2
  32. package/lib/fivePlugins/CameraMovementPlugin/index.js +76 -28
  33. package/lib/fivePlugins/CameraMovementPlugin/typings.js +4 -0
  34. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +60 -11
  35. package/lib/index.js +1 -0
  36. package/lib/react/index.js +34 -7
  37. package/lib/shared-utils/Audio.js +69 -15
  38. package/lib/shared-utils/AudioLike.js +39 -5
  39. package/lib/shared-utils/Preloader.js +7 -0
  40. package/lib/shared-utils/addResizeListener.js +5 -0
  41. package/lib/shared-utils/animationFrame/BetterTween.js +38 -2
  42. package/lib/shared-utils/animationFrame/index.js +10 -2
  43. package/lib/shared-utils/animationFrame/tween.js +11 -2
  44. package/lib/shared-utils/createTransMatrix.js +17 -2
  45. package/lib/shared-utils/getFileExpandedName.js +1 -0
  46. package/lib/shared-utils/getMediaInfo.js +9 -0
  47. package/lib/shared-utils/setElementDataset.js +2 -0
  48. package/lib/typings/VreoUnit.js +15 -0
  49. package/package.json +1 -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
  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,56 +1,70 @@
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;
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
49
  audio.currentTime = Math.max(0, _currentTime);
37
- console.log('play', audio.src);
38
- // const play = () => audio.play()
50
+ console.log('play', audio.src); // 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.pause();
44
- audio.src = '';
45
- // cleanTimeout()
57
+ audio.src = ''; // cleanTimeout()
46
58
  }; // audio.addEventListener('canplaythrough', play)
47
59
 
60
+
48
61
  audio.addEventListener('ended', function () {
49
62
  cleanAudio();
50
63
  });
51
64
  controller.once('paused', function () {
52
65
  cleanAudio();
53
66
  });
67
+
54
68
  case 11:
55
69
  case "end":
56
70
  return _context.stop();
@@ -58,10 +72,12 @@ function BgMusic() {
58
72
  }
59
73
  }, _callee);
60
74
  }));
75
+
61
76
  return function callback(_x, _x2) {
62
77
  return _ref.apply(this, arguments);
63
78
  };
64
79
  }();
80
+
65
81
  controller.on(_VreoUnit.VreoKeyframeEnum.BgMusic, callback);
66
82
  return function () {
67
83
  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,2 +1,3 @@
1
1
  /// <reference types="react" />
2
+ export declare const isWX: boolean;
2
3
  export declare function InfoPanel(): JSX.Element;
@@ -1,18 +1,40 @@
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
+ exports.isWX = void 0;
10
+
8
11
  var React = _interopRequireWildcard(require("react"));
12
+
9
13
  var _VreoUnit = require("../../../../typings/VreoUnit");
14
+
10
15
  var _hooks = require("../../../hooks");
16
+
11
17
  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); }
18
+
12
19
  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; }
20
+
21
+ var isWX = navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1;
22
+ exports.isWX = isWX;
23
+ var videoElement = document.createElement('video');
24
+
25
+ if (isWX) {
26
+ videoElement.playsInline = true;
27
+ videoElement.classList.add('vreo-infoPanelVideo');
28
+ document.body.addEventListener('click', function () {
29
+ return videoElement.play();
30
+ }, {
31
+ once: true
32
+ });
33
+ }
34
+
13
35
  function InfoPanelImg(_ref) {
14
36
  var url = _ref.url,
15
- children = _ref.children;
37
+ children = _ref.children;
16
38
  return /*#__PURE__*/React.createElement("div", {
17
39
  className: "vreo-infoPanel-container"
18
40
  }, /*#__PURE__*/React.createElement("div", {
@@ -26,9 +48,22 @@ function InfoPanelImg(_ref) {
26
48
  src: url
27
49
  })))));
28
50
  }
51
+
29
52
  function InfoPanelVideo(_ref2) {
30
53
  var url = _ref2.url,
31
- children = _ref2.children;
54
+ children = _ref2.children;
55
+ var videoWrapperRef = React.useRef(null);
56
+ React.useEffect(function () {
57
+ if (!isWX) return;
58
+ if (!videoWrapperRef.current) return;
59
+ videoElement.src = url;
60
+
61
+ if (!videoWrapperRef.current.contains(videoElement)) {
62
+ videoWrapperRef.current.appendChild(videoElement);
63
+ }
64
+
65
+ videoElement.play();
66
+ }, [videoWrapperRef.current]);
32
67
  return /*#__PURE__*/React.createElement("div", {
33
68
  className: "vreo-infoPanel-container"
34
69
  }, /*#__PURE__*/React.createElement("div", {
@@ -38,18 +73,21 @@ function InfoPanelVideo(_ref2) {
38
73
  }, /*#__PURE__*/React.createElement("div", {
39
74
  className: "vreo-infoPanel-inner"
40
75
  }, children, /*#__PURE__*/React.createElement("div", {
41
- className: "vreo-infoPanelVideo"
42
- }, /*#__PURE__*/React.createElement("video", {
76
+ className: "vreo-infoPanelVideo",
77
+ ref: videoWrapperRef
78
+ }, !isWX && /*#__PURE__*/React.createElement("video", {
43
79
  playsInline: true,
44
80
  autoPlay: true,
45
81
  className: "vreo-infoPanelVideo",
46
82
  src: url
47
83
  }))))));
48
84
  }
85
+
49
86
  var Title = function Title(props) {
50
87
  if (!props.title && !props.subTitle) {
51
88
  return null;
52
89
  }
90
+
53
91
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
54
92
  className: "vreo-infoPanel-title-shadow"
55
93
  }), /*#__PURE__*/React.createElement("div", {
@@ -60,22 +98,26 @@ var Title = function Title(props) {
60
98
  className: "vreo-infoPanel-t2"
61
99
  }, props.subTitle)));
62
100
  };
101
+
63
102
  function InfoPanel() {
64
103
  var timeoutRef = React.useRef();
65
104
  var controller = (0, _hooks.useController)();
66
105
  React.useEffect(function () {
67
106
  var _controller$configs;
107
+
68
108
  if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.InfoPanel) === false) {
69
109
  return;
70
110
  }
111
+
71
112
  var callback = function callback(keyframe) {
72
113
  var start = keyframe.start,
73
- end = keyframe.end,
74
- data = keyframe.data;
114
+ end = keyframe.end,
115
+ data = keyframe.data;
75
116
  var infoPanelData = data;
76
117
  var title = infoPanelData.title,
77
- subTitle = infoPanelData.subTitle,
78
- style = infoPanelData.style;
118
+ subTitle = infoPanelData.subTitle,
119
+ style = infoPanelData.style;
120
+
79
121
  do {
80
122
  if (style === _VreoUnit.InfoPanelStyleEnum.PopUp) {
81
123
  if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
@@ -93,8 +135,10 @@ function InfoPanel() {
93
135
  subTitle: subTitle
94
136
  })));
95
137
  }
138
+
96
139
  break;
97
140
  }
141
+
98
142
  if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
99
143
  controller.openDrawer({
100
144
  content: /*#__PURE__*/React.createElement(InfoPanelImg, {
@@ -117,14 +161,14 @@ function InfoPanel() {
117
161
  });
118
162
  }
119
163
  } while (false);
164
+
120
165
  timeoutRef.current = setTimeout(function () {
121
166
  controller.openDrawer(false);
122
167
  controller.openPopUp(false);
123
168
  }, end - start);
124
169
  };
125
- controller.on(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback);
126
170
 
127
- // Object.assign(window, {
171
+ controller.on(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback); // Object.assign(window, {
128
172
  // $setInfoPanel: () => {
129
173
  // controller.openPopUp(
130
174
  // // <InfoPanelImg url='//vrlab-static.ljcdn.com/release/web/psq/a.8e868cb2.gif' />
@@ -157,6 +201,7 @@ function InfoPanel() {
157
201
 
158
202
  return function () {
159
203
  controller.off(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback);
204
+
160
205
  if (timeoutRef.current) {
161
206
  clearTimeout(timeoutRef.current);
162
207
  }