@realsee/vreo 0.2.0-alpha.2 → 0.2.0-alpha.20

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 (147) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +80 -5
  3. package/docs/assets/custom.css +2 -2
  4. package/docs/assets/highlight.css +1 -1
  5. package/docs/assets/main.js +2 -2
  6. package/docs/assets/search.js +1 -1
  7. package/docs/assets/style.css +28 -2
  8. package/docs/classes/Player.AudioLike.html +52 -0
  9. package/docs/classes/Player.Controller.html +13 -13
  10. package/docs/classes/Player.Player-1.html +11 -11
  11. package/docs/classes/Player.VideoAgentMesh.html +53 -53
  12. package/docs/classes/Player.VideoAgentScene.html +1 -1
  13. package/docs/demo/assets/AppReact.ec0a6e82.js +1 -0
  14. package/docs/demo/assets/default.55c3f308.css +1 -0
  15. package/docs/demo/assets/default.a5d6dd99.js +3952 -0
  16. package/docs/demo/assets/dynamic.8c30b7ae.js +1 -0
  17. package/docs/demo/assets/examples.dac4a6fe.css +1 -0
  18. package/docs/demo/assets/examples.ddb41c97.js +25 -0
  19. package/docs/demo/assets/index.a7bafdff.css +1 -0
  20. package/docs/demo/assets/index.fc42be2b.js +1 -0
  21. package/docs/demo/assets/main.d119ebf7.js +1 -0
  22. package/docs/demo/assets/react.2d403aee.js +25 -0
  23. package/docs/demo/assets/react.855b3d23.css +1 -0
  24. package/docs/demo/assets/znRoyv06SZQeqA7m.0057e8ae.js +1 -0
  25. package/docs/demo/examples.html +17 -0
  26. package/docs/demo/index-react-dynamic.html +20 -0
  27. package/docs/demo/index-react.html +20 -0
  28. package/docs/demo/index.html +19 -0
  29. package/docs/enums/Player.InfoPanelStyleEnum.html +1 -0
  30. package/docs/enums/Player.InfoPanelTypeEnum.html +2 -2
  31. package/docs/enums/Player.PanoEffectEnum.html +2 -2
  32. package/docs/enums/Player.PanoTagEnum.html +2 -2
  33. package/docs/enums/Player.PanoTagStyleEnum.html +7 -0
  34. package/docs/enums/Player.VreoKeyframeEnum.html +12 -12
  35. package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -1
  36. package/docs/enums/fivePlugins.Rotation.html +1 -1
  37. package/docs/index.html +37 -6
  38. package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -1
  39. package/docs/interfaces/Player.PlayerConfigs.html +3 -3
  40. package/docs/interfaces/Player.Vertex.html +2 -2
  41. package/docs/interfaces/Player.VideoAgentMeshOptions.html +8 -1
  42. package/docs/interfaces/Player.VreoKeyframe.html +2 -2
  43. package/docs/interfaces/Player.VreoUnit.html +2 -2
  44. package/docs/interfaces/Player.VreoVideo.html +2 -2
  45. package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +4 -0
  46. package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +1 -1
  47. package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +2 -2
  48. package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +1 -1
  49. package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +1 -1
  50. package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +1 -1
  51. package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +1 -1
  52. package/docs/interfaces/fivePlugins.Vector3Position.html +3 -0
  53. package/docs/interfaces/react.VreoActionCallbacks.html +15 -7
  54. package/docs/interfaces/react.VreoProviderProps.html +1 -1
  55. package/docs/modules/Player.html +21 -15
  56. package/docs/modules/custom.html +1 -1
  57. package/docs/modules/fivePlugins.html +5 -2
  58. package/docs/modules/react.html +1 -1
  59. package/docs/modules.html +1 -1
  60. package/lib/PlayController/createHTMLAudioElement.d.ts +1 -0
  61. package/lib/PlayController/createHTMLAudioElement.js +47 -0
  62. package/lib/PlayController/index.d.ts +38 -0
  63. package/lib/PlayController/index.js +300 -0
  64. package/lib/Player/App.js +5 -4
  65. package/lib/Player/Controller.d.ts +5 -1
  66. package/lib/Player/Controller.js +38 -5
  67. package/lib/Player/custom/SpatialScenePanel/index.d.ts +2 -2
  68. package/lib/Player/custom/SpatialScenePanel/index.js +98 -26
  69. package/lib/Player/index.d.ts +3 -2
  70. package/lib/Player/index.js +116 -24
  71. package/lib/Player/modules/Drawer/index.js +1 -1
  72. package/lib/Player/modules/PopUp/index.d.ts +2 -0
  73. package/lib/Player/modules/PopUp/index.js +43 -0
  74. package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +17 -2
  75. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +113 -37
  76. package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +5 -1
  77. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +9 -4
  78. package/lib/Player/modules/VideoAgent/index.d.ts +2 -0
  79. package/lib/Player/modules/VideoAgent/index.js +2 -2
  80. package/lib/Player/modules/keyframes/BgMusic/index.js +1 -1
  81. package/lib/Player/modules/keyframes/CameraMovement/index.js +42 -6
  82. package/lib/Player/modules/keyframes/InfoPanel/index.js +74 -36
  83. package/lib/Player/modules/keyframes/ModelVideo/index.js +46 -9
  84. package/lib/Player/modules/keyframes/PanoEffect/index.js +1 -1
  85. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +1 -1
  86. package/lib/Player/modules/keyframes/PanoTag/index.js +20 -7
  87. package/lib/Player/modules/keyframes/PanoTextLabel/index.d.ts +3 -0
  88. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +96 -51
  89. package/lib/Player/modules/keyframes/Prompter/index.js +5 -19
  90. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +31 -19
  91. package/lib/Player/modules/keyframes/VideoEffect/index.js +1 -1
  92. package/lib/Player/typings.d.ts +6 -0
  93. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.d.ts +2 -0
  94. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +12 -0
  95. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.d.ts +7 -0
  96. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +32 -0
  97. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.d.ts +3 -0
  98. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +11 -0
  99. package/lib/fivePlugins/CSS3DRenderPlugin/index.d.ts +56 -0
  100. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +275 -0
  101. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.d.ts +7 -0
  102. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +18 -0
  103. package/lib/fivePlugins/CameraMovementPlugin/index.js +104 -90
  104. package/lib/fivePlugins/CameraMovementPlugin/typings.d.ts +1 -0
  105. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +1 -1
  106. package/lib/react/index.d.ts +7 -3
  107. package/lib/react/index.js +3 -3
  108. package/lib/shared-utils/AduioLike.d.ts +37 -0
  109. package/lib/shared-utils/AduioLike.js +165 -0
  110. package/lib/shared-utils/animationFrame/BetterTween.js +7 -3
  111. package/lib/shared-utils/animationFrame/tween.js +1 -1
  112. package/lib/shared-utils/createTransMatrix.d.ts +1 -0
  113. package/lib/shared-utils/createTransMatrix.js +43 -0
  114. package/lib/typings/VreoUnit.d.ts +42 -5
  115. package/lib/typings/VreoUnit.js +26 -6
  116. package/package.json +8 -8
  117. package/resources/PlayController/createHTMLAudioElement.ts +53 -0
  118. package/resources/PlayController/index.ts +167 -0
  119. package/resources/Player/App.tsx +2 -0
  120. package/resources/Player/Controller.ts +155 -121
  121. package/resources/Player/custom/SpatialScenePanel/index.tsx +148 -45
  122. package/resources/Player/index.tsx +186 -110
  123. package/resources/Player/modules/PopUp/index.tsx +26 -0
  124. package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +66 -14
  125. package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +3 -3
  126. package/resources/Player/modules/VideoAgent/index.tsx +3 -2
  127. package/resources/Player/modules/keyframes/CameraMovement/index.tsx +7 -3
  128. package/resources/Player/modules/keyframes/InfoPanel/index.tsx +79 -34
  129. package/resources/Player/modules/keyframes/ModelVideo/index.tsx +36 -3
  130. package/resources/Player/modules/keyframes/PanoTag/index.tsx +31 -12
  131. package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +87 -34
  132. package/resources/Player/modules/keyframes/Prompter/index.tsx +5 -15
  133. package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +25 -16
  134. package/resources/Player/typings.ts +5 -0
  135. package/resources/fivePlugins/CSS3DRenderPlugin/centerPoint.ts +5 -0
  136. package/resources/fivePlugins/CSS3DRenderPlugin/createResizeObserver.ts +17 -0
  137. package/resources/fivePlugins/CSS3DRenderPlugin/evenNumber.ts +4 -0
  138. package/resources/fivePlugins/CSS3DRenderPlugin/index.ts +254 -0
  139. package/resources/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.ts +5 -0
  140. package/resources/fivePlugins/CameraMovementPlugin/index.ts +59 -48
  141. package/resources/fivePlugins/CameraMovementPlugin/typings.ts +2 -1
  142. package/resources/react/index.tsx +7 -3
  143. package/resources/shared-utils/AduioLike.ts +108 -0
  144. package/resources/shared-utils/createTransMatrix.ts +12 -0
  145. package/resources/typings/VreoUnit.ts +46 -5
  146. package/stylesheets/custom/SpatialScenePanel.css +14 -8
  147. package/stylesheets/default.css +116 -12
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -13,6 +13,10 @@ var _Preloader = require("../../../shared-utils/Preloader");
13
13
 
14
14
  var _mobx = require("mobx");
15
15
 
16
+ var _AduioLike = _interopRequireDefault(require("../../../shared-utils/AduioLike"));
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
+
16
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); }
17
21
 
18
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; }
@@ -25,9 +29,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
25
29
 
26
30
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
27
31
 
28
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
32
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
29
33
 
30
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
34
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
31
35
 
32
36
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
37
 
@@ -66,9 +70,13 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
66
70
  * @param options
67
71
  */
68
72
  function VideoAgentMesh(width, height, widthSegments, heightSegments) {
73
+ var _this$options$videoIn, _this$options$videoIn2, _this$options$videoIn3;
74
+
69
75
  var _this;
70
76
 
71
- var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
77
+ var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
78
+ preload: true
79
+ };
72
80
 
73
81
  _classCallCheck(this, VideoAgentMesh);
74
82
 
@@ -106,7 +114,8 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
106
114
  _this.options = options;
107
115
  _this.freeze = false;
108
116
  _this.paused = true;
109
- {
117
+
118
+ if (!options.audioInstance) {
110
119
  if (cacheInstance.audioInstance) {
111
120
  _this.audioInstance = cacheInstance.audioInstance;
112
121
  } else {
@@ -122,7 +131,11 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
122
131
  _this.audioInstance = audioInstance;
123
132
  cacheInstance.audioInstance = audioInstance;
124
133
  }
134
+ } else {
135
+ _this.audioInstance = options.audioInstance;
125
136
  }
137
+
138
+ _this.audioLikeInstance = new _AduioLike["default"]();
126
139
  (0, _mobx.makeObservable)(_assertThisInitialized(_this), {
127
140
  paused: _mobx.observable
128
141
  });
@@ -141,14 +154,38 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
141
154
  return updatePaused(false);
142
155
  };
143
156
 
144
- _this.videoInstance.addEventListener('pause', onPause);
157
+ var onEnded = function onEnded() {
158
+ console.log('vreo: video 播放结束');
159
+ };
160
+
161
+ _this.audioInstance.addEventListener('pause', onPause);
162
+
163
+ _this.audioInstance.addEventListener('play', onPlay);
164
+
165
+ (_this$options$videoIn = _this.options.videoInstance) === null || _this$options$videoIn === void 0 ? void 0 : _this$options$videoIn.addEventListener('pause', onPause);
166
+ (_this$options$videoIn2 = _this.options.videoInstance) === null || _this$options$videoIn2 === void 0 ? void 0 : _this$options$videoIn2.addEventListener('play', onPlay);
167
+
168
+ _this.audioLikeInstance.addEventListener('pause', onPause);
145
169
 
146
- _this.videoInstance.addEventListener('play', onPlay);
170
+ _this.audioLikeInstance.addEventListener('play', onPlay);
171
+
172
+ (_this$options$videoIn3 = _this.options.videoInstance) === null || _this$options$videoIn3 === void 0 ? void 0 : _this$options$videoIn3.addEventListener('ended', onEnded);
147
173
 
148
174
  _this.$removeEventListener = function () {
149
- _this.videoInstance.removeEventListener('pause', onPause);
175
+ var _this$options$videoIn4, _this$options$videoIn5, _this$options$videoIn6;
176
+
177
+ _this.audioInstance.removeEventListener('pause', onPause);
178
+
179
+ _this.audioInstance.removeEventListener('play', onPlay);
150
180
 
151
- _this.videoInstance.removeEventListener('play', onPlay);
181
+ (_this$options$videoIn4 = _this.options.videoInstance) === null || _this$options$videoIn4 === void 0 ? void 0 : _this$options$videoIn4.removeEventListener('pause', onPause);
182
+ (_this$options$videoIn5 = _this.options.videoInstance) === null || _this$options$videoIn5 === void 0 ? void 0 : _this$options$videoIn5.removeEventListener('play', onPlay);
183
+
184
+ _this.audioLikeInstance.removeEventListener('pause', onPause);
185
+
186
+ _this.audioLikeInstance.removeEventListener('play', onPlay);
187
+
188
+ (_this$options$videoIn6 = _this.options.videoInstance) === null || _this$options$videoIn6 === void 0 ? void 0 : _this$options$videoIn6.removeEventListener('ended', onEnded);
152
189
  };
153
190
 
154
191
  return _this;
@@ -159,6 +196,10 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
159
196
  get: function get() {
160
197
  var _this$videoUrl;
161
198
 
199
+ if (!this.videoUrl) {
200
+ return this.audioLikeInstance;
201
+ }
202
+
162
203
  if ((_this$videoUrl = this.videoUrl) !== null && _this$videoUrl !== void 0 && _this$videoUrl.endsWith('mp3')) {
163
204
  return this.audioInstance;
164
205
  }
@@ -194,17 +235,31 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
194
235
  case 6:
195
236
  uniforms = this.material.uniforms;
196
237
  this.videoInstance.muted = true;
197
- _context.t0 = URL;
198
- _context.next = 11;
238
+
239
+ if (!(this.options.preload || this.options.preload === undefined || this.videoUrl.endsWith('.mp4'))) {
240
+ _context.next = 18;
241
+ break;
242
+ }
243
+
244
+ _context.t1 = URL;
245
+ _context.next = 12;
199
246
  return _Preloader.Preloader.blob(this.videoUrl);
200
247
 
201
- case 11:
202
- _context.t1 = _context.sent;
203
- _context.next = 14;
204
- return _context.t0.createObjectURL.call(_context.t0, _context.t1);
248
+ case 12:
249
+ _context.t2 = _context.sent;
250
+ _context.next = 15;
251
+ return _context.t1.createObjectURL.call(_context.t1, _context.t2);
205
252
 
206
- case 14:
207
- this.videoInstance.src = _context.sent;
253
+ case 15:
254
+ _context.t0 = _context.sent;
255
+ _context.next = 19;
256
+ break;
257
+
258
+ case 18:
259
+ _context.t0 = this.videoUrl;
260
+
261
+ case 19:
262
+ this.videoInstance.src = _context.t0;
208
263
  this.videoInstance.setAttribute('data-src', this.videoUrl);
209
264
 
210
265
  onStart = function onStart() {
@@ -220,7 +275,7 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
220
275
 
221
276
  this.videoInstance.addEventListener('timeupdate', onStart, false);
222
277
 
223
- case 18:
278
+ case 23:
224
279
  case "end":
225
280
  return _context.stop();
226
281
  }
@@ -241,64 +296,85 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
241
296
  var _this3 = this;
242
297
 
243
298
  var videoUrl,
299
+ currentTime,
300
+ duration,
244
301
  _args3 = arguments;
245
302
  return regeneratorRuntime.wrap(function _callee3$(_context3) {
246
303
  while (1) {
247
304
  switch (_context3.prev = _context3.next) {
248
305
  case 0:
249
306
  videoUrl = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : '';
307
+ currentTime = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : 0;
308
+ duration = _args3.length > 2 ? _args3[2] : undefined;
250
309
  videoUrl = videoUrl || '';
251
310
 
252
- if (videoUrl) {
311
+ if (!(duration && !videoUrl)) {
253
312
  _context3.next = 10;
254
313
  break;
255
314
  }
256
315
 
316
+ if (this.currentTime) {
317
+ this.videoInstance.currentTime = currentTime;
318
+ }
319
+
320
+ this.videoInstance.duration = duration;
321
+ this.videoUrl = '';
322
+ this.videoInstance.play();
323
+ return _context3.abrupt("return", true);
324
+
325
+ case 10:
326
+ if (videoUrl) {
327
+ _context3.next = 18;
328
+ break;
329
+ }
330
+
257
331
  if (!this.videoUrl) {
258
- _context3.next = 8;
332
+ _context3.next = 16;
259
333
  break;
260
334
  }
261
335
 
262
- _context3.next = 6;
336
+ _context3.next = 14;
263
337
  return this.videoInstance.play();
264
338
 
265
- case 6:
266
- _context3.next = 9;
339
+ case 14:
340
+ _context3.next = 17;
267
341
  break;
268
342
 
269
- case 8:
343
+ case 16:
270
344
  console.warn('警告:视频资源未初始化。');
271
345
 
272
- case 9:
346
+ case 17:
273
347
  return _context3.abrupt("return", true);
274
348
 
275
- case 10:
349
+ case 18:
350
+ console.log('play', videoUrl, this.videoUrl);
351
+
276
352
  if (!(videoUrl === this.videoUrl)) {
277
- _context3.next = 15;
353
+ _context3.next = 24;
278
354
  break;
279
355
  }
280
356
 
281
- this.videoInstance.currentTime = 0;
282
- _context3.next = 14;
357
+ this.videoInstance.currentTime = currentTime;
358
+ _context3.next = 23;
283
359
  return this.videoInstance.play();
284
360
 
285
- case 14:
361
+ case 23:
286
362
  return _context3.abrupt("return", true);
287
363
 
288
- case 15:
289
- _context3.next = 17;
364
+ case 24:
365
+ _context3.next = 26;
290
366
  return this.update(videoUrl);
291
367
 
292
- case 17:
368
+ case 26:
293
369
  this.videoInstance.pause();
294
- _context3.next = 20;
370
+ _context3.next = 29;
295
371
  return new Promise(function (resolve) {
296
372
  return setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
297
373
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
298
374
  while (1) {
299
375
  switch (_context2.prev = _context2.next) {
300
376
  case 0:
301
- _this3.videoInstance.currentTime = 0;
377
+ _this3.videoInstance.currentTime = currentTime;
302
378
  _context2.next = 3;
303
379
  return _this3.videoInstance.play();
304
380
 
@@ -314,10 +390,10 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
314
390
  })), 20);
315
391
  });
316
392
 
317
- case 20:
393
+ case 29:
318
394
  return _context3.abrupt("return", _context3.sent);
319
395
 
320
- case 21:
396
+ case 30:
321
397
  case "end":
322
398
  return _context3.stop();
323
399
  }
@@ -6,7 +6,11 @@ export declare class VideoAgentScene {
6
6
  camera: THREE.OrthographicCamera;
7
7
  renderer: THREE.WebGLRenderer;
8
8
  container: HTMLElement;
9
- constructor(container: HTMLElement, needRender?: boolean);
9
+ constructor(container: HTMLElement, needRender?: boolean, options?: {
10
+ videoInstance?: HTMLVideoElement;
11
+ audioInstance?: HTMLAudioElement;
12
+ preload?: boolean;
13
+ });
10
14
  run: () => void;
11
15
  dispose: () => void;
12
16
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -15,14 +15,19 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
15
15
 
16
16
  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; }
17
17
 
18
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
19
+
20
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
21
+
18
22
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19
23
 
20
24
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
25
 
22
- var VideoAgentScene = function VideoAgentScene(container) {
26
+ var VideoAgentScene = /*#__PURE__*/_createClass(function VideoAgentScene(container) {
23
27
  var _this = this;
24
28
 
25
29
  var needRender = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
30
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
26
31
 
27
32
  _classCallCheck(this, VideoAgentScene);
28
33
 
@@ -74,13 +79,13 @@ var VideoAgentScene = function VideoAgentScene(container) {
74
79
 
75
80
  _domElement.setAttribute('style', "width: ".concat(state.width, "px;height: ").concat(state.height, "px;"));
76
81
 
77
- this.videoAgentMesh = new _VideoAgentMesh.VideoAgentMesh(480, 270, 1, 1);
82
+ this.videoAgentMesh = new _VideoAgentMesh.VideoAgentMesh(480, 270, 1, 1, options);
78
83
 
79
84
  if (needRender) {
80
85
  container.append(_domElement);
81
86
  this.scene.add(this.videoAgentMesh);
82
87
  this.run();
83
88
  }
84
- };
89
+ });
85
90
 
86
91
  exports.VideoAgentScene = VideoAgentScene;
@@ -1,4 +1,6 @@
1
1
  /// <reference types="react" />
2
+ import { VideoAgentMeshOptions } from './VideoAgentMesh';
2
3
  export declare function VideoAgent(props: {
3
4
  onClick?: () => void;
5
+ options?: VideoAgentMeshOptions;
4
6
  }): JSX.Element;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -28,7 +28,7 @@ function VideoAgent(props) {
28
28
  return;
29
29
  }
30
30
 
31
- var videoAgentScene = new _VideoAgentScene.VideoAgentScene(ref.current);
31
+ var videoAgentScene = new _VideoAgentScene.VideoAgentScene(ref.current, true, props.options || {});
32
32
  controller.videoAgentScene = videoAgentScene;
33
33
  return function () {
34
34
  var _controller$videoAgen;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -45,13 +45,49 @@ function CameraMovement() {
45
45
  cameraMovementData = data;
46
46
  effect = cameraMovementData.effect;
47
47
 
48
- if (effect === _typings.CameraMovementEffect.Rotate) {
49
- ref.current.rotate(data, end - start);
50
- } else {
51
- ref.current.move(data, end - start);
48
+ if (!(effect === _typings.CameraMovementEffect.Rotate)) {
49
+ _context.next = 9;
50
+ break;
52
51
  }
53
52
 
54
- case 5:
53
+ _context.next = 7;
54
+ return ref.current.rotate(data, end - start);
55
+
56
+ case 7:
57
+ _context.next = 21;
58
+ break;
59
+
60
+ case 9:
61
+ if (!(effect === _typings.CameraMovementEffect.Move)) {
62
+ _context.next = 14;
63
+ break;
64
+ }
65
+
66
+ _context.next = 12;
67
+ return ref.current.move(data, end - start);
68
+
69
+ case 12:
70
+ _context.next = 21;
71
+ break;
72
+
73
+ case 14:
74
+ if (!(cameraMovementData.panoIndex !== undefined && cameraMovementData.panoIndex !== five.panoIndex)) {
75
+ _context.next = 19;
76
+ break;
77
+ }
78
+
79
+ _context.next = 17;
80
+ return ref.current.move(data, end - start);
81
+
82
+ case 17:
83
+ _context.next = 21;
84
+ break;
85
+
86
+ case 19:
87
+ _context.next = 21;
88
+ return ref.current.rotate(data, end - start);
89
+
90
+ case 21:
55
91
  case "end":
56
92
  return _context.stop();
57
93
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -75,49 +75,87 @@ function InfoPanel() {
75
75
  data = keyframe.data;
76
76
  var infoPanelData = data;
77
77
  var title = infoPanelData.title,
78
- subTitle = infoPanelData.subTitle;
79
-
80
- if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
81
- controller.openDrawer({
82
- content: /*#__PURE__*/React.createElement(InfoPanelImg, {
83
- url: infoPanelData.url
84
- }, /*#__PURE__*/React.createElement(Title, {
85
- title: title,
86
- subTitle: subTitle
87
- })),
88
- height: '60vh'
89
- });
90
- } else if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Video) {
91
- controller.openDrawer({
92
- content: /*#__PURE__*/React.createElement(InfoPanelVideo, {
93
- url: infoPanelData.url
94
- }, /*#__PURE__*/React.createElement(Title, {
95
- title: title,
96
- subTitle: subTitle
97
- })),
98
- height: '60vh'
99
- });
100
- }
78
+ subTitle = infoPanelData.subTitle,
79
+ style = infoPanelData.style;
80
+
81
+ do {
82
+ if (style === _VreoUnit.InfoPanelStyleEnum.PopUp) {
83
+ if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
84
+ controller.openPopUp( /*#__PURE__*/React.createElement(InfoPanelImg, {
85
+ url: infoPanelData.url
86
+ }, /*#__PURE__*/React.createElement(Title, {
87
+ title: title,
88
+ subTitle: subTitle
89
+ })));
90
+ } else if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Video) {
91
+ controller.openPopUp( /*#__PURE__*/React.createElement(InfoPanelVideo, {
92
+ url: infoPanelData.url
93
+ }, /*#__PURE__*/React.createElement(Title, {
94
+ title: title,
95
+ subTitle: subTitle
96
+ })));
97
+ }
98
+
99
+ break;
100
+ }
101
+
102
+ if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
103
+ controller.openDrawer({
104
+ content: /*#__PURE__*/React.createElement(InfoPanelImg, {
105
+ url: infoPanelData.url
106
+ }, /*#__PURE__*/React.createElement(Title, {
107
+ title: title,
108
+ subTitle: subTitle
109
+ })),
110
+ height: '60vh'
111
+ });
112
+ } else if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Video) {
113
+ controller.openDrawer({
114
+ content: /*#__PURE__*/React.createElement(InfoPanelVideo, {
115
+ url: infoPanelData.url
116
+ }, /*#__PURE__*/React.createElement(Title, {
117
+ title: title,
118
+ subTitle: subTitle
119
+ })),
120
+ height: '60vh'
121
+ });
122
+ }
123
+ } while (false);
101
124
 
102
125
  timeoutRef.current = setTimeout(function () {
103
- return controller.openDrawer(false);
126
+ controller.openDrawer(false);
127
+ controller.openPopUp(false);
104
128
  }, end - start);
105
129
  };
106
130
 
107
131
  controller.on(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback); // Object.assign(window, {
108
132
  // $setInfoPanel: () => {
109
- // controller.openDrawer({
110
- // content: (
111
- // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/seesay/tools/cat_music___f68fb9bbe1f7cd6d00a16456dd0b09ad.gif'>
112
- // // <InfoPanelImg url="http://vrlab-public.ljcdn.com/common/images/web/d94e1bd7-0311-4b20-9c41-a1294fe43554.png">
113
- // // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
114
- // // </InfoPanelImg>
115
- // <InfoPanelVideo url="//vrlab-public.ljcdn.com/release/seesay/tools/2022011713142___b320f74a5e1b5ad4bb46b4dc69d73ecc.mp4">
133
+ // controller.openPopUp(
134
+ // // <InfoPanelImg url='//vrlab-static.ljcdn.com/release/web/psq/a.8e868cb2.gif' />
135
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/b.f9a1ed52.png' />
136
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/c.4f88c112.png' />
137
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/seesay/tools/cat_music___f68fb9bbe1f7cd6d00a16456dd0b09ad.gif' />
138
+ // <InfoPanelImg url="http://vrlab-public.ljcdn.com/common/images/web/d94e1bd7-0311-4b20-9c41-a1294fe43554.png">
116
139
  // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
117
- // </InfoPanelVideo>
118
- // ),
119
- // height: '60vh',
120
- // })
140
+ // </InfoPanelImg>
141
+ // // <InfoPanelVideo url="//vrlab-public.ljcdn.com/release/seesay/tools/2022011713142___b320f74a5e1b5ad4bb46b4dc69d73ecc.mp4">
142
+ // // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
143
+ // // </InfoPanelVideo>
144
+ // )
145
+ // },
146
+ // $setInfoPanel2: () => {
147
+ // controller.openPopUp(
148
+ // <InfoPanelImg url='//vrlab-static.ljcdn.com/release/web/psq/a.8e868cb2.gif' />
149
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/b.f9a1ed52.png' />
150
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/c.4f88c112.png' />
151
+ // // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/seesay/tools/cat_music___f68fb9bbe1f7cd6d00a16456dd0b09ad.gif' />
152
+ // // <InfoPanelImg url="http://vrlab-public.ljcdn.com/common/images/web/d94e1bd7-0311-4b20-9c41-a1294fe43554.png">
153
+ // // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
154
+ // // </InfoPanelImg>
155
+ // // <InfoPanelVideo url="//vrlab-public.ljcdn.com/release/seesay/tools/2022011713142___b320f74a5e1b5ad4bb46b4dc69d73ecc.mp4">
156
+ // // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
157
+ // // </InfoPanelVideo>
158
+ // )
121
159
  // },
122
160
  // })
123
161