@realsee/vreo 1.0.0-alpha.3 → 1.0.0-alpha.30

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 (166) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/README.md +46 -36
  3. package/lib/PlayController/createHTMLAudioElement.js +6 -11
  4. package/lib/PlayController/index.js +16 -81
  5. package/lib/Player/App.js +0 -24
  6. package/lib/Player/Controller.d.ts +3 -3
  7. package/lib/Player/Controller.js +47 -105
  8. package/lib/Player/custom/SpatialScenePanel/index.js +42 -68
  9. package/lib/Player/hooks.js +0 -10
  10. package/lib/Player/index.js +40 -87
  11. package/lib/Player/modules/Drawer/index.js +0 -17
  12. package/lib/Player/modules/PopUp/index.js +0 -10
  13. package/lib/Player/modules/ResizeObserver/index.js +0 -8
  14. package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +2 -2
  15. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +20 -114
  16. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +2 -24
  17. package/lib/Player/modules/VideoAgent/index.js +1 -18
  18. package/lib/Player/modules/Wave/index.js +160 -36
  19. package/lib/Player/modules/keyframes/BgMusic/index.js +50 -51
  20. package/lib/Player/modules/keyframes/CameraMovement/index.js +3 -27
  21. package/lib/Player/modules/keyframes/InfoPanel/index.js +8 -25
  22. package/lib/Player/modules/keyframes/ModelVideo/index.js +3 -29
  23. package/lib/Player/modules/keyframes/PanoEffect/index.js +15 -43
  24. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +0 -7
  25. package/lib/Player/modules/keyframes/PanoTag/index.js +7 -23
  26. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +22 -47
  27. package/lib/Player/modules/keyframes/Prompter/index.js +10 -32
  28. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +18 -25
  29. package/lib/Player/modules/keyframes/VideoEffect/index.js +12 -47
  30. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +0 -2
  31. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +0 -1
  32. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +0 -1
  33. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +19 -60
  34. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +2 -5
  35. package/lib/fivePlugins/CameraMovementPlugin/index.js +28 -75
  36. package/lib/fivePlugins/CameraMovementPlugin/typings.js +0 -4
  37. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +11 -60
  38. package/lib/index.js +0 -1
  39. package/lib/react/index.js +7 -34
  40. package/lib/shared-utils/Audio.d.ts +14 -0
  41. package/lib/shared-utils/Audio.js +159 -0
  42. package/lib/shared-utils/{AduioLike.d.ts → AudioLike.d.ts} +0 -0
  43. package/lib/shared-utils/{AduioLike.js → AudioLike.js} +9 -45
  44. package/lib/shared-utils/Preloader.js +0 -7
  45. package/lib/shared-utils/addResizeListener.js +0 -5
  46. package/lib/shared-utils/animationFrame/BetterTween.js +2 -38
  47. package/lib/shared-utils/animationFrame/index.js +2 -10
  48. package/lib/shared-utils/animationFrame/tween.js +2 -15
  49. package/lib/shared-utils/createTransMatrix.js +2 -17
  50. package/lib/shared-utils/getFileExpandedName.js +0 -1
  51. package/lib/shared-utils/getMediaInfo.js +0 -9
  52. package/lib/shared-utils/setElementDataset.js +0 -2
  53. package/lib/typings/VreoUnit.d.ts +5 -5
  54. package/lib/typings/VreoUnit.js +0 -15
  55. package/package.json +2 -4
  56. package/stylesheets/default.css +11 -4
  57. package/docs/.nojekyll +0 -1
  58. package/docs/assets/custom.css +0 -78
  59. package/docs/assets/highlight.css +0 -127
  60. package/docs/assets/icons.css +0 -1043
  61. package/docs/assets/icons.png +0 -0
  62. package/docs/assets/icons@2x.png +0 -0
  63. package/docs/assets/main.js +0 -52
  64. package/docs/assets/search.js +0 -1
  65. package/docs/assets/style.css +0 -1414
  66. package/docs/assets/widgets.png +0 -0
  67. package/docs/assets/widgets@2x.png +0 -0
  68. package/docs/classes/Player.AudioLike.html +0 -52
  69. package/docs/classes/Player.Controller.html +0 -54
  70. package/docs/classes/Player.Player-1.html +0 -50
  71. package/docs/classes/Player.VideoAgentMesh.html +0 -142
  72. package/docs/classes/Player.VideoAgentScene.html +0 -1
  73. package/docs/demo/assets/AppReact.39bef668.js +0 -1
  74. package/docs/demo/assets/default.9bbb3329.js +0 -3984
  75. package/docs/demo/assets/default.f3f3ca8c.css +0 -1
  76. package/docs/demo/assets/dynamic.5e9275ce.js +0 -1
  77. package/docs/demo/assets/examples.2ac45f33.js +0 -25
  78. package/docs/demo/assets/examples.dac4a6fe.css +0 -1
  79. package/docs/demo/assets/index.6699bd11.js +0 -1
  80. package/docs/demo/assets/index.9331038f.css +0 -1
  81. package/docs/demo/assets/main.a0741cbc.js +0 -1
  82. package/docs/demo/assets/react.2ee8565f.css +0 -1
  83. package/docs/demo/assets/react.a3f20ea9.js +0 -25
  84. package/docs/demo/assets/znRoyv06SZQeqA7m.0057e8ae.js +0 -1
  85. package/docs/demo/examples.html +0 -17
  86. package/docs/demo/index-react-dynamic.html +0 -20
  87. package/docs/demo/index-react.html +0 -20
  88. package/docs/demo/index.html +0 -19
  89. package/docs/enums/Player.InfoPanelStyleEnum.html +0 -1
  90. package/docs/enums/Player.InfoPanelTypeEnum.html +0 -3
  91. package/docs/enums/Player.PanoEffectEnum.html +0 -5
  92. package/docs/enums/Player.PanoTagEnum.html +0 -3
  93. package/docs/enums/Player.PanoTagStyleEnum.html +0 -7
  94. package/docs/enums/Player.VreoKeyframeEnum.html +0 -25
  95. package/docs/enums/fivePlugins.CameraMovementEffect.html +0 -1
  96. package/docs/enums/fivePlugins.Rotation.html +0 -1
  97. package/docs/index.html +0 -245
  98. package/docs/interfaces/Player.CustomVreoKeyframeProps.html +0 -1
  99. package/docs/interfaces/Player.PlayerConfigs.html +0 -7
  100. package/docs/interfaces/Player.Vertex.html +0 -3
  101. package/docs/interfaces/Player.VideoAgentMeshOptions.html +0 -8
  102. package/docs/interfaces/Player.VreoKeyframe.html +0 -3
  103. package/docs/interfaces/Player.VreoUnit.html +0 -3
  104. package/docs/interfaces/Player.VreoVideo.html +0 -3
  105. package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +0 -4
  106. package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +0 -1
  107. package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +0 -7
  108. package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +0 -1
  109. package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +0 -1
  110. package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +0 -1
  111. package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +0 -1
  112. package/docs/interfaces/fivePlugins.Vector3Position.html +0 -3
  113. package/docs/interfaces/react.VreoActionCallbacks.html +0 -23
  114. package/docs/interfaces/react.VreoProviderProps.html +0 -1
  115. package/docs/modules/Player.html +0 -37
  116. package/docs/modules/custom.html +0 -3
  117. package/docs/modules/fivePlugins.html +0 -6
  118. package/docs/modules/react.html +0 -1
  119. package/docs/modules.html +0 -1
  120. package/resources/PlayController/createHTMLAudioElement.ts +0 -53
  121. package/resources/PlayController/index.ts +0 -154
  122. package/resources/Player/App.tsx +0 -66
  123. package/resources/Player/Controller.ts +0 -297
  124. package/resources/Player/custom/SpatialScenePanel/index.tsx +0 -264
  125. package/resources/Player/hooks.ts +0 -26
  126. package/resources/Player/index.tsx +0 -225
  127. package/resources/Player/modules/Drawer/index.tsx +0 -40
  128. package/resources/Player/modules/PopUp/index.tsx +0 -26
  129. package/resources/Player/modules/ResizeObserver/index.tsx +0 -23
  130. package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +0 -302
  131. package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +0 -56
  132. package/resources/Player/modules/VideoAgent/index.tsx +0 -53
  133. package/resources/Player/modules/Wave/index.tsx +0 -18
  134. package/resources/Player/modules/keyframes/BgMusic/index.tsx +0 -66
  135. package/resources/Player/modules/keyframes/CameraMovement/index.tsx +0 -37
  136. package/resources/Player/modules/keyframes/InfoPanel/index.tsx +0 -165
  137. package/resources/Player/modules/keyframes/ModelVideo/index.tsx +0 -77
  138. package/resources/Player/modules/keyframes/PanoEffect/index.tsx +0 -99
  139. package/resources/Player/modules/keyframes/PanoEffect/lineAnime.ts +0 -31
  140. package/resources/Player/modules/keyframes/PanoTag/index.tsx +0 -83
  141. package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +0 -117
  142. package/resources/Player/modules/keyframes/Prompter/index.tsx +0 -56
  143. package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +0 -99
  144. package/resources/Player/modules/keyframes/VideoEffect/index.tsx +0 -115
  145. package/resources/Player/typings.ts +0 -49
  146. package/resources/fivePlugins/CSS3DRenderPlugin/centerPoint.ts +0 -5
  147. package/resources/fivePlugins/CSS3DRenderPlugin/createResizeObserver.ts +0 -17
  148. package/resources/fivePlugins/CSS3DRenderPlugin/evenNumber.ts +0 -4
  149. package/resources/fivePlugins/CSS3DRenderPlugin/index.ts +0 -254
  150. package/resources/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.ts +0 -5
  151. package/resources/fivePlugins/CameraMovementPlugin/index.ts +0 -226
  152. package/resources/fivePlugins/CameraMovementPlugin/typings.ts +0 -59
  153. package/resources/fivePlugins/ModelTVVideoPlugin/index.ts +0 -278
  154. package/resources/index.ts +0 -1
  155. package/resources/react/index.tsx +0 -121
  156. package/resources/shared-utils/AduioLike.ts +0 -109
  157. package/resources/shared-utils/Preloader.ts +0 -35
  158. package/resources/shared-utils/addResizeListener.ts +0 -46
  159. package/resources/shared-utils/animationFrame/BetterTween.ts +0 -33
  160. package/resources/shared-utils/animationFrame/index.ts +0 -48
  161. package/resources/shared-utils/animationFrame/tween.ts +0 -51
  162. package/resources/shared-utils/createTransMatrix.ts +0 -12
  163. package/resources/shared-utils/getFileExpandedName.ts +0 -6
  164. package/resources/shared-utils/getMediaInfo.ts +0 -52
  165. package/resources/shared-utils/setElementDataset.ts +0 -18
  166. package/resources/typings/VreoUnit.ts +0 -314
@@ -1,51 +1,175 @@
1
1
  "use strict";
2
2
 
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); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.Wave = Wave;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
-
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ 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); }
10
+ 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; }
11
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
+ 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."); }
13
+ 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); }
14
+ 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; }
15
+ 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; }
16
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
+ var prefix = 'https://vr-public.realsee-cdn.cn/release/static/image/release/';
18
+ var WAVES = {
19
+ single: {
20
+ width: 766,
21
+ height: 60,
22
+ frames: 20,
23
+ hevc: 'vapor/static/wave-single.140d197f4838c130b69e87dfd0705479.mov',
24
+ vp9: 'vapor/static/wave-single.eda65de390a830193fff40d1f1255555.webm',
25
+ png: 'vapor/static/wave-single.f51aade2a6e1c59211698a1a24e6135f.png'
26
+ },
27
+ "double": {
28
+ width: 766,
29
+ height: 60,
30
+ frames: 16,
31
+ hevc: 'vapor/static/wave-double.3e6d73050ee6958cc3060b107ebe5f39.mov',
32
+ vp9: '/vapor/static/wave-double.77dfe8548ebcb3f3d336785d4fe9c7b2.webm',
33
+ png: '/vapor/static/wave-double.ab4fe7d8a70395109ca4f759af7bd53f.png'
34
+ },
35
+ solid: {
36
+ width: 1126,
37
+ height: 90,
38
+ frames: 48,
39
+ hevc: 'vapor/static/wave-solid.cf68912a93275d07aa6b5097ea11fdda.mov',
40
+ vp9: 'vapor/static/wave-solid.64438b63cbb346906d066bb7b8dc3e20.webm',
41
+ png: 'vapor/static/wave-solid.6969d7f3f2f44f7ac1ade30e65660cb1.png'
42
+ },
43
+ swap: {
44
+ width: 2250,
45
+ height: 180,
46
+ frames: 41,
47
+ hevc: 'vapor/static/wave-swap.b38f22e2cf84ee21e9be35f7f56c9cfc.mov',
48
+ vp9: 'vapor/static/wave-swap.c02e4b94cf05aecf6e7a0023bc7bb90f.webm',
49
+ png: 'vapor/static/wave-swap.772ba526a7210dcc01567062c6319545.png'
50
+ },
51
+ expand: {
52
+ width: 2250,
53
+ height: 180,
54
+ frames: 45,
55
+ hevc: 'vapor/static/wave-expand.9529956c5954740cd4c9d07d51e32822.mov',
56
+ vp9: 'vapor/static/wave-expand.a0d2a0074001cd3d4fea56818c6d3c38.webm',
57
+ png: 'vapor/static/wave-expand.62fcf27b445533e6eb1b17bab5eafa0d.png'
58
+ }
59
+ };
60
+ var userAgent = typeof navigator !== 'undefined' ? navigator.userAgent : '';
61
+ var isAppleDevice = /(iPhone|iPad|iPod)/i.test(userAgent);
62
+ var isSafari = /safari/i.test(userAgent) && !/chrome/i.test(userAgent) && /version/i.test(userAgent);
63
+ var isMicroMessenger = /microMessenger/i.test(userAgent);
64
+ var canPlayHevc = isAppleDevice || isSafari;
65
+ var canPlayVp9 = typeof MediaSource !== 'undefined' && MediaSource.isTypeSupported("video/webm; codecs=vp9");
12
66
  function Wave(props) {
13
- var waveUrl = _react["default"].useMemo(function () {
67
+ var wave = _react["default"].useMemo(function () {
14
68
  var _props$appearance;
15
-
16
69
  var appearance = (_props$appearance = props === null || props === void 0 ? void 0 : props.appearance) !== null && _props$appearance !== void 0 ? _props$appearance : 'solid';
17
-
18
- switch (appearance) {
19
- default:
20
- return 'https://vr-public.realsee-cdn.cn/release/static/image/release/vapor/static/wave-solid.64438b63cbb346906d066bb7b8dc3e20.webm';
21
-
22
- case 'solid':
23
- return 'https://vr-public.realsee-cdn.cn/release/static/image/release/vapor/static/wave-solid.64438b63cbb346906d066bb7b8dc3e20.webm';
24
-
25
- case 'single':
26
- return 'https://vr-public.realsee-cdn.cn/release/static/image/release/vapor/static/wave-single.eda65de390a830193fff40d1f1255555.webm';
27
-
28
- case 'double':
29
- return 'https://vr-public.realsee-cdn.cn/release/static/image/release/vapor/static/wave-double.77dfe8548ebcb3f3d336785d4fe9c7b2.webm';
30
-
31
- case 'swap':
32
- return 'https://vr-public.realsee-cdn.cn/release/static/image/release/vapor/static/wave-swap.c02e4b94cf05aecf6e7a0023bc7bb90f.webm';
33
-
34
- case 'expand':
35
- return 'https://vr-public.realsee-cdn.cn/release/static/image/release/vapor/static/wave-expand.a0d2a0074001cd3d4fea56818c6d3c38.webm';
36
- }
70
+ return WAVES[appearance];
37
71
  }, [props === null || props === void 0 ? void 0 : props.appearance]);
38
-
72
+ var heightWidthRatio = _react["default"].useMemo(function () {
73
+ return wave.height / wave.width;
74
+ }, [wave]);
75
+ var content = null;
76
+ if (isMicroMessenger) {
77
+ content = /*#__PURE__*/_react["default"].createElement(KeyframeWaveContent, {
78
+ wave: wave
79
+ });
80
+ } else if (canPlayHevc) {
81
+ content = /*#__PURE__*/_react["default"].createElement(VideoWaveContent, {
82
+ format: "hevc",
83
+ wave: wave
84
+ });
85
+ } else if (canPlayVp9) {
86
+ content = /*#__PURE__*/_react["default"].createElement(VideoWaveContent, {
87
+ format: "vp9",
88
+ wave: wave
89
+ });
90
+ } else {
91
+ content = /*#__PURE__*/_react["default"].createElement(KeyframeWaveContent, {
92
+ wave: wave
93
+ });
94
+ }
95
+ return /*#__PURE__*/_react["default"].createElement("div", {
96
+ className: "vreo-wave"
97
+ }, /*#__PURE__*/_react["default"].createElement("div", {
98
+ style: {
99
+ position: 'relative',
100
+ width: '100%',
101
+ paddingTop: "".concat(heightWidthRatio * 100, "%")
102
+ }
103
+ }, /*#__PURE__*/_react["default"].createElement("div", {
104
+ style: {
105
+ position: 'absolute',
106
+ width: '100%',
107
+ height: '100%',
108
+ left: 0,
109
+ top: 0
110
+ }
111
+ }, content)));
112
+ }
113
+ var VideoWaveContent = function VideoWaveContent(_ref) {
114
+ var wave = _ref.wave,
115
+ format = _ref.format;
116
+ var videoRef = (0, _react.useRef)(null);
117
+ var _useState = (0, _react.useState)(false),
118
+ _useState2 = _slicedToArray(_useState, 2),
119
+ canPlay = _useState2[0],
120
+ setCanPlay = _useState2[1];
121
+ var _useState3 = (0, _react.useState)(false),
122
+ _useState4 = _slicedToArray(_useState3, 2),
123
+ errored = _useState4[0],
124
+ setErrored = _useState4[1];
125
+ var source = prefix + wave[format];
126
+ (0, _react.useEffect)(function () {
127
+ setCanPlay(false);
128
+ }, [source]);
129
+ var canPlayHandler = (0, _react.useCallback)(function () {
130
+ if (videoRef.current) {
131
+ videoRef.current.play();
132
+ }
133
+ setCanPlay(true);
134
+ }, []);
135
+ var errorHandler = (0, _react.useCallback)(function () {
136
+ setErrored(true);
137
+ }, []);
138
+ if (errored) {
139
+ return /*#__PURE__*/_react["default"].createElement(KeyframeWaveContent, {
140
+ wave: wave
141
+ });
142
+ }
39
143
  return /*#__PURE__*/_react["default"].createElement("video", {
40
- className: "vreo-wave",
41
- width: "100%",
144
+ style: {
145
+ opacity: canPlay ? 1 : 0
146
+ },
42
147
  preload: "auto",
43
- muted: true,
148
+ ref: videoRef,
149
+ width: "100%",
150
+ height: "100%",
151
+ playsInline: true,
44
152
  autoPlay: true,
153
+ onCanPlay: canPlayHandler,
154
+ onError: errorHandler,
155
+ muted: true,
45
156
  loop: true,
46
- playsInline: true,
47
- disablePictureInPicture: true,
48
- controls: false,
49
- src: waveUrl
157
+ src: source
158
+ });
159
+ };
160
+ var KeyframeWaveContent = function KeyframeWaveContent(_ref2) {
161
+ var wave = _ref2.wave;
162
+ var source = prefix + wave.png;
163
+ return /*#__PURE__*/_react["default"].createElement("div", {
164
+ style: {
165
+ width: "100%",
166
+ height: "100%",
167
+ backgroundImage: "url(".concat(source, ")"),
168
+ backgroundSize: "100%",
169
+ animationName: "vreo-wave-keyframes",
170
+ animationTimingFunction: "steps(".concat(wave.frames - 1, ")"),
171
+ animationDuration: "".concat(wave.frames / 25, "s"),
172
+ animationIterationCount: 'infinite'
173
+ }
50
174
  });
51
- }
175
+ };
@@ -1,75 +1,74 @@
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
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.BgMusic = BgMusic;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
9
+ var _Audio = require("../../../../shared-utils/Audio");
12
10
  var _VreoUnit = require("../../../../typings/VreoUnit");
13
-
14
11
  var _hooks = require("../../../hooks");
15
-
12
+ var _location$search$matc, _location$search$matc2;
16
13
  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
-
18
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; }
19
-
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; }
16
+ 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); } }
17
+ 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); }); }; }
18
+ var DefaultAudioCacheLength = 3;
19
+ var audioCacheLength = Number((_location$search$matc = (_location$search$matc2 = location.search.match(/audio_cache=(\d+)/)) === null || _location$search$matc2 === void 0 ? void 0 : _location$search$matc2[1]) !== null && _location$search$matc !== void 0 ? _location$search$matc : DefaultAudioCacheLength);
20
+ (0, _Audio.generateBlankAudio)(audioCacheLength);
20
21
  function BgMusic() {
21
22
  var controller = (0, _hooks.useController)();
22
- var timeoutIdRef = React.useRef(null);
23
- var cleanTimeout = React.useCallback(function () {
24
- if (timeoutIdRef.current) {
25
- clearTimeout(timeoutIdRef.current);
26
- timeoutIdRef.current = null;
27
- }
28
- }, []);
29
23
  React.useEffect(function () {
30
- var audio = new Audio();
31
- audio.setAttribute('id', 'vreo-singleton-bgmusic');
32
- audio.style.display = 'none';
33
- audio.setAttribute('playsinline', 'true');
34
- audio.loop = true;
35
- document.body.append(audio);
24
+ var callback = /*#__PURE__*/function () {
25
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(keyframe, currentTime) {
26
+ var start, end, _currentTime, audio, cleanAudio;
27
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
28
+ while (1) {
29
+ switch (_context.prev = _context.next) {
30
+ case 0:
31
+ start = keyframe.start, end = keyframe.end;
32
+ _currentTime = (currentTime - start) / 1000;
33
+ if (!(_currentTime < 0 || _currentTime >= keyframe.end - keyframe.start)) {
34
+ _context.next = 4;
35
+ break;
36
+ }
37
+ return _context.abrupt("return");
38
+ case 4:
39
+ audio = (0, _Audio.getAudio)(keyframe.data.url);
40
+ audio.currentTime = Math.max(0, _currentTime);
41
+ console.log('play', audio.src);
42
+ // const play = () => audio.play()
36
43
 
37
- var callback = function callback(keyframe) {
38
- var start = keyframe.start,
39
- end = keyframe.end;
40
- var _ref = keyframe.data,
41
- url = _ref.url;
42
- audio.src = url;
44
+ audio.play();
45
+ cleanAudio = function cleanAudio() {
46
+ // audio.removeEventListener('canplaythrough', play)
47
+ audio.pause();
48
+ audio.src = '';
49
+ // cleanTimeout()
50
+ }; // audio.addEventListener('canplaythrough', play)
43
51
 
44
- var playCallback = function playCallback() {
45
- audio.play();
52
+ audio.addEventListener('ended', function () {
53
+ cleanAudio();
54
+ });
55
+ controller.once('paused', function () {
56
+ cleanAudio();
57
+ });
58
+ case 11:
59
+ case "end":
60
+ return _context.stop();
61
+ }
62
+ }
63
+ }, _callee);
64
+ }));
65
+ return function callback(_x, _x2) {
66
+ return _ref.apply(this, arguments);
46
67
  };
47
-
48
- audio.addEventListener('canplaythrough', playCallback);
49
- cleanTimeout();
50
-
51
- var cleanAudio = function cleanAudio() {
52
- audio.pause();
53
- audio.currentTime = 0;
54
- audio.src = '';
55
- cleanTimeout();
56
- audio.removeEventListener('canplaythrough', playCallback);
57
- };
58
-
59
- var duration = end - start || 5000;
60
- timeoutIdRef.current = setTimeout(function () {
61
- cleanAudio();
62
- }, duration);
63
- controller.once('paused', function () {
64
- cleanAudio();
65
- });
66
- };
67
-
68
+ }();
68
69
  controller.on(_VreoUnit.VreoKeyframeEnum.BgMusic, callback);
69
70
  return function () {
70
71
  controller.off(_VreoUnit.VreoKeyframeEnum.BgMusic, callback);
71
- document.body.removeChild(audio);
72
- cleanTimeout();
73
72
  };
74
73
  });
75
74
  return /*#__PURE__*/React.createElement(React.Fragment, null);
@@ -1,92 +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
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.CameraMovement = CameraMovement;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var _CameraMovementPlugin = require("../../../../fivePlugins/CameraMovementPlugin");
13
-
14
10
  var _typings = require("../../../../fivePlugins/CameraMovementPlugin/typings");
15
-
16
11
  var _VreoUnit = require("../../../../typings/VreoUnit");
17
-
18
12
  var _hooks = require("../../../hooks");
19
-
20
13
  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
-
22
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; }
23
-
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; }
24
16
  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
-
26
17
  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
-
28
18
  function CameraMovement() {
29
19
  var controller = (0, _hooks.useController)();
30
20
  var five = (0, _hooks.useFiveInstance)();
31
21
  var ref = React.useRef();
32
22
  React.useEffect(function () {
33
23
  var callback = /*#__PURE__*/function () {
34
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(keyframe) {
24
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(keyframe) {
35
25
  var start, end, data, cameraMovementData, effect;
36
- return regeneratorRuntime.wrap(function _callee$(_context) {
26
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
37
27
  while (1) {
38
28
  switch (_context.prev = _context.next) {
39
29
  case 0:
40
30
  if (!ref.current) {
41
31
  ref.current = (0, _CameraMovementPlugin.CameraMovementPlugin)(five, {});
42
32
  }
43
-
44
33
  start = keyframe.start, end = keyframe.end, data = keyframe.data;
45
34
  cameraMovementData = data;
46
35
  effect = cameraMovementData.effect;
47
-
48
36
  if (!(effect === _typings.CameraMovementEffect.Rotate)) {
49
37
  _context.next = 9;
50
38
  break;
51
39
  }
52
-
53
40
  _context.next = 7;
54
41
  return ref.current.rotate(data, end - start);
55
-
56
42
  case 7:
57
43
  _context.next = 21;
58
44
  break;
59
-
60
45
  case 9:
61
46
  if (!(effect === _typings.CameraMovementEffect.Move)) {
62
47
  _context.next = 14;
63
48
  break;
64
49
  }
65
-
66
50
  _context.next = 12;
67
51
  return ref.current.move(data, end - start);
68
-
69
52
  case 12:
70
53
  _context.next = 21;
71
54
  break;
72
-
73
55
  case 14:
74
56
  if (!(cameraMovementData.panoIndex !== undefined && cameraMovementData.panoIndex !== five.panoIndex)) {
75
57
  _context.next = 19;
76
58
  break;
77
59
  }
78
-
79
60
  _context.next = 17;
80
61
  return ref.current.move(data, end - start);
81
-
82
62
  case 17:
83
63
  _context.next = 21;
84
64
  break;
85
-
86
65
  case 19:
87
66
  _context.next = 21;
88
67
  return ref.current.rotate(data, end - start);
89
-
90
68
  case 21:
91
69
  case "end":
92
70
  return _context.stop();
@@ -94,12 +72,10 @@ function CameraMovement() {
94
72
  }
95
73
  }, _callee);
96
74
  }));
97
-
98
75
  return function callback(_x) {
99
76
  return _ref.apply(this, arguments);
100
77
  };
101
78
  }();
102
-
103
79
  controller.on(_VreoUnit.VreoKeyframeEnum.CameraMovement, callback);
104
80
  return function () {
105
81
  controller.off(_VreoUnit.VreoKeyframeEnum.CameraMovement, callback);
@@ -1,25 +1,18 @@
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
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.InfoPanel = InfoPanel;
9
-
10
8
  var React = _interopRequireWildcard(require("react"));
11
-
12
9
  var _VreoUnit = require("../../../../typings/VreoUnit");
13
-
14
10
  var _hooks = require("../../../hooks");
15
-
16
11
  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
-
18
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
-
20
13
  function InfoPanelImg(_ref) {
21
14
  var url = _ref.url,
22
- children = _ref.children;
15
+ children = _ref.children;
23
16
  return /*#__PURE__*/React.createElement("div", {
24
17
  className: "vreo-infoPanel-container"
25
18
  }, /*#__PURE__*/React.createElement("div", {
@@ -33,10 +26,9 @@ function InfoPanelImg(_ref) {
33
26
  src: url
34
27
  })))));
35
28
  }
36
-
37
29
  function InfoPanelVideo(_ref2) {
38
30
  var url = _ref2.url,
39
- children = _ref2.children;
31
+ children = _ref2.children;
40
32
  return /*#__PURE__*/React.createElement("div", {
41
33
  className: "vreo-infoPanel-container"
42
34
  }, /*#__PURE__*/React.createElement("div", {
@@ -54,12 +46,10 @@ function InfoPanelVideo(_ref2) {
54
46
  src: url
55
47
  }))))));
56
48
  }
57
-
58
49
  var Title = function Title(props) {
59
50
  if (!props.title && !props.subTitle) {
60
51
  return null;
61
52
  }
62
-
63
53
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
64
54
  className: "vreo-infoPanel-title-shadow"
65
55
  }), /*#__PURE__*/React.createElement("div", {
@@ -70,26 +60,22 @@ var Title = function Title(props) {
70
60
  className: "vreo-infoPanel-t2"
71
61
  }, props.subTitle)));
72
62
  };
73
-
74
63
  function InfoPanel() {
75
64
  var timeoutRef = React.useRef();
76
65
  var controller = (0, _hooks.useController)();
77
66
  React.useEffect(function () {
78
67
  var _controller$configs;
79
-
80
68
  if (((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.keyframeMap.InfoPanel) === false) {
81
69
  return;
82
70
  }
83
-
84
71
  var callback = function callback(keyframe) {
85
72
  var start = keyframe.start,
86
- end = keyframe.end,
87
- data = keyframe.data;
73
+ end = keyframe.end,
74
+ data = keyframe.data;
88
75
  var infoPanelData = data;
89
76
  var title = infoPanelData.title,
90
- subTitle = infoPanelData.subTitle,
91
- style = infoPanelData.style;
92
-
77
+ subTitle = infoPanelData.subTitle,
78
+ style = infoPanelData.style;
93
79
  do {
94
80
  if (style === _VreoUnit.InfoPanelStyleEnum.PopUp) {
95
81
  if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
@@ -107,10 +93,8 @@ function InfoPanel() {
107
93
  subTitle: subTitle
108
94
  })));
109
95
  }
110
-
111
96
  break;
112
97
  }
113
-
114
98
  if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
115
99
  controller.openDrawer({
116
100
  content: /*#__PURE__*/React.createElement(InfoPanelImg, {
@@ -133,14 +117,14 @@ function InfoPanel() {
133
117
  });
134
118
  }
135
119
  } while (false);
136
-
137
120
  timeoutRef.current = setTimeout(function () {
138
121
  controller.openDrawer(false);
139
122
  controller.openPopUp(false);
140
123
  }, end - start);
141
124
  };
125
+ controller.on(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback);
142
126
 
143
- controller.on(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback); // Object.assign(window, {
127
+ // Object.assign(window, {
144
128
  // $setInfoPanel: () => {
145
129
  // controller.openPopUp(
146
130
  // // <InfoPanelImg url='//vrlab-static.ljcdn.com/release/web/psq/a.8e868cb2.gif' />
@@ -173,7 +157,6 @@ function InfoPanel() {
173
157
 
174
158
  return function () {
175
159
  controller.off(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback);
176
-
177
160
  if (timeoutRef.current) {
178
161
  clearTimeout(timeoutRef.current);
179
162
  }