@realsee/vreo 1.0.0-alpha.1 → 1.0.0-alpha.11

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 (115) hide show
  1. package/docs/assets/search.js +1 -1
  2. package/docs/classes/Player.AudioLike.html +6 -6
  3. package/docs/classes/Player.Controller.html +12 -12
  4. package/docs/classes/Player.Player-1.html +11 -11
  5. package/docs/classes/Player.VideoAgentMesh.html +12 -12
  6. package/docs/classes/Player.VideoAgentScene.html +1 -1
  7. package/docs/demo/assets/{AppReact.d0ee843a.js → AppReact.e6e509fc.js} +1 -1
  8. package/docs/demo/assets/default.bc4c715d.css +1 -0
  9. package/docs/demo/assets/default.e9102488.js +3988 -0
  10. package/docs/demo/assets/{dynamic.76506c2c.js → dynamic.0dd42f6c.js} +1 -1
  11. package/docs/demo/assets/{examples.3d8323db.js → examples.e70954e5.js} +1 -1
  12. package/docs/demo/assets/{index.7e31122c.js → index.62e9f091.js} +1 -1
  13. package/docs/demo/assets/{main.79b11b9d.js → main.c6fa1444.js} +1 -1
  14. package/docs/demo/assets/{react.c1c07c14.js → react.89edd358.js} +1 -1
  15. package/docs/demo/examples.html +3 -3
  16. package/docs/demo/index-react-dynamic.html +5 -5
  17. package/docs/demo/index-react.html +5 -5
  18. package/docs/demo/index.html +4 -4
  19. package/docs/enums/Player.InfoPanelStyleEnum.html +1 -1
  20. package/docs/enums/Player.InfoPanelTypeEnum.html +1 -1
  21. package/docs/enums/Player.PanoEffectEnum.html +1 -1
  22. package/docs/enums/Player.PanoTagEnum.html +1 -1
  23. package/docs/enums/Player.PanoTagStyleEnum.html +2 -2
  24. package/docs/enums/Player.VreoKeyframeEnum.html +12 -12
  25. package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -1
  26. package/docs/enums/fivePlugins.Rotation.html +1 -1
  27. package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -1
  28. package/docs/interfaces/Player.PlayerConfigs.html +4 -3
  29. package/docs/interfaces/Player.Vertex.html +1 -1
  30. package/docs/interfaces/Player.VideoAgentMeshOptions.html +3 -3
  31. package/docs/interfaces/Player.VreoKeyframe.html +1 -1
  32. package/docs/interfaces/Player.VreoUnit.html +1 -1
  33. package/docs/interfaces/Player.VreoVideo.html +1 -1
  34. package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +2 -2
  35. package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +1 -1
  36. package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +2 -2
  37. package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +1 -1
  38. package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +1 -1
  39. package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +1 -1
  40. package/docs/interfaces/fivePlugins.Vector3Position.html +1 -1
  41. package/docs/interfaces/react.VreoActionCallbacks.html +6 -6
  42. package/docs/interfaces/react.VreoProviderProps.html +1 -1
  43. package/docs/modules/Player.html +16 -16
  44. package/docs/modules/custom.html +1 -1
  45. package/docs/modules/fivePlugins.html +3 -3
  46. package/docs/modules/react.html +1 -1
  47. package/lib/PlayController/createHTMLAudioElement.js +6 -11
  48. package/lib/PlayController/index.js +16 -82
  49. package/lib/Player/App.js +6 -28
  50. package/lib/Player/Controller.d.ts +27 -8
  51. package/lib/Player/Controller.js +163 -84
  52. package/lib/Player/custom/SpatialScenePanel/index.js +44 -69
  53. package/lib/Player/hooks.js +2 -12
  54. package/lib/Player/index.d.ts +2 -1
  55. package/lib/Player/index.js +63 -108
  56. package/lib/Player/modules/Drawer/index.js +0 -17
  57. package/lib/Player/modules/PopUp/index.js +0 -10
  58. package/lib/Player/modules/ResizeObserver/index.d.ts +2 -0
  59. package/lib/Player/modules/ResizeObserver/index.js +29 -0
  60. package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +1 -1
  61. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +58 -151
  62. package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +3 -7
  63. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +21 -52
  64. package/lib/Player/modules/VideoAgent/index.js +45 -21
  65. package/lib/Player/modules/Wave/index.d.ts +5 -0
  66. package/lib/Player/modules/Wave/index.js +158 -0
  67. package/lib/Player/modules/keyframes/BgMusic/index.js +2 -15
  68. package/lib/Player/modules/keyframes/CameraMovement/index.js +3 -27
  69. package/lib/Player/modules/keyframes/InfoPanel/index.js +28 -33
  70. package/lib/Player/modules/keyframes/ModelVideo/index.js +3 -29
  71. package/lib/Player/modules/keyframes/PanoEffect/index.js +15 -43
  72. package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +0 -7
  73. package/lib/Player/modules/keyframes/PanoTag/index.d.ts +1 -2
  74. package/lib/Player/modules/keyframes/PanoTag/index.js +74 -144
  75. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +22 -48
  76. package/lib/Player/modules/keyframes/Prompter/index.js +14 -35
  77. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +18 -25
  78. package/lib/Player/modules/keyframes/VideoEffect/index.js +12 -47
  79. package/lib/Player/typings.d.ts +9 -2
  80. package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +0 -2
  81. package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +0 -1
  82. package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +0 -1
  83. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +19 -60
  84. package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +2 -5
  85. package/lib/fivePlugins/CameraMovementPlugin/index.js +30 -80
  86. package/lib/fivePlugins/CameraMovementPlugin/typings.js +0 -4
  87. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +11 -60
  88. package/lib/index.js +0 -1
  89. package/lib/react/index.d.ts +2 -2
  90. package/lib/react/index.js +7 -34
  91. package/lib/shared-utils/AduioLike.js +12 -45
  92. package/lib/shared-utils/Preloader.js +0 -7
  93. package/lib/shared-utils/addResizeListener.d.ts +4 -0
  94. package/lib/shared-utils/addResizeListener.js +46 -0
  95. package/lib/shared-utils/animationFrame/BetterTween.js +2 -38
  96. package/lib/shared-utils/animationFrame/index.js +2 -10
  97. package/lib/shared-utils/animationFrame/tween.js +2 -15
  98. package/lib/shared-utils/createTransMatrix.js +2 -17
  99. package/lib/shared-utils/getFileExpandedName.d.ts +1 -0
  100. package/lib/shared-utils/getFileExpandedName.js +12 -0
  101. package/lib/shared-utils/getMediaInfo.d.ts +9 -0
  102. package/lib/shared-utils/getMediaInfo.js +66 -0
  103. package/lib/shared-utils/setElementDataset.d.ts +1 -0
  104. package/lib/shared-utils/setElementDataset.js +22 -0
  105. package/lib/typings/VreoUnit.d.ts +4 -0
  106. package/lib/typings/VreoUnit.js +0 -15
  107. package/package.json +2 -2
  108. package/resources/Player/Controller.ts +4 -7
  109. package/resources/Player/index.tsx +2 -0
  110. package/resources/Player/modules/Wave/index.tsx +133 -12
  111. package/resources/Player/modules/keyframes/PanoTag/index.tsx +1 -2
  112. package/resources/typings/VreoUnit.ts +1 -1
  113. package/stylesheets/default.css +4 -2
  114. package/docs/demo/assets/default.63925584.js +0 -3984
  115. package/docs/demo/assets/default.f3f3ca8c.css +0 -1
@@ -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
  };
@@ -0,0 +1 @@
1
+ export default function getFileExpandedName(filePath?: string | null): string;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = getFileExpandedName;
7
+ function getFileExpandedName(filePath) {
8
+ if (!filePath) return '';
9
+ var index = filePath.lastIndexOf('.');
10
+ var ext = filePath.substring(index + 1);
11
+ return ext.toLowerCase();
12
+ }
@@ -0,0 +1,9 @@
1
+ export default function getMediaInfo(fileUrl: string): Promise<{
2
+ duration?: number | undefined;
3
+ type?: 'video' | 'audio' | 'image' | 'unknown' | undefined;
4
+ error?: string | undefined;
5
+ }>;
6
+ export declare function getMediaType(url?: string): "audio" | "video" | "image" | "unknown";
7
+ export declare function getMediaTypeByExpandedName(fileExpandedName?: string | null): "audio" | "video" | "image" | "unknown";
8
+ export declare function getMediaTypeByUrl(fileUrl?: string | null): "audio" | "video" | "image" | "unknown" | undefined;
9
+ export declare function getFileName(fileUrl?: string): string;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = getMediaInfo;
7
+ exports.getFileName = getFileName;
8
+ exports.getMediaType = getMediaType;
9
+ exports.getMediaTypeByExpandedName = getMediaTypeByExpandedName;
10
+ exports.getMediaTypeByUrl = getMediaTypeByUrl;
11
+ var _getFileExpandedName = _interopRequireDefault(require("./getFileExpandedName"));
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
+ function getMediaInfo(fileUrl) {
14
+ var type = getMediaType(fileUrl);
15
+ if (!type) return Promise.resolve({
16
+ error: '未知的文件类型: ' + fileUrl
17
+ });
18
+ var mediaElement = function () {
19
+ if (type === 'video') return document.createElement('video');
20
+ if (type === 'audio') return document.createElement('audio');
21
+ }();
22
+ if (!mediaElement) return Promise.resolve({
23
+ error: 'Unknown media element'
24
+ });
25
+ mediaElement.src = fileUrl;
26
+ return new Promise(function (resolve) {
27
+ mediaElement.onerror = function () {
28
+ return resolve({
29
+ error: 'onerror'
30
+ });
31
+ };
32
+ mediaElement.onloadedmetadata = function () {
33
+ resolve({
34
+ duration: mediaElement.duration * 1000,
35
+ type: type
36
+ }); // s => ms
37
+ };
38
+ });
39
+ }
40
+
41
+ function getMediaType(url) {
42
+ var fileExpandedName = (0, _getFileExpandedName["default"])(url);
43
+ var type = getMediaTypeByExpandedName(fileExpandedName);
44
+ return type;
45
+ }
46
+ function getMediaTypeByExpandedName(fileExpandedName) {
47
+ if (!fileExpandedName) return 'unknown';
48
+ if (/jpg|jpeg|png$/.test(fileExpandedName)) return 'image';
49
+ if (/mp3|wav$/.test(fileExpandedName)) return 'audio';
50
+ if (/avi|wmv|mpeg|mp4|m4v|mov|asf|flv|f4v|rmvb|rm|3gp|vob$/.test(fileExpandedName)) return 'video';
51
+ return 'unknown';
52
+ }
53
+ function getMediaTypeByUrl(fileUrl) {
54
+ if (!fileUrl) return;
55
+ var fileExpandedName = (0, _getFileExpandedName["default"])(fileUrl);
56
+ return getMediaTypeByExpandedName(fileExpandedName);
57
+ }
58
+ function getFileName(fileUrl) {
59
+ if (!fileUrl) return '';
60
+ var index1 = fileUrl.lastIndexOf('/');
61
+ var index2 = fileUrl.lastIndexOf('\\');
62
+ var index3 = fileUrl.lastIndexOf('\\\\');
63
+ var index = Math.max(index1, index2, index3);
64
+ var ext = fileUrl.substring(index + 1);
65
+ return ext;
66
+ }
@@ -0,0 +1 @@
1
+ export default function setElementDataset(element: any, dataset: Record<string, string | number>): void;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = setElementDataset;
7
+ function setElementDataset(element, dataset) {
8
+ if (element) {
9
+ Object.keys(dataset).forEach(function (key) {
10
+ var value = dataset[key].toString();
11
+ if (element instanceof Element) {
12
+ element.setAttribute("data-".concat(key), value);
13
+ } else if (element instanceof Document) {
14
+ element.documentElement.setAttribute("data-".concat(key), value);
15
+ } else if (element instanceof HTMLElement) {
16
+ element.dataset[key] = value;
17
+ } else {
18
+ element.setAttribute("data-".concat(key), value);
19
+ }
20
+ });
21
+ }
22
+ }
@@ -76,6 +76,10 @@ export interface VreoVideo {
76
76
  start: number;
77
77
  end: number;
78
78
  url: string;
79
+ avatar?: {
80
+ url?: string;
81
+ force?: true;
82
+ };
79
83
  }
80
84
  /**
81
85
  * 剧本结构
@@ -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.1",
3
+ "version": "1.0.0-alpha.11",
4
4
  "description": "Vreo (VR Video 缩写) 是基于如视三维渲染引擎 Five 和 用户界面构建库 React 实现的如视 3D 空间剧本播放器。",
5
5
  "keywords": [
6
6
  "realsee",
@@ -36,7 +36,7 @@
36
36
  "@babel/preset-env": "^7.16.4",
37
37
  "@babel/preset-react": "^7.16.0",
38
38
  "@babel/preset-typescript": "^7.16.0",
39
- "@realsee/dnalogel": "^2.1.0-alpha.17",
39
+ "@realsee/dnalogel": "^2.1.0-alpha.18",
40
40
  "@realsee/five": "5.0.0-alpha.149",
41
41
  "@types/offscreencanvas": "^2019.6.4",
42
42
  "@types/react": "^17.0.37",
@@ -21,17 +21,14 @@ export class Controller extends Subscribe<VreoKeyframeEvent> {
21
21
  playing = false
22
22
  ended = false
23
23
  loading: boolean | null = false // null 表示加载失败
24
- containerSize?: {
25
- width: number
26
- height: number
27
- }
24
+ containerSize: { width: number, height: number } = { width: 0, height: 0 }
28
25
  appSize?: 'S' | 'M' | 'L' | 'XL'
29
26
  container: Element
30
27
  waveAppearance: WaveAppearance | null = null
31
28
  appearance: Appearance = {
32
- waveStyle: 'solid',
29
+ waveStyle: 'wave',
33
30
  }
34
- avatar?: VreoVideo['avatar']
31
+ avatar: VreoVideo['avatar'] = {}
35
32
 
36
33
 
37
34
  visible = false
@@ -164,7 +161,7 @@ export class Controller extends Subscribe<VreoKeyframeEvent> {
164
161
  reaction(
165
162
  () => this.containerSize,
166
163
  (containerSize) => {
167
- if (!containerSize) return
164
+ if (!containerSize?.width) return
168
165
  const width = containerSize.width
169
166
  const height = containerSize.height
170
167
  const size = (() => {
@@ -1,3 +1,5 @@
1
+ // 下面这一行不能删
2
+ import * as React from 'react'
1
3
  import * as ReactDOM from 'react-dom'
2
4
  import { Five, Subscribe } from '@realsee/five'
3
5