@realsee/vreo 2.6.2 → 2.6.4-alpha.2
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.
- package/lib/PlayController/createHTMLAudioElement.js +10 -14
- package/lib/PlayController/index.js +63 -73
- package/lib/Player/App.js +2 -2
- package/lib/Player/AudioFocus.d.ts +36 -0
- package/lib/Player/AudioFocus.js +139 -0
- package/lib/Player/Controller.d.ts +16 -0
- package/lib/Player/Controller.js +119 -61
- package/lib/Player/custom/SpatialScenePanel/index.js +34 -11
- package/lib/Player/index.d.ts +8 -2
- package/lib/Player/index.js +182 -123
- package/lib/Player/modules/Drawer/index.js +1 -2
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +8 -1
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +173 -203
- package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +1 -0
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +6 -2
- package/lib/Player/modules/VideoAgent/index.js +10 -2
- package/lib/Player/modules/keyframes/BgMusic/index.js +46 -54
- package/lib/Player/modules/keyframes/CameraMovement/index.js +43 -45
- package/lib/Player/modules/keyframes/InfoPanel/index.js +37 -32
- package/lib/Player/modules/keyframes/ModelVideo/index.js +98 -57
- package/lib/Player/modules/keyframes/PanoTag/index.js +1 -1
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +3 -3
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +3 -3
- package/lib/Player/modules/keyframes/VideoEffect/index.js +87 -74
- package/lib/Player/typings.d.ts +10 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +6 -6
- package/lib/fivePlugins/CameraMovementPlugin/index.js +173 -180
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +6 -6
- package/lib/fivePlugins/ModelTVVideoPlugin/index.d.ts +2 -0
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +87 -43
- package/lib/index.d.ts +1 -0
- package/lib/react/index.js +1 -1
- package/lib/shared-utils/Audio.js +53 -56
- package/lib/shared-utils/AudioLike.js +12 -14
- package/lib/shared-utils/animationFrame/BetterTween.js +13 -15
- package/lib/shared-utils/animationFrame/tween.js +1 -3
- package/lib/shared-utils/getMediaInfo.js +0 -1
- package/lib/typings/VreoUnit.js +134 -27
- package/package.json +6 -4
- package/docs/.nojekyll +0 -1
- package/docs/assets/custom.css +0 -78
- package/docs/assets/hierarchy.js +0 -1
- package/docs/assets/highlight.css +0 -127
- package/docs/assets/icons.js +0 -18
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -60
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1640
- package/docs/classes/Player.AudioLike.html +0 -15
- package/docs/classes/Player.Controller.html +0 -87
- package/docs/classes/Player.Player.html +0 -54
- package/docs/classes/Player.VideoAgentMesh.html +0 -72
- package/docs/classes/Player.VideoAgentScene.html +0 -9
- package/docs/demo/assets/AppReact-CkuqZtcS.js +0 -1
- package/docs/demo/assets/default-BQGCQRLt.css +0 -1
- package/docs/demo/assets/default-CVvVdmSW.js +0 -5540
- package/docs/demo/assets/dynamic-CO5wq52h.js +0 -1
- package/docs/demo/assets/examples-BCLzFApO.css +0 -1
- package/docs/demo/assets/examples-DfiAz2fR.js +0 -25
- package/docs/demo/assets/index-CBBSwaYT.js +0 -1
- package/docs/demo/assets/index-CmEXi2sK.css +0 -1
- package/docs/demo/assets/main-BF1tvUg-.js +0 -25
- package/docs/demo/assets/react-BnzBLum3.css +0 -1
- package/docs/demo/assets/react-C4h9qndP.js +0 -25
- package/docs/demo/examples.html +0 -16
- package/docs/demo/index-react-dynamic.html +0 -18
- package/docs/demo/index-react.html +0 -19
- package/docs/demo/index.html +0 -19
- package/docs/enums/Player.InfoPanelStyleEnum.html +0 -3
- package/docs/enums/Player.InfoPanelTypeEnum.html +0 -4
- package/docs/enums/Player.PanoEffectEnum.html +0 -4
- package/docs/enums/Player.PanoTagEnum.html +0 -4
- package/docs/enums/Player.PanoTagStyleEnum.html +0 -6
- package/docs/enums/Player.VreoKeyframeEnum.html +0 -25
- package/docs/enums/fivePlugins.CameraMovementEffect.html +0 -3
- package/docs/enums/fivePlugins.Rotation.html +0 -4
- package/docs/functions/custom.SpatialScenePanel.html +0 -2
- package/docs/functions/react.useVreoAction.html +0 -8
- package/docs/functions/react.useVreoEventCallback.html +0 -10
- package/docs/functions/react.useVreoPausedState.html +0 -8
- package/docs/hierarchy.html +0 -1
- package/docs/index.html +0 -160
- package/docs/interfaces/Player.Appearance.html +0 -2
- package/docs/interfaces/Player.CustomVreoKeyframeProps.html +0 -3
- package/docs/interfaces/Player.PlayerConfigs.html +0 -20
- package/docs/interfaces/Player.Vertex.html +0 -5
- package/docs/interfaces/Player.VideoAgentMeshOptions.html +0 -9
- package/docs/interfaces/Player.VreoKeyframe.html +0 -8
- package/docs/interfaces/Player.VreoUnit.html +0 -9
- package/docs/interfaces/Player.VreoVideo.html +0 -7
- package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +0 -8
- package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +0 -3
- package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +0 -5
- package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +0 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +0 -5
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +0 -4
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +0 -2
- package/docs/interfaces/fivePlugins.Vector3Position.html +0 -5
- package/docs/interfaces/react.VreoActionCallbacks.html +0 -18
- package/docs/interfaces/react.VreoProviderProps.html +0 -6
- package/docs/modules/Player.html +0 -1
- package/docs/modules/custom.html +0 -1
- package/docs/modules/fivePlugins.html +0 -1
- package/docs/modules/react.html +0 -1
- package/docs/modules.html +0 -1
- package/docs/types/Player.AppSize.html +0 -1
- package/docs/types/Player.AudioLikeEvent.html +0 -6
- package/docs/types/Player.CameraMovementData.html +0 -2
- package/docs/types/Player.CustomData.html +0 -2
- package/docs/types/Player.InfoPanelData.html +0 -7
- package/docs/types/Player.ModelVideoData.html +0 -9
- package/docs/types/Player.PanoEffectData.html +0 -4
- package/docs/types/Player.PanoTagData.html +0 -6
- package/docs/types/Player.PanoTextLabelData.html +0 -7
- package/docs/types/Player.PrompterData.html +0 -3
- package/docs/types/Player.QuadrangleVertexs.html +0 -2
- package/docs/types/Player.Quaternion.html +0 -6
- package/docs/types/Player.UpdateVRPanoramaData.html +0 -7
- package/docs/types/Player.Vertexs.html +0 -2
- package/docs/types/Player.VideoEffectData.html +0 -7
- package/docs/types/Player.VreoKeyframeEvent.html +0 -2
- package/docs/types/Player.VreoKeyframeMap.html +0 -6
- package/docs/types/Player.VreoSubscribe.html +0 -1
- package/docs/types/Player.WaveAppearance.html +0 -1
- package/docs/types/fivePlugins.CSS3DRenderPluginParameterType.html +0 -1
- package/docs/types/fivePlugins.MoveArgs.html +0 -1
- package/docs/types/fivePlugins.MoveOpts.html +0 -1
- package/docs/types/fivePlugins.RotateArgs.html +0 -1
- package/docs/types/fivePlugins.RotateOpts.html +0 -1
- package/docs/variables/fivePlugins.CSS3DRenderPlugin.html +0 -3
- package/docs/variables/fivePlugins.CameraMovementPlugin.html +0 -2
- package/docs/variables/fivePlugins.ModelTVVideoPlugin.html +0 -1
- package/docs/variables/react.VreoProvider.html +0 -9
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
-
|
|
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); }
|
|
3
4
|
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=';
|
|
4
5
|
export function createHTMLAudioElement() {
|
|
5
6
|
var ndAudio = document.querySelector('#vreo-playController-audio');
|
|
@@ -14,19 +15,14 @@ export function createHTMLAudioElement() {
|
|
|
14
15
|
audio.src = BLANK_AUDIO;
|
|
15
16
|
|
|
16
17
|
// 触发一次播放
|
|
17
|
-
Promise.resolve(
|
|
18
|
-
return
|
|
19
|
-
while (1) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return _context.abrupt("return", _context.sent);
|
|
26
|
-
case 3:
|
|
27
|
-
case "end":
|
|
28
|
-
return _context.stop();
|
|
29
|
-
}
|
|
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);
|
|
30
26
|
}
|
|
31
27
|
}, _callee);
|
|
32
28
|
})));
|
|
@@ -1,27 +1,25 @@
|
|
|
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";
|
|
6
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
7
5
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
6
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
8
7
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
function
|
|
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; })(); }
|
|
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);
|
|
19
17
|
function PlayController() {
|
|
20
18
|
var _this;
|
|
21
19
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
22
20
|
_classCallCheck(this, PlayController);
|
|
23
|
-
_this =
|
|
24
|
-
_defineProperty(
|
|
21
|
+
_this = _callSuper(this, PlayController);
|
|
22
|
+
_defineProperty(_this, "config", {});
|
|
25
23
|
if (!config.audio) {
|
|
26
24
|
config.audio = createHTMLAudioElement();
|
|
27
25
|
}
|
|
@@ -65,7 +63,8 @@ export var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
65
63
|
/**
|
|
66
64
|
* 载入数据
|
|
67
65
|
*/
|
|
68
|
-
|
|
66
|
+
_inherits(PlayController, _Subscribe);
|
|
67
|
+
return _createClass(PlayController, [{
|
|
69
68
|
key: "paused",
|
|
70
69
|
get: function get() {
|
|
71
70
|
return this.audioInstance.paused;
|
|
@@ -104,40 +103,35 @@ export var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
104
103
|
}
|
|
105
104
|
}, {
|
|
106
105
|
key: "load",
|
|
107
|
-
value: function () {
|
|
108
|
-
var _load = _asyncToGenerator(
|
|
106
|
+
value: (function () {
|
|
107
|
+
var _load = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(vreoUnit) {
|
|
109
108
|
var _this3 = this;
|
|
110
|
-
return
|
|
111
|
-
while (1) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return _context.abrupt("return", _context.sent);
|
|
137
|
-
case 6:
|
|
138
|
-
case "end":
|
|
139
|
-
return _context.stop();
|
|
140
|
-
}
|
|
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);
|
|
141
135
|
}
|
|
142
136
|
}, _callee, this);
|
|
143
137
|
}));
|
|
@@ -149,19 +143,17 @@ export var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
149
143
|
/**
|
|
150
144
|
* 播放
|
|
151
145
|
*/
|
|
146
|
+
)
|
|
152
147
|
}, {
|
|
153
148
|
key: "play",
|
|
154
|
-
value: function () {
|
|
155
|
-
var _play = _asyncToGenerator(
|
|
156
|
-
return
|
|
157
|
-
while (1) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
case "end":
|
|
163
|
-
return _context2.stop();
|
|
164
|
-
}
|
|
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);
|
|
165
157
|
}
|
|
166
158
|
}, _callee2, this);
|
|
167
159
|
}));
|
|
@@ -173,26 +165,24 @@ export var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
173
165
|
/**
|
|
174
166
|
* 暂停
|
|
175
167
|
*/
|
|
168
|
+
)
|
|
176
169
|
}, {
|
|
177
170
|
key: "pause",
|
|
178
|
-
value: function () {
|
|
179
|
-
var _pause = _asyncToGenerator(
|
|
180
|
-
return
|
|
181
|
-
while (1) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
case "end":
|
|
194
|
-
return _context3.stop();
|
|
195
|
-
}
|
|
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);
|
|
196
186
|
}
|
|
197
187
|
}, _callee3, this);
|
|
198
188
|
}));
|
|
@@ -207,6 +197,7 @@ export var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
207
197
|
*
|
|
208
198
|
* @deprecated **慎重执行**
|
|
209
199
|
*/
|
|
200
|
+
)
|
|
210
201
|
}, {
|
|
211
202
|
key: "dispose",
|
|
212
203
|
value: function dispose() {
|
|
@@ -219,5 +210,4 @@ export var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
219
210
|
}
|
|
220
211
|
}
|
|
221
212
|
}]);
|
|
222
|
-
return PlayController;
|
|
223
213
|
}(Subscribe);
|
package/lib/Player/App.js
CHANGED
|
@@ -36,9 +36,9 @@ var AppView = observer(function (_ref) {
|
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
if (controller.playing) {
|
|
39
|
-
controller.
|
|
39
|
+
controller.audioFocus.cancel('paused');
|
|
40
40
|
} else {
|
|
41
|
-
controller.setPlaying(true);
|
|
41
|
+
if (controller.audioFocus.acquire('user')) controller.setPlaying(true);
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
options: ((_controller$configs3 = controller.configs) === null || _controller$configs3 === void 0 ? void 0 : _controller$configs3.videoAgentMeshOptions) || {}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type AudioIntent = 'user' | 'auto';
|
|
2
|
+
export type AudioStopReason = 'preempted' | 'paused' | 'closed' | 'replaced' | 'disposed';
|
|
3
|
+
export interface AudioLease {
|
|
4
|
+
readonly signal: AbortSignal;
|
|
5
|
+
isCurrent(): boolean;
|
|
6
|
+
release(): void;
|
|
7
|
+
}
|
|
8
|
+
export interface AudioSource {
|
|
9
|
+
acquire(intent: AudioIntent): AudioLease | null;
|
|
10
|
+
cancel(reason: AudioStopReason): void;
|
|
11
|
+
dispose(): void;
|
|
12
|
+
}
|
|
13
|
+
export interface AudioFocusHost {
|
|
14
|
+
register(options: {
|
|
15
|
+
label: string;
|
|
16
|
+
stop(reason: AudioStopReason): void;
|
|
17
|
+
}): AudioSource;
|
|
18
|
+
}
|
|
19
|
+
/** One narration owns the outer lease; member tracks never compete with it. */
|
|
20
|
+
export declare class NarrationAudioFocus {
|
|
21
|
+
private onStop;
|
|
22
|
+
private disposed;
|
|
23
|
+
private source?;
|
|
24
|
+
private lease?;
|
|
25
|
+
private task?;
|
|
26
|
+
private members;
|
|
27
|
+
constructor(host: AudioFocusHost | undefined, onStop: () => void);
|
|
28
|
+
get active(): boolean;
|
|
29
|
+
capture(): () => boolean;
|
|
30
|
+
acquire(intent: AudioIntent): boolean;
|
|
31
|
+
add(stop: (reason: AudioStopReason) => void): () => void;
|
|
32
|
+
stop(reason: AudioStopReason): void;
|
|
33
|
+
cancel(reason: AudioStopReason): void;
|
|
34
|
+
dispose(): void;
|
|
35
|
+
readonly host: AudioFocusHost;
|
|
36
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
|
+
/** One narration owns the outer lease; member tracks never compete with it. */
|
|
6
|
+
export var NarrationAudioFocus = /*#__PURE__*/function () {
|
|
7
|
+
function NarrationAudioFocus(host, onStop) {
|
|
8
|
+
var _this = this;
|
|
9
|
+
_classCallCheck(this, NarrationAudioFocus);
|
|
10
|
+
_defineProperty(this, "disposed", false);
|
|
11
|
+
_defineProperty(this, "members", new Set());
|
|
12
|
+
_defineProperty(this, "host", {
|
|
13
|
+
register: function register(_ref) {
|
|
14
|
+
var stop = _ref.stop;
|
|
15
|
+
var disposed = false;
|
|
16
|
+
var child;
|
|
17
|
+
var cancel = function cancel(reason) {
|
|
18
|
+
var _child;
|
|
19
|
+
(_child = child) === null || _child === void 0 || _child.abort();
|
|
20
|
+
child = undefined;
|
|
21
|
+
stop(reason);
|
|
22
|
+
};
|
|
23
|
+
var remove = _this.add(cancel);
|
|
24
|
+
return {
|
|
25
|
+
acquire: function acquire() {
|
|
26
|
+
var _child2;
|
|
27
|
+
if (disposed || !_this.active) return null;
|
|
28
|
+
(_child2 = child) === null || _child2 === void 0 || _child2.abort();
|
|
29
|
+
var current = child = new AbortController();
|
|
30
|
+
var valid = _this.capture();
|
|
31
|
+
return {
|
|
32
|
+
signal: current.signal,
|
|
33
|
+
isCurrent: function isCurrent() {
|
|
34
|
+
return valid() && child === current && !current.signal.aborted;
|
|
35
|
+
},
|
|
36
|
+
release: function release() {
|
|
37
|
+
if (child === current) {
|
|
38
|
+
current.abort();
|
|
39
|
+
child = undefined;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
cancel: cancel,
|
|
45
|
+
dispose: function dispose() {
|
|
46
|
+
if (disposed) return;
|
|
47
|
+
disposed = true;
|
|
48
|
+
cancel('disposed');
|
|
49
|
+
remove();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
this.onStop = onStop;
|
|
55
|
+
this.source = host === null || host === void 0 ? void 0 : host.register({
|
|
56
|
+
label: 'vreo',
|
|
57
|
+
stop: function stop(reason) {
|
|
58
|
+
return _this.stop(reason);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return _createClass(NarrationAudioFocus, [{
|
|
63
|
+
key: "active",
|
|
64
|
+
get: function get() {
|
|
65
|
+
var _this$lease;
|
|
66
|
+
return !!this.task && !this.task.signal.aborted && (!this.source || !!((_this$lease = this.lease) !== null && _this$lease !== void 0 && _this$lease.isCurrent()));
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "capture",
|
|
70
|
+
value: function capture() {
|
|
71
|
+
var _this2 = this;
|
|
72
|
+
var task = this.task;
|
|
73
|
+
return function () {
|
|
74
|
+
return !!task && task === _this2.task && _this2.active;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
key: "acquire",
|
|
79
|
+
value: function acquire(intent) {
|
|
80
|
+
var _this$source;
|
|
81
|
+
if (this.disposed) return false;
|
|
82
|
+
if (this.active) return true;
|
|
83
|
+
var lease = (_this$source = this.source) === null || _this$source === void 0 ? void 0 : _this$source.acquire(intent);
|
|
84
|
+
if (this.source && !lease) return false;
|
|
85
|
+
this.lease = lease !== null && lease !== void 0 ? lease : undefined;
|
|
86
|
+
this.task = new AbortController();
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
}, {
|
|
90
|
+
key: "add",
|
|
91
|
+
value: function add(stop) {
|
|
92
|
+
var _this3 = this;
|
|
93
|
+
this.members.add(stop);
|
|
94
|
+
return function () {
|
|
95
|
+
_this3.members.delete(stop);
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
key: "stop",
|
|
100
|
+
value: function stop(reason) {
|
|
101
|
+
var _this$task;
|
|
102
|
+
(_this$task = this.task) === null || _this$task === void 0 || _this$task.abort();
|
|
103
|
+
this.task = undefined;
|
|
104
|
+
var errors = [];
|
|
105
|
+
try {
|
|
106
|
+
this.onStop();
|
|
107
|
+
} catch (error) {
|
|
108
|
+
errors.push(error);
|
|
109
|
+
}
|
|
110
|
+
for (var _i = 0, _arr = _toConsumableArray(this.members); _i < _arr.length; _i++) {
|
|
111
|
+
var _stop = _arr[_i];
|
|
112
|
+
try {
|
|
113
|
+
_stop(reason);
|
|
114
|
+
} catch (error) {
|
|
115
|
+
errors.push(error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (errors.length) throw errors[0];
|
|
119
|
+
}
|
|
120
|
+
}, {
|
|
121
|
+
key: "cancel",
|
|
122
|
+
value: function cancel(reason) {
|
|
123
|
+
var _this$source2;
|
|
124
|
+
this.stop(reason);
|
|
125
|
+
(_this$source2 = this.source) === null || _this$source2 === void 0 || _this$source2.cancel(reason);
|
|
126
|
+
this.lease = undefined;
|
|
127
|
+
}
|
|
128
|
+
}, {
|
|
129
|
+
key: "dispose",
|
|
130
|
+
value: function dispose() {
|
|
131
|
+
var _this$source3;
|
|
132
|
+
if (this.disposed) return;
|
|
133
|
+
this.disposed = true;
|
|
134
|
+
this.cancel('disposed');
|
|
135
|
+
(_this$source3 = this.source) === null || _this$source3 === void 0 || _this$source3.dispose();
|
|
136
|
+
this.members.clear();
|
|
137
|
+
}
|
|
138
|
+
}]);
|
|
139
|
+
}();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NarrationAudioFocus } from './AudioFocus';
|
|
1
2
|
import { Five, Subscribe } from '@realsee/five';
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { VreoKeyframe, VreoKeyframeEnum, VreoKeyframeEvent, VreoUnit, VreoVideo } from '../typings/VreoUnit';
|
|
@@ -45,6 +46,11 @@ export declare class Controller extends Subscribe<VreoKeyframeEvent> {
|
|
|
45
46
|
waveAppearance: WaveAppearance | null;
|
|
46
47
|
appearance: Appearance;
|
|
47
48
|
avatar: VreoVideo['avatar'];
|
|
49
|
+
/**
|
|
50
|
+
* 是否正在等待背景音乐加载
|
|
51
|
+
* 当此状态为 true 时,播放流程会暂停,等待音频加载完成
|
|
52
|
+
*/
|
|
53
|
+
waitingForBgMusic: boolean;
|
|
48
54
|
visible: boolean;
|
|
49
55
|
/**
|
|
50
56
|
* 获取当前播放媒体的类型
|
|
@@ -92,6 +98,11 @@ export declare class Controller extends Subscribe<VreoKeyframeEvent> {
|
|
|
92
98
|
* @param ended - 是否已结束
|
|
93
99
|
*/
|
|
94
100
|
setEnded(ended: boolean): void;
|
|
101
|
+
/**
|
|
102
|
+
* 设置是否正在等待背景音乐加载
|
|
103
|
+
* @param waiting - 是否正在等待
|
|
104
|
+
*/
|
|
105
|
+
setWaitingForBgMusic(waiting: boolean): void;
|
|
95
106
|
/**
|
|
96
107
|
* 设置播放器外观
|
|
97
108
|
* @param appearance - 外观配置对象
|
|
@@ -112,6 +123,10 @@ export declare class Controller extends Subscribe<VreoKeyframeEvent> {
|
|
|
112
123
|
* @param params.container - DOM 容器元素
|
|
113
124
|
* @param params.configs - 播放器配置
|
|
114
125
|
*/
|
|
126
|
+
private resumeGeneration;
|
|
127
|
+
private resuming;
|
|
128
|
+
private disposers;
|
|
129
|
+
readonly audioFocus: NarrationAudioFocus;
|
|
115
130
|
constructor({ five, container, configs }: {
|
|
116
131
|
five: Five;
|
|
117
132
|
container: Element;
|
|
@@ -144,6 +159,7 @@ export declare class Controller extends Subscribe<VreoKeyframeEvent> {
|
|
|
144
159
|
* @param callback - 关键帧触发时的回调函数
|
|
145
160
|
*/
|
|
146
161
|
requestAnimationFrameLoop(callback: (type: VreoKeyframeEnum, keyframe: VreoKeyframe, currentTime: number) => void): void;
|
|
162
|
+
private resumeMedia;
|
|
147
163
|
/**
|
|
148
164
|
* 开始运行播放器逻辑循环
|
|
149
165
|
*
|