@realsee/vreo 2.6.4-alpha.5 → 2.6.4

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 (31) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/lib/PlayController/createHTMLAudioElement.js +14 -10
  3. package/lib/PlayController/index.js +73 -63
  4. package/lib/Player/Controller.js +56 -50
  5. package/lib/Player/PlaybackLifecycle.js +7 -6
  6. package/lib/Player/custom/SpatialScenePanel/index.js +11 -34
  7. package/lib/Player/index.js +166 -160
  8. package/lib/Player/modules/Drawer/index.js +2 -1
  9. package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +157 -146
  10. package/lib/Player/modules/VideoAgent/VideoAgentScene.js +1 -1
  11. package/lib/Player/modules/VideoAgent/index.js +3 -3
  12. package/lib/Player/modules/keyframes/BgMusic/index.js +12 -12
  13. package/lib/Player/modules/keyframes/CameraMovement/index.js +45 -43
  14. package/lib/Player/modules/keyframes/InfoPanel/index.js +8 -8
  15. package/lib/Player/modules/keyframes/ModelVideo/index.js +83 -81
  16. package/lib/Player/modules/keyframes/PanoTag/index.js +1 -1
  17. package/lib/Player/modules/keyframes/PanoTextLabel/index.js +3 -3
  18. package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +3 -3
  19. package/lib/Player/modules/keyframes/VideoEffect/index.js +71 -69
  20. package/lib/fivePlugins/CSS3DRenderPlugin/index.js +6 -6
  21. package/lib/fivePlugins/CameraMovementPlugin/index.js +180 -173
  22. package/lib/fivePlugins/CameraMovementPlugin/typings.js +6 -6
  23. package/lib/fivePlugins/ModelTVVideoPlugin/index.js +59 -57
  24. package/lib/react/index.js +1 -1
  25. package/lib/shared-utils/Audio.js +56 -52
  26. package/lib/shared-utils/AudioLike.js +14 -11
  27. package/lib/shared-utils/animationFrame/BetterTween.js +15 -13
  28. package/lib/shared-utils/animationFrame/tween.js +3 -1
  29. package/lib/shared-utils/getMediaInfo.js +1 -0
  30. package/lib/typings/VreoUnit.js +27 -134
  31. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
1
  # CHANGELOG
2
+
3
+ ## 2.6.4
4
+
5
+ - feat: 讲解支持应用侧 PlaybackManager,一段讲解共享播放任务,保留内部音轨混音。
6
+ - fix: 暂停、抢占和销毁同步停止成员媒体,取消延迟加载与关键帧,避免旧任务复播。
7
+ - chore: dnalogel peer/dev 依赖统一为正式版 3.81.10。
8
+
2
9
  # 2.0.0
3
10
  - fix: 重新实现了运镜功能,修复了运镜掉帧的问题
4
11
  - break-change:修复了模型态切换全景态时的目标点位为0时,有可能不会真正移动到目标位置的问题。该问题的修复会导致之前的一些基于此bug制作的导览出现问题,需要重新制作。
@@ -1,6 +1,5 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
- function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
3
- function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
3
  var BLANK_AUDIO = '' + 'data:audio/mpeg;base64,' + '//uQxAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAADAAAGhgBVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVWqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr///////////' + '////////////////////////////////8AAAA5TEFNRTMuOThyAc0AAAAAAAAAABSAJAiqQgAAg' + 'AAABobxtI73AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//uQxAACFEII9ACZ/sJZwWEoEb8w/////N//////Jcxj' + 'Hjf+7/v/H2PzCCFAiDtGeyBCIx7bJJ1mmEEMy6g8mm2c8nrGABB4h2Mkmn//4z/73u773R5qHHu' + '/j/w7Kxkzh5lWRWdsifCkNAnY9Zc1HvDAhjhSHdFkHFzLmabt/AQxSg2wwzLhHIJOBnAWwVY4zr' + 'hIYhhc2kvhYDfQ4hDi2Gmh5KyFn8EcGIrHAngNgIwVIEMf5bzbAiTRoAD///8z/KVhkkWEle6IX' + '+d/z4fvH3BShK1e5kmjkCMoxVmXhd4ROlTKo3iipasvTilY21q19ta30/v/0/idPX1v8PNxJL6r' + 'amnOVsdvMv2akO0iSYIzdJFirtzWXCZicS9vHqvSKyqm5XJBdqBwPxyfJdykhWTZ0G0ZyTZGpLK' + 'xsNwwoRhsx3tZfhwmeOBVISm3impAC/IT/8hP/EKEM1KMdVdVKM2rHV4x7HVXZvbVVKN/qq8CiV' + '9VL9jjH/6l6qf7MBCjZmOqsAibjcP+qqqv0oxqpa/NVW286hPo1nz2L/h8+jXt//uSxCmDU2IK/' + 'ECN98KKtE5IYzNoCfbw+u9i5r8PoadUMFPKqWL4LK3T/LCraMSHGkW4bpLXR/E6LlHOVQxmslKV' + 'J8IULktMN06N0FKCpHCoYsjC4F+Z0NVqdNFoGSTjSiyjzLdnZ2fNqTi2eHKONONKLMPMKLONKLM' + 'PQRJGlFxZRoKcJFAYEeIFiRQkUWUeYfef//Ko04soswso40UJAgMw8wosososy0EalnZyjQUGBR' + 'QGIFggOWUacWUeYmuadrZziQKKEgQsQLAhQkUJAgMQDghltLO1onp0cpkNInSFMqlYeSEJ5AHsq' + 'FdOwy1DA2sRmRJKxdKRfLhfLw5BzUxBTUUzLjk4LjJVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVUxBTUUzLjk4LjJVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVf/7ksRRA8AAAaQAAAAgAAA0gAAABFVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU=';
5
4
  export function createHTMLAudioElement() {
6
5
  var ndAudio = document.querySelector('#vreo-playController-audio');
@@ -15,14 +14,19 @@ export function createHTMLAudioElement() {
15
14
  audio.src = BLANK_AUDIO;
16
15
 
17
16
  // 触发一次播放
18
- Promise.resolve(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
19
- return _regenerator().w(function (_context) {
20
- while (1) switch (_context.n) {
21
- case 0:
22
- _context.n = 1;
23
- return audio.play();
24
- case 1:
25
- return _context.a(2, _context.v);
17
+ Promise.resolve( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
18
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
19
+ while (1) {
20
+ switch (_context.prev = _context.next) {
21
+ case 0:
22
+ _context.next = 2;
23
+ return audio.play();
24
+ case 2:
25
+ return _context.abrupt("return", _context.sent);
26
+ case 3:
27
+ case "end":
28
+ return _context.stop();
29
+ }
26
30
  }
27
31
  }, _callee);
28
32
  })));
@@ -1,25 +1,27 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
5
7
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
6
- import _inherits from "@babel/runtime/helpers/esm/inherits";
7
8
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
- function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
9
- function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
10
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
11
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
+ 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); }; }
11
+ 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; } }
12
12
  import { Subscribe } from '@realsee/five';
13
13
  import { requestAnimationFrameInterval } from "../shared-utils/animationFrame/index.js";
14
14
  import { createHTMLAudioElement } from "./createHTMLAudioElement.js";
15
15
  var closures = {};
16
16
  export var PlayController = /*#__PURE__*/function (_Subscribe) {
17
+ _inherits(PlayController, _Subscribe);
18
+ var _super = _createSuper(PlayController);
17
19
  function PlayController() {
18
20
  var _this;
19
21
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
20
22
  _classCallCheck(this, PlayController);
21
- _this = _callSuper(this, PlayController);
22
- _defineProperty(_this, "config", {});
23
+ _this = _super.call(this);
24
+ _defineProperty(_assertThisInitialized(_this), "config", {});
23
25
  if (!config.audio) {
24
26
  config.audio = createHTMLAudioElement();
25
27
  }
@@ -63,8 +65,7 @@ export var PlayController = /*#__PURE__*/function (_Subscribe) {
63
65
  /**
64
66
  * 载入数据
65
67
  */
66
- _inherits(PlayController, _Subscribe);
67
- return _createClass(PlayController, [{
68
+ _createClass(PlayController, [{
68
69
  key: "paused",
69
70
  get: function get() {
70
71
  return this.audioInstance.paused;
@@ -103,35 +104,40 @@ export var PlayController = /*#__PURE__*/function (_Subscribe) {
103
104
  }
104
105
  }, {
105
106
  key: "load",
106
- value: (function () {
107
- var _load = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(vreoUnit) {
107
+ value: function () {
108
+ var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(vreoUnit) {
108
109
  var _this3 = this;
109
- return _regenerator().w(function (_context) {
110
- while (1) switch (_context.n) {
111
- case 0:
112
- this.vreoUnit = vreoUnit;
113
- _context.n = 1;
114
- return this.pause();
115
- case 1:
116
- _context.n = 2;
117
- return new Promise(function (resolve, reject) {
118
- if (vreoUnit.video.url === _this3.audioInstance.src) {
119
- return resolve(true);
120
- }
121
- _this3.audioInstance.src = vreoUnit.video.url;
122
- var _canplaythrough = function canplaythrough() {
123
- resolve(true);
124
- _this3.audioInstance.removeEventListener('canplaythrough', _canplaythrough);
125
- };
126
- var _error = function error(err) {
127
- reject(err);
128
- _this3.audioInstance.removeEventListener('error', _error);
129
- };
130
- _this3.audioInstance.addEventListener('canplaythrough', _canplaythrough);
131
- _this3.audioInstance.addEventListener('error', _error);
132
- });
133
- case 2:
134
- return _context.a(2, _context.v);
110
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
111
+ while (1) {
112
+ switch (_context.prev = _context.next) {
113
+ case 0:
114
+ this.vreoUnit = vreoUnit;
115
+ _context.next = 3;
116
+ return this.pause();
117
+ case 3:
118
+ _context.next = 5;
119
+ return new Promise(function (resolve, reject) {
120
+ if (vreoUnit.video.url === _this3.audioInstance.src) {
121
+ return resolve(true);
122
+ }
123
+ _this3.audioInstance.src = vreoUnit.video.url;
124
+ var canplaythrough = function canplaythrough() {
125
+ resolve(true);
126
+ _this3.audioInstance.removeEventListener('canplaythrough', canplaythrough);
127
+ };
128
+ var error = function error(err) {
129
+ reject(err);
130
+ _this3.audioInstance.removeEventListener('error', error);
131
+ };
132
+ _this3.audioInstance.addEventListener('canplaythrough', canplaythrough);
133
+ _this3.audioInstance.addEventListener('error', error);
134
+ });
135
+ case 5:
136
+ return _context.abrupt("return", _context.sent);
137
+ case 6:
138
+ case "end":
139
+ return _context.stop();
140
+ }
135
141
  }
136
142
  }, _callee, this);
137
143
  }));
@@ -143,17 +149,19 @@ export var PlayController = /*#__PURE__*/function (_Subscribe) {
143
149
  /**
144
150
  * 播放
145
151
  */
146
- )
147
152
  }, {
148
153
  key: "play",
149
- value: (function () {
150
- var _play = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
151
- return _regenerator().w(function (_context2) {
152
- while (1) switch (_context2.n) {
153
- case 0:
154
- closures.playPromise = this.audioInstance.play();
155
- case 1:
156
- return _context2.a(2);
154
+ value: function () {
155
+ var _play = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
156
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
157
+ while (1) {
158
+ switch (_context2.prev = _context2.next) {
159
+ case 0:
160
+ closures.playPromise = this.audioInstance.play();
161
+ case 1:
162
+ case "end":
163
+ return _context2.stop();
164
+ }
157
165
  }
158
166
  }, _callee2, this);
159
167
  }));
@@ -165,24 +173,26 @@ export var PlayController = /*#__PURE__*/function (_Subscribe) {
165
173
  /**
166
174
  * 暂停
167
175
  */
168
- )
169
176
  }, {
170
177
  key: "pause",
171
- value: (function () {
172
- var _pause = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
173
- return _regenerator().w(function (_context3) {
174
- while (1) switch (_context3.n) {
175
- case 0:
176
- if (!closures.playPromise) {
177
- _context3.n = 1;
178
- break;
179
- }
180
- _context3.n = 1;
181
- return closures.playPromise;
182
- case 1:
183
- this.audioInstance.pause();
184
- case 2:
185
- return _context3.a(2);
178
+ value: function () {
179
+ var _pause = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
180
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
181
+ while (1) {
182
+ switch (_context3.prev = _context3.next) {
183
+ case 0:
184
+ if (!closures.playPromise) {
185
+ _context3.next = 3;
186
+ break;
187
+ }
188
+ _context3.next = 3;
189
+ return closures.playPromise;
190
+ case 3:
191
+ this.audioInstance.pause();
192
+ case 4:
193
+ case "end":
194
+ return _context3.stop();
195
+ }
186
196
  }
187
197
  }, _callee3, this);
188
198
  }));
@@ -197,7 +207,6 @@ export var PlayController = /*#__PURE__*/function (_Subscribe) {
197
207
  *
198
208
  * @deprecated **慎重执行**
199
209
  */
200
- )
201
210
  }, {
202
211
  key: "dispose",
203
212
  value: function dispose() {
@@ -210,4 +219,5 @@ export var PlayController = /*#__PURE__*/function (_Subscribe) {
210
219
  }
211
220
  }
212
221
  }]);
222
+ return PlayController;
213
223
  }(Subscribe);
@@ -1,14 +1,15 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
5
7
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
6
- import _inherits from "@babel/runtime/helpers/esm/inherits";
7
8
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
11
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11
+ 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); }; }
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; } }
12
13
  import { PlaybackLifecycle } from "./PlaybackLifecycle.js";
13
14
  import { Subscribe } from '@realsee/five';
14
15
  import { action, makeObservable, observable, reaction } from 'mobx';
@@ -42,49 +43,39 @@ import { getMediaType } from "../shared-utils/getMediaInfo.js";
42
43
  * ```
43
44
  */
44
45
  export var Controller = /*#__PURE__*/function (_Subscribe) {
46
+ _inherits(Controller, _Subscribe);
47
+ var _super = _createSuper(Controller);
45
48
  function Controller(_ref) {
46
49
  var _this;
47
50
  var five = _ref.five,
48
51
  container = _ref.container,
49
52
  configs = _ref.configs;
50
53
  _classCallCheck(this, Controller);
51
- _this = _callSuper(this, Controller);
52
- _defineProperty(_this, "playing", false);
53
- _defineProperty(_this, "ended", false);
54
- _defineProperty(_this, "loading", false);
55
- // null 表示加载失败
56
- _defineProperty(_this, "containerSize", {
54
+ _this = _super.call(this);
55
+ _defineProperty(_assertThisInitialized(_this), "playing", false);
56
+ _defineProperty(_assertThisInitialized(_this), "ended", false);
57
+ _defineProperty(_assertThisInitialized(_this), "loading", false);
58
+ _defineProperty(_assertThisInitialized(_this), "containerSize", {
57
59
  width: 0,
58
60
  height: 0
59
61
  });
60
- _defineProperty(_this, "waveAppearance", null);
61
- _defineProperty(_this, "appearance", {
62
+ _defineProperty(_assertThisInitialized(_this), "waveAppearance", null);
63
+ _defineProperty(_assertThisInitialized(_this), "appearance", {
62
64
  waveStyle: 'wave'
63
65
  });
64
- _defineProperty(_this, "avatar", {});
65
- /**
66
- * 是否正在等待背景音乐加载
67
- * 当此状态为 true 时,播放流程会暂停,等待音频加载完成
68
- */
69
- _defineProperty(_this, "waitingForBgMusic", false);
70
- _defineProperty(_this, "visible", false);
71
- _defineProperty(_this, "popUp", null);
72
- _defineProperty(_this, "drawerConfig", null);
73
- /**
74
- * 创建 Controller 实例
75
- * @param params - 构造参数对象
76
- * @param params.five - Five 渲染引擎实例
77
- * @param params.container - DOM 容器元素
78
- * @param params.configs - 播放器配置
79
- */
80
- _defineProperty(_this, "resumeGeneration", 0);
81
- _defineProperty(_this, "disposers", []);
66
+ _defineProperty(_assertThisInitialized(_this), "avatar", {});
67
+ _defineProperty(_assertThisInitialized(_this), "waitingForBgMusic", false);
68
+ _defineProperty(_assertThisInitialized(_this), "visible", false);
69
+ _defineProperty(_assertThisInitialized(_this), "popUp", null);
70
+ _defineProperty(_assertThisInitialized(_this), "drawerConfig", null);
71
+ _defineProperty(_assertThisInitialized(_this), "resumeGeneration", 0);
72
+ _defineProperty(_assertThisInitialized(_this), "disposers", []);
82
73
  _this.playback = new PlaybackLifecycle(configs.mediaManager, function () {
83
74
  var _this$videoAgentScene;
84
75
  _this.resuming = undefined;
85
76
  ++_this.resumeGeneration;
86
77
  _this.setPlaying(false);
87
- (_this$videoAgentScene = _this.videoAgentScene) === null || _this$videoAgentScene === void 0 || _this$videoAgentScene.videoAgentMesh.stop();
78
+ (_this$videoAgentScene = _this.videoAgentScene) === null || _this$videoAgentScene === void 0 ? void 0 : _this$videoAgentScene.videoAgentMesh.stop();
88
79
  _this.setWaitingForBgMusic(false);
89
80
  });
90
81
  _this.configs = configs;
@@ -92,7 +83,7 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
92
83
  _this.five = five;
93
84
  _this.appSize = configs.appSize;
94
85
  _this.appearance = _objectSpread(_objectSpread({}, _this.appearance), configs.appearance);
95
- makeObservable(_this, {
86
+ makeObservable(_assertThisInitialized(_this), {
96
87
  visible: observable,
97
88
  setVisible: action,
98
89
  playing: observable,
@@ -203,10 +194,16 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
203
194
  * 获取播放器是否准备就绪
204
195
  * @returns 是否有可用的视频代理场景
205
196
  */
206
- _inherits(Controller, _Subscribe);
207
- return _createClass(Controller, [{
197
+ _createClass(Controller, [{
208
198
  key: "agentType",
209
199
  get:
200
+ // null 表示加载失败
201
+
202
+ /**
203
+ * 是否正在等待背景音乐加载
204
+ * 当此状态为 true 时,播放流程会暂停,等待音频加载完成
205
+ */
206
+
210
207
  /**
211
208
  * 获取当前播放媒体的类型
212
209
  * @returns 'video' | 'avatar' | 'none' - 媒体类型
@@ -336,6 +333,14 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
336
333
  }
337
334
  this.drawerConfig = drawerConfig;
338
335
  }
336
+
337
+ /**
338
+ * 创建 Controller 实例
339
+ * @param params - 构造参数对象
340
+ * @param params.five - Five 渲染引擎实例
341
+ * @param params.container - DOM 容器元素
342
+ * @param params.configs - 播放器配置
343
+ */
339
344
  }, {
340
345
  key: "ready",
341
346
  get: function get() {
@@ -403,19 +408,19 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
403
408
  if (this.waitingForBgMusic) {
404
409
  var _this$mediaInstance;
405
410
  if (!((_this$mediaInstance = this.mediaInstance) !== null && _this$mediaInstance !== void 0 && _this$mediaInstance.paused)) {
406
- var _this$videoAgentScene5;
407
- (_this$videoAgentScene5 = this.videoAgentScene) === null || _this$videoAgentScene5 === void 0 || (_this$videoAgentScene5 = _this$videoAgentScene5.videoAgentMesh.mediaOperations) === null || _this$videoAgentScene5 === void 0 || _this$videoAgentScene5.pause();
411
+ var _this$videoAgentScene5, _this$videoAgentScene6;
412
+ (_this$videoAgentScene5 = this.videoAgentScene) === null || _this$videoAgentScene5 === void 0 ? void 0 : (_this$videoAgentScene6 = _this$videoAgentScene5.videoAgentMesh.mediaOperations) === null || _this$videoAgentScene6 === void 0 ? void 0 : _this$videoAgentScene6.pause();
408
413
  }
409
414
  return;
410
415
  }
411
416
  if ((_this$mediaInstance2 = this.mediaInstance) !== null && _this$mediaInstance2 !== void 0 && _this$mediaInstance2.ended && this.mediaInstance.currentTime !== 0) {
412
- var _this$vreoUnit, _this$videoAgentScene6;
417
+ var _this$vreoUnit, _this$videoAgentScene7;
413
418
  if (this.ended) return;
414
- (_this$vreoUnit = this.vreoUnit) === null || _this$vreoUnit === void 0 || _this$vreoUnit.keyframes.forEach(function (keyframe) {
419
+ (_this$vreoUnit = this.vreoUnit) === null || _this$vreoUnit === void 0 ? void 0 : _this$vreoUnit.keyframes.forEach(function (keyframe) {
415
420
  return keyframe.parsed = false;
416
421
  });
417
- var media = (_this$videoAgentScene6 = this.videoAgentScene) === null || _this$videoAgentScene6 === void 0 ? void 0 : _this$videoAgentScene6.videoAgentMesh.mediaOperations;
418
- media === null || media === void 0 || media.pause();
422
+ var media = (_this$videoAgentScene7 = this.videoAgentScene) === null || _this$videoAgentScene7 === void 0 ? void 0 : _this$videoAgentScene7.videoAgentMesh.mediaOperations;
423
+ media === null || media === void 0 ? void 0 : media.pause();
419
424
  if (media) media.currentTime = 0;
420
425
  this.playback.finish();
421
426
  this.setEnded(true);
@@ -425,8 +430,8 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
425
430
  if (!this.playing) {
426
431
  var _this$mediaInstance3;
427
432
  if (!((_this$mediaInstance3 = this.mediaInstance) !== null && _this$mediaInstance3 !== void 0 && _this$mediaInstance3.paused)) {
428
- var _this$videoAgentScene7;
429
- (_this$videoAgentScene7 = this.videoAgentScene) === null || _this$videoAgentScene7 === void 0 || (_this$videoAgentScene7 = _this$videoAgentScene7.videoAgentMesh.mediaOperations) === null || _this$videoAgentScene7 === void 0 || _this$videoAgentScene7.pause();
433
+ var _this$videoAgentScene8, _this$videoAgentScene9;
434
+ (_this$videoAgentScene8 = this.videoAgentScene) === null || _this$videoAgentScene8 === void 0 ? void 0 : (_this$videoAgentScene9 = _this$videoAgentScene8.videoAgentMesh.mediaOperations) === null || _this$videoAgentScene9 === void 0 ? void 0 : _this$videoAgentScene9.pause();
430
435
  }
431
436
  return;
432
437
  }
@@ -449,14 +454,14 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
449
454
  _this4 = this;
450
455
  if (this.waitingForBgMusic) return;
451
456
  if ((_this$mediaInstance4 = this.mediaInstance) !== null && _this$mediaInstance4 !== void 0 && _this$mediaInstance4.paused && this.playing && !this.resuming) {
452
- var _this$videoAgentScene8;
457
+ var _this$videoAgentScene10;
453
458
  var attempt = ++this.resumeGeneration;
454
459
  this.resuming = attempt;
455
460
  var run = this.playback.capture();
456
461
  var valid = function valid() {
457
462
  return !!(run !== null && run !== void 0 && run.valid());
458
463
  };
459
- void ((_this$videoAgentScene8 = this.videoAgentScene) === null || _this$videoAgentScene8 === void 0 ? void 0 : _this$videoAgentScene8.videoAgentMesh.play().catch(function (error) {
464
+ void ((_this$videoAgentScene10 = this.videoAgentScene) === null || _this$videoAgentScene10 === void 0 ? void 0 : _this$videoAgentScene10.videoAgentMesh.play().catch(function (error) {
460
465
  if (valid()) {
461
466
  _this4.playback.cancel();
462
467
  console.error(error);
@@ -493,7 +498,7 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
493
498
  value: function clear() {
494
499
  var _this$vreoUnit2, _this$stopInterval;
495
500
  this.setPlaying(false);
496
- (_this$vreoUnit2 = this.vreoUnit) === null || _this$vreoUnit2 === void 0 || _this$vreoUnit2.keyframes.forEach(function (keyframe) {
501
+ (_this$vreoUnit2 = this.vreoUnit) === null || _this$vreoUnit2 === void 0 ? void 0 : _this$vreoUnit2.keyframes.forEach(function (keyframe) {
497
502
  return keyframe.parsed = false;
498
503
  });
499
504
 
@@ -502,11 +507,11 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
502
507
  */
503
508
  this.vreoUnit = undefined;
504
509
  if (this.mediaInstance) {
505
- var _this$videoAgentScene9, _this$videoAgentScene0;
506
- (_this$videoAgentScene9 = this.videoAgentScene) === null || _this$videoAgentScene9 === void 0 || (_this$videoAgentScene9 = _this$videoAgentScene9.videoAgentMesh.mediaOperations) === null || _this$videoAgentScene9 === void 0 || _this$videoAgentScene9.pause();
507
- if ((_this$videoAgentScene0 = this.videoAgentScene) !== null && _this$videoAgentScene0 !== void 0 && _this$videoAgentScene0.videoAgentMesh.mediaOperations) this.videoAgentScene.videoAgentMesh.mediaOperations.currentTime = 0;
510
+ var _this$videoAgentScene11, _this$videoAgentScene12, _this$videoAgentScene13;
511
+ (_this$videoAgentScene11 = this.videoAgentScene) === null || _this$videoAgentScene11 === void 0 ? void 0 : (_this$videoAgentScene12 = _this$videoAgentScene11.videoAgentMesh.mediaOperations) === null || _this$videoAgentScene12 === void 0 ? void 0 : _this$videoAgentScene12.pause();
512
+ if ((_this$videoAgentScene13 = this.videoAgentScene) !== null && _this$videoAgentScene13 !== void 0 && _this$videoAgentScene13.videoAgentMesh.mediaOperations) this.videoAgentScene.videoAgentMesh.mediaOperations.currentTime = 0;
508
513
  }
509
- (_this$stopInterval = this.stopInterval) === null || _this$stopInterval === void 0 || _this$stopInterval.call(this);
514
+ (_this$stopInterval = this.stopInterval) === null || _this$stopInterval === void 0 ? void 0 : _this$stopInterval.call(this);
510
515
  this.stopInterval = undefined;
511
516
  }
512
517
 
@@ -525,6 +530,7 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
525
530
  this.clear();
526
531
  }
527
532
  }]);
533
+ return Controller;
528
534
  }(Subscribe);
529
535
  var ControllerContext = /*#__PURE__*/React.createContext(null);
530
536
  export { ControllerContext };
@@ -18,7 +18,7 @@ export var PlaybackLifecycle = /*#__PURE__*/function () {
18
18
  }
19
19
  });
20
20
  }
21
- return _createClass(PlaybackLifecycle, [{
21
+ _createClass(PlaybackLifecycle, [{
22
22
  key: "active",
23
23
  get: function get() {
24
24
  var _this$run;
@@ -77,9 +77,9 @@ export var PlaybackLifecycle = /*#__PURE__*/function () {
77
77
  errors.push(error);
78
78
  }
79
79
  for (var _i = 0, _arr = _toConsumableArray(this.members); _i < _arr.length; _i++) {
80
- var _stop = _arr[_i];
80
+ var stop = _arr[_i];
81
81
  try {
82
- _stop();
82
+ stop();
83
83
  } catch (error) {
84
84
  errors.push(error);
85
85
  }
@@ -91,7 +91,7 @@ export var PlaybackLifecycle = /*#__PURE__*/function () {
91
91
  value: function cancel() {
92
92
  var _this$controller2;
93
93
  var generation = this.generation;
94
- (_this$controller2 = this.controller) === null || _this$controller2 === void 0 || _this$controller2.cancel();
94
+ (_this$controller2 = this.controller) === null || _this$controller2 === void 0 ? void 0 : _this$controller2.cancel();
95
95
  if (generation === this.generation) this.stop();
96
96
  }
97
97
  }, {
@@ -100,7 +100,7 @@ export var PlaybackLifecycle = /*#__PURE__*/function () {
100
100
  var _this$run2;
101
101
  var session = (_this$run2 = this.run) === null || _this$run2 === void 0 ? void 0 : _this$run2.session;
102
102
  this.stop();
103
- session === null || session === void 0 || session.finish();
103
+ session === null || session === void 0 ? void 0 : session.finish();
104
104
  }
105
105
  }, {
106
106
  key: "dispose",
@@ -109,9 +109,10 @@ export var PlaybackLifecycle = /*#__PURE__*/function () {
109
109
  if (this.disposed) return;
110
110
  this.disposed = true;
111
111
  var generation = this.generation;
112
- (_this$controller3 = this.controller) === null || _this$controller3 === void 0 || _this$controller3.dispose();
112
+ (_this$controller3 = this.controller) === null || _this$controller3 === void 0 ? void 0 : _this$controller3.dispose();
113
113
  if (generation === this.generation) this.stop();
114
114
  this.members.clear();
115
115
  }
116
116
  }]);
117
+ return PlaybackLifecycle;
117
118
  }();