@realsee/vreo 1.0.0-alpha.22 → 1.0.0-alpha.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/lib/PlayController/createHTMLAudioElement.js +6 -11
  2. package/lib/PlayController/index.js +15 -80
  3. package/lib/Player/App.js +0 -24
  4. package/lib/Player/Controller.js +17 -93
  5. package/lib/Player/custom/SpatialScenePanel/index.js +42 -68
  6. package/lib/Player/hooks.js +0 -10
  7. package/lib/Player/index.js +24 -84
  8. package/lib/Player/modules/Drawer/index.js +0 -17
  9. package/lib/Player/modules/PopUp/index.js +0 -10
  10. package/lib/Player/modules/ResizeObserver/index.js +0 -8
  11. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +17 -111
  12. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +2 -24
  13. package/lib/Player/modules/VideoAgent/index.js +0 -17
  14. package/lib/Player/modules/Wave/index.js +7 -32
  15. package/lib/Player/modules/keyframes/BgMusic/index.js +22 -39
  16. package/lib/Player/modules/keyframes/CameraMovement/index.js +3 -27
  17. package/lib/Player/modules/keyframes/InfoPanel/index.js +8 -25
  18. package/lib/Player/modules/keyframes/ModelVideo/index.js +3 -29
  19. package/lib/Player/modules/keyframes/PanoEffect/index.js +15 -43
  20. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +0 -7
  21. package/lib/Player/modules/keyframes/PanoTag/index.js +4 -20
  22. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +22 -47
  23. package/lib/Player/modules/keyframes/Prompter/index.js +10 -32
  24. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +18 -25
  25. package/lib/Player/modules/keyframes/VideoEffect/index.js +12 -47
  26. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +0 -2
  27. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +0 -1
  28. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +0 -1
  29. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +19 -60
  30. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +2 -5
  31. package/lib/fivePlugins/CameraMovementPlugin/index.js +28 -75
  32. package/lib/fivePlugins/CameraMovementPlugin/typings.js +0 -4
  33. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +11 -60
  34. package/lib/index.js +0 -1
  35. package/lib/react/index.js +7 -34
  36. package/lib/shared-utils/Audio.d.ts +13 -0
  37. package/lib/shared-utils/Audio.js +98 -0
  38. package/lib/shared-utils/AudioLike.js +5 -39
  39. package/lib/shared-utils/Preloader.js +0 -7
  40. package/lib/shared-utils/addResizeListener.js +0 -5
  41. package/lib/shared-utils/animationFrame/BetterTween.js +2 -38
  42. package/lib/shared-utils/animationFrame/index.js +2 -10
  43. package/lib/shared-utils/animationFrame/tween.js +2 -15
  44. package/lib/shared-utils/createTransMatrix.js +2 -17
  45. package/lib/shared-utils/getFileExpandedName.js +0 -1
  46. package/lib/shared-utils/getMediaInfo.js +0 -9
  47. package/lib/shared-utils/setElementDataset.js +0 -2
  48. package/lib/typings/VreoUnit.js +0 -15
  49. package/package.json +1 -1
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Preloader = void 0;
7
-
8
7
  /**
9
8
  * 预载器
10
9
  */
@@ -13,26 +12,21 @@ var Preloader = {
13
12
  var noop = function noop() {
14
13
  return null;
15
14
  };
16
-
17
15
  return new Promise(function (resolve, reject) {
18
16
  var xhr = new XMLHttpRequest();
19
-
20
17
  var clear = function clear() {
21
18
  xhr.ontimeout = noop;
22
19
  xhr.onreadystatechange = noop;
23
20
  xhr.onprogress = noop;
24
21
  xhr.onabort = noop;
25
22
  };
26
-
27
23
  xhr.ontimeout = function () {
28
24
  reject(new Error('timeout'));
29
25
  clear();
30
26
  };
31
-
32
27
  xhr.onreadystatechange = function () {
33
28
  if (xhr.readyState !== 4) return;
34
29
  if (xhr.status === 0 && !xhr.response) return;
35
-
36
30
  if (xhr.status === 200 || xhr.status === 0) {
37
31
  resolve(xhr.response);
38
32
  clear();
@@ -41,7 +35,6 @@ var Preloader = {
41
35
  clear();
42
36
  }
43
37
  };
44
-
45
38
  xhr.open('GET', url, true);
46
39
  xhr.responseType = 'blob';
47
40
  xhr.send(null);
@@ -6,12 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.addResizeListener = addResizeListener;
7
7
  exports.hasResizeListener = hasResizeListener;
8
8
  var resizeObserverCache = new Map();
9
-
10
9
  function addResizeListener(element, resizeHandler) {
11
10
  var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
12
11
  if (!element) return function () {};
13
12
  if (immediate) resizeHandler(element.clientWidth, element.clientHeight);
14
-
15
13
  if (typeof ResizeObserver !== 'undefined' && ResizeObserver) {
16
14
  var resizeObserver = new ResizeObserver(function () {
17
15
  return resizeHandler(element.clientWidth, element.clientHeight);
@@ -20,7 +18,6 @@ function addResizeListener(element, resizeHandler) {
20
18
  resizeObserverCache.set(element, resizeObserverCache.get(element) || 0 + 1);
21
19
  return function () {
22
20
  if (element) resizeObserver.unobserve(element);
23
-
24
21
  if (resizeObserverCache.get(element) === 1) {
25
22
  resizeObserverCache["delete"](element);
26
23
  }
@@ -37,14 +34,12 @@ function addResizeListener(element, resizeHandler) {
37
34
  resizeObserverCache.set(element, resizeObserverCache.get(element) || 0 + 1);
38
35
  return function () {
39
36
  element.removeChild(iframe);
40
-
41
37
  if (resizeObserverCache.get(element) === 1) {
42
38
  resizeObserverCache["delete"](element);
43
39
  }
44
40
  };
45
41
  }
46
42
  }
47
-
48
43
  function hasResizeListener(element) {
49
44
  if (!element) return false;
50
45
  return resizeObserverCache.get(element) || 0 > 0;
@@ -1,98 +1,62 @@
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.BetterTween = void 0;
9
8
  exports.tweenProgress = tweenProgress;
10
-
11
9
  var _tween = _interopRequireDefault(require("@tweenjs/tween.js"));
12
-
13
10
  var _ = require(".");
14
-
15
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
16
-
17
12
  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); } }
18
-
19
13
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
20
-
21
14
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
22
-
23
15
  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); }
24
-
25
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
26
-
16
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
27
17
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
28
-
29
18
  function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
30
-
31
19
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
32
-
33
20
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
34
-
35
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
36
-
21
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
37
22
  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; }
38
-
39
23
  var BetterTween = /*#__PURE__*/function (_TWEEN$Tween) {
40
24
  _inherits(BetterTween, _TWEEN$Tween);
41
-
42
25
  var _super = _createSuper(BetterTween);
43
-
44
26
  function BetterTween() {
45
27
  var _this;
46
-
47
28
  _classCallCheck(this, BetterTween);
48
-
49
29
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
50
30
  args[_key] = arguments[_key];
51
31
  }
52
-
53
32
  _this = _super.call.apply(_super, [this].concat(args));
54
-
55
33
  _defineProperty(_assertThisInitialized(_this), "disposeMethods", []);
56
-
57
34
  _defineProperty(_assertThisInitialized(_this), "onDispose", function (callback) {
58
35
  _this.disposeMethods.push(callback);
59
-
60
36
  return _assertThisInitialized(_this);
61
37
  });
62
-
63
38
  _defineProperty(_assertThisInitialized(_this), "play", function () {
64
39
  _this.start();
65
-
66
40
  _this.animationFrameDisposer = (0, _.requestAnimationFrameInterval)(function () {
67
41
  return _this.update();
68
42
  });
69
43
  return _assertThisInitialized(_this);
70
44
  });
71
-
72
45
  _defineProperty(_assertThisInitialized(_this), "dispose", function () {
73
46
  var _this$animationFrameD, _this2;
74
-
75
47
  _this.stop();
76
-
77
48
  (_this$animationFrameD = (_this2 = _this).animationFrameDisposer) === null || _this$animationFrameD === void 0 ? void 0 : _this$animationFrameD.call(_this2);
78
-
79
49
  _this.disposeMethods.forEach(function (fn) {
80
50
  return fn();
81
51
  });
82
-
83
52
  _this.disposeMethods = [];
84
-
85
53
  _tween["default"].remove(_assertThisInitialized(_this));
86
54
  });
87
-
88
55
  return _this;
89
56
  }
90
-
91
57
  return _createClass(BetterTween);
92
58
  }(_tween["default"].Tween);
93
-
94
59
  exports.BetterTween = BetterTween;
95
-
96
60
  function tweenProgress(duration) {
97
61
  var easing = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _tween["default"].Easing.Linear.None;
98
62
  var tween = new BetterTween({
@@ -7,37 +7,31 @@ exports["default"] = void 0;
7
7
  exports.getFrameTime = getFrameTime;
8
8
  exports.nextFrame = nextFrame;
9
9
  exports.requestAnimationFrameInterval = requestAnimationFrameInterval;
10
-
11
10
  var _requestAnimationFrame = window.requestAnimationFrame || function (fn) {
12
11
  return setTimeout(fn, 16);
13
12
  };
14
-
15
13
  var _cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
16
-
17
14
  var _default = _requestAnimationFrame;
18
15
  exports["default"] = _default;
19
-
20
16
  function nextFrame(fn) {
21
17
  var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
22
18
  if (delay <= 0) _requestAnimationFrame(fn);else _requestAnimationFrame(function () {
23
19
  return nextFrame(fn, delay - 1);
24
20
  });
25
21
  }
22
+
26
23
  /**
27
24
  * 在每个 AnimationFrame 中调用传入的函数
28
25
  * @param callback 每次 AnimationFrame 中调用的函数
29
26
  * @param frame 每秒运行多少次
30
27
  * @returns 返回一个函数,调用可以停止 AnimationFrameLoop
31
28
  */
32
-
33
-
34
29
  function requestAnimationFrameInterval(callback) {
35
30
  var frame = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 60;
36
31
  var index = -1;
37
32
  var oldTime = 0;
38
33
  var startTime = -1;
39
34
  var minDeltaTime = 1000 / frame;
40
-
41
35
  function loop(time) {
42
36
  startTime === -1 && (startTime = time);
43
37
  index = _requestAnimationFrame(loop);
@@ -46,18 +40,16 @@ function requestAnimationFrameInterval(callback) {
46
40
  oldTime = time;
47
41
  callback && callback(time - startTime);
48
42
  }
49
-
50
43
  index = _requestAnimationFrame(loop);
51
44
  return function stop() {
52
45
  _cancelAnimationFrame(index);
53
46
  };
54
47
  }
48
+
55
49
  /**
56
50
  * 获取两个 AnimationFrame 间隔的时间
57
51
  * @returns 返回一个 Promise,resolve 的结果是两个 AnimationFrame 间隔的时间
58
52
  */
59
-
60
-
61
53
  function getFrameTime() {
62
54
  var start = Date.now();
63
55
  return new Promise(function (resolve) {
@@ -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.Easing = void 0;
9
8
  exports["default"] = tween;
10
9
  exports.tweenProgress = tweenProgress;
11
-
12
10
  var TWEEN = _interopRequireWildcard(require("@tweenjs/tween.js"));
13
-
14
11
  var _index = require("./index");
15
-
16
12
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
-
18
13
  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
14
  var Easing = TWEEN.Easing;
21
15
  exports.Easing = Easing;
22
-
23
16
  /**
24
17
  * 对象变化的补间动画
25
18
  * 1. 应用 requestAnimationFrameInterval 做 update
@@ -32,8 +25,8 @@ exports.Easing = Easing;
32
25
  */
33
26
  function tween(from, to, duration) {
34
27
  var easing = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Easing.Linear.None;
35
- var tween = new TWEEN.Tween(from).to(to, duration).easing(easing); // 这里注意一下,因为 requestAnimationFrameInterval 给的时间是从 0 开始的,tween 动画也从 0 开始
36
-
28
+ var tween = new TWEEN.Tween(from).to(to, duration).easing(easing);
29
+ // 这里注意一下,因为 requestAnimationFrameInterval 给的时间是从 0 开始的,tween 动画也从 0 开始
37
30
  (0, _index.nextFrame)(function () {
38
31
  return tween.start(0);
39
32
  });
@@ -41,12 +34,10 @@ function tween(from, to, duration) {
41
34
  if (tween.update(time) === false) cancelAnimationFrame();
42
35
  });
43
36
  var destroyMethods = [];
44
-
45
37
  tween.onDestroy = function (fn) {
46
38
  destroyMethods.push(fn);
47
39
  return tween;
48
40
  };
49
-
50
41
  tween.destroy = function () {
51
42
  this.stop();
52
43
  Object.assign(tween, {
@@ -56,17 +47,13 @@ function tween(from, to, duration) {
56
47
  _onStopCallbackL: null
57
48
  });
58
49
  var destroyMethod;
59
-
60
50
  while (destroyMethod = destroyMethods.shift()) {
61
51
  destroyMethod();
62
52
  }
63
-
64
53
  cancelAnimationFrame();
65
54
  };
66
-
67
55
  return tween;
68
56
  }
69
-
70
57
  function tweenProgress(duration, easing) {
71
58
  return tween({
72
59
  progress: 0
@@ -1,42 +1,27 @@
1
1
  "use strict";
2
2
 
3
3
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createTransMatrix = createTransMatrix;
9
-
10
8
  var THREE = _interopRequireWildcard(require("three"));
11
-
12
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); }
13
-
14
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; }
15
-
16
- function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
17
-
11
+ function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
18
12
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
19
-
20
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
21
-
13
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
22
14
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
23
-
24
15
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
25
-
26
16
  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); }
27
-
28
17
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
29
-
30
18
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
31
-
32
19
  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; }
33
-
34
20
  function createTransMatrix(arr1) {
35
21
  var matrix4 = new THREE.Matrix4();
36
22
  matrix4.fromArray(arr1);
37
23
  return function (arr2) {
38
24
  var vector3 = _construct(THREE.Vector3, _toConsumableArray(arr2));
39
-
40
25
  vector3.applyMatrix4(matrix4);
41
26
  return vector3.toArray();
42
27
  };
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = getFileExpandedName;
7
-
8
7
  function getFileExpandedName(filePath) {
9
8
  if (!filePath) return '';
10
9
  var index = filePath.lastIndexOf('.');
@@ -8,22 +8,17 @@ exports.getFileName = getFileName;
8
8
  exports.getMediaType = getMediaType;
9
9
  exports.getMediaTypeByExpandedName = getMediaTypeByExpandedName;
10
10
  exports.getMediaTypeByUrl = getMediaTypeByUrl;
11
-
12
11
  var _getFileExpandedName = _interopRequireDefault(require("./getFileExpandedName"));
13
-
14
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
-
16
13
  function getMediaInfo(fileUrl) {
17
14
  var type = getMediaType(fileUrl);
18
15
  if (!type) return Promise.resolve({
19
16
  error: '未知的文件类型: ' + fileUrl
20
17
  });
21
-
22
18
  var mediaElement = function () {
23
19
  if (type === 'video') return document.createElement('video');
24
20
  if (type === 'audio') return document.createElement('audio');
25
21
  }();
26
-
27
22
  if (!mediaElement) return Promise.resolve({
28
23
  error: 'Unknown media element'
29
24
  });
@@ -34,7 +29,6 @@ function getMediaInfo(fileUrl) {
34
29
  error: 'onerror'
35
30
  });
36
31
  };
37
-
38
32
  mediaElement.onloadedmetadata = function () {
39
33
  resolve({
40
34
  duration: mediaElement.duration * 1000,
@@ -49,7 +43,6 @@ function getMediaType(url) {
49
43
  var type = getMediaTypeByExpandedName(fileExpandedName);
50
44
  return type;
51
45
  }
52
-
53
46
  function getMediaTypeByExpandedName(fileExpandedName) {
54
47
  if (!fileExpandedName) return 'unknown';
55
48
  if (/jpg|jpeg|png$/.test(fileExpandedName)) return 'image';
@@ -57,13 +50,11 @@ function getMediaTypeByExpandedName(fileExpandedName) {
57
50
  if (/avi|wmv|mpeg|mp4|m4v|mov|asf|flv|f4v|rmvb|rm|3gp|vob$/.test(fileExpandedName)) return 'video';
58
51
  return 'unknown';
59
52
  }
60
-
61
53
  function getMediaTypeByUrl(fileUrl) {
62
54
  if (!fileUrl) return;
63
55
  var fileExpandedName = (0, _getFileExpandedName["default"])(fileUrl);
64
56
  return getMediaTypeByExpandedName(fileExpandedName);
65
57
  }
66
-
67
58
  function getFileName(fileUrl) {
68
59
  if (!fileUrl) return '';
69
60
  var index1 = fileUrl.lastIndexOf('/');
@@ -4,12 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = setElementDataset;
7
-
8
7
  function setElementDataset(element, dataset) {
9
8
  if (element) {
10
9
  Object.keys(dataset).forEach(function (key) {
11
10
  var value = dataset[key].toString();
12
-
13
11
  if (element instanceof Element) {
14
12
  element.setAttribute("data-".concat(key), value);
15
13
  } else if (element instanceof Document) {
@@ -8,9 +8,7 @@ var VreoKeyframeEnum;
8
8
  /**
9
9
  * 支持自定义剧本关键帧配置项
10
10
  */
11
-
12
11
  exports.VreoKeyframeEnum = VreoKeyframeEnum;
13
-
14
12
  (function (VreoKeyframeEnum) {
15
13
  VreoKeyframeEnum["CameraMovement"] = "CameraMovement";
16
14
  VreoKeyframeEnum["PanoTag"] = "PanoTag";
@@ -25,7 +23,6 @@ exports.VreoKeyframeEnum = VreoKeyframeEnum;
25
23
  VreoKeyframeEnum["Exit"] = "Exit";
26
24
  VreoKeyframeEnum["Custom"] = "Custom";
27
25
  })(VreoKeyframeEnum || (exports.VreoKeyframeEnum = VreoKeyframeEnum = {}));
28
-
29
26
  /**
30
27
  * 全景标签枚举
31
28
  */
@@ -33,22 +30,17 @@ var PanoTagEnum;
33
30
  /**
34
31
  * 标签样式种类
35
32
  */
36
-
37
33
  exports.PanoTagEnum = PanoTagEnum;
38
-
39
34
  (function (PanoTagEnum) {
40
35
  PanoTagEnum["Text"] = "Text";
41
36
  PanoTagEnum["Image"] = "Image";
42
37
  })(PanoTagEnum || (exports.PanoTagEnum = PanoTagEnum = {}));
43
-
44
38
  var PanoTagStyleEnum;
45
39
  exports.PanoTagStyleEnum = PanoTagStyleEnum;
46
-
47
40
  (function (PanoTagStyleEnum) {
48
41
  PanoTagStyleEnum["Growth"] = "Growth";
49
42
  PanoTagStyleEnum["Expand"] = "Expand";
50
43
  })(PanoTagStyleEnum || (exports.PanoTagStyleEnum = PanoTagStyleEnum = {}));
51
-
52
44
  /**
53
45
  * 全景特效枚举
54
46
  */
@@ -56,31 +48,24 @@ var PanoEffectEnum;
56
48
  /**
57
49
  * 全景特效
58
50
  */
59
-
60
51
  exports.PanoEffectEnum = PanoEffectEnum;
61
-
62
52
  (function (PanoEffectEnum) {
63
53
  PanoEffectEnum["Distance"] = "Distance";
64
54
  })(PanoEffectEnum || (exports.PanoEffectEnum = PanoEffectEnum = {}));
65
-
66
55
  /**
67
56
  * 信息面板类型枚举
68
57
  */
69
58
  var InfoPanelTypeEnum;
70
59
  exports.InfoPanelTypeEnum = InfoPanelTypeEnum;
71
-
72
60
  (function (InfoPanelTypeEnum) {
73
61
  InfoPanelTypeEnum["Image"] = "Image";
74
62
  InfoPanelTypeEnum["Video"] = "Video";
75
63
  })(InfoPanelTypeEnum || (exports.InfoPanelTypeEnum = InfoPanelTypeEnum = {}));
76
-
77
64
  var InfoPanelStyleEnum;
78
65
  /**
79
66
  * 信息面板
80
67
  */
81
-
82
68
  exports.InfoPanelStyleEnum = InfoPanelStyleEnum;
83
-
84
69
  (function (InfoPanelStyleEnum) {
85
70
  InfoPanelStyleEnum["Drawer"] = "Drawer";
86
71
  InfoPanelStyleEnum["PopUp"] = "PopUp";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@realsee/vreo",
3
- "version": "1.0.0-alpha.22",
3
+ "version": "1.0.0-alpha.24",
4
4
  "description": "Vreo (VR Video 缩写) 是基于如视三维渲染引擎 Five 和 用户界面构建库 React 实现的如视 3D 空间剧本播放器。",
5
5
  "keywords": [
6
6
  "realsee",