@realsee/vreo 2.4.7 → 2.5.0-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/README.md +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Player.AudioLike.html +2 -2
- package/docs/classes/Player.Controller.html +52 -4
- package/docs/classes/Player.Player.html +43 -2
- package/docs/classes/Player.VideoAgentMesh.html +61 -4
- package/docs/classes/Player.VideoAgentScene.html +2 -2
- package/docs/demo/assets/{examples-5qw3pq5z.js → examples-DfiAz2fR.js} +1 -1
- package/docs/demo/assets/react-BnzBLum3.css +1 -0
- package/docs/demo/examples.html +1 -1
- package/docs/demo/index-react.html +2 -2
- package/docs/demo/index.html +1 -1
- package/docs/enums/Player.InfoPanelStyleEnum.html +2 -2
- package/docs/enums/Player.InfoPanelTypeEnum.html +2 -2
- package/docs/enums/Player.PanoEffectEnum.html +2 -2
- package/docs/enums/Player.PanoTagEnum.html +2 -2
- package/docs/enums/Player.PanoTagStyleEnum.html +3 -3
- package/docs/enums/Player.VreoKeyframeEnum.html +13 -13
- package/docs/enums/fivePlugins.CameraMovementEffect.html +2 -2
- package/docs/enums/fivePlugins.Rotation.html +2 -2
- package/docs/functions/custom.SpatialScenePanel.html +1 -1
- package/docs/functions/react.useVreoAction.html +8 -1
- package/docs/functions/react.useVreoEventCallback.html +10 -1
- package/docs/functions/react.useVreoPausedState.html +8 -1
- package/docs/index.html +1 -1
- package/docs/interfaces/Player.Appearance.html +2 -0
- package/docs/interfaces/Player.CustomVreoKeyframeProps.html +2 -2
- package/docs/interfaces/Player.PlayerConfigs.html +6 -6
- package/docs/interfaces/Player.Vertex.html +2 -2
- package/docs/interfaces/Player.VideoAgentMeshOptions.html +5 -4
- package/docs/interfaces/Player.VreoKeyframe.html +2 -2
- package/docs/interfaces/Player.VreoUnit.html +2 -2
- package/docs/interfaces/Player.VreoVideo.html +2 -2
- package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +7 -5
- package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +2 -2
- package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +3 -3
- package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +1 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +2 -2
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +2 -2
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +2 -2
- package/docs/interfaces/fivePlugins.Vector3Position.html +2 -2
- package/docs/interfaces/react.VreoActionCallbacks.html +7 -7
- package/docs/interfaces/react.VreoProviderProps.html +5 -2
- package/docs/modules/Player.html +1 -1
- package/docs/modules/fivePlugins.html +1 -1
- package/docs/types/Player.AppSize.html +1 -0
- package/docs/types/Player.AudioLikeEvent.html +2 -2
- package/docs/types/Player.CameraMovementData.html +1 -1
- package/docs/types/Player.CustomData.html +1 -1
- package/docs/types/Player.InfoPanelData.html +2 -2
- package/docs/types/Player.ModelVideoData.html +5 -5
- package/docs/types/Player.PanoEffectData.html +2 -2
- package/docs/types/Player.PanoTagData.html +2 -2
- package/docs/types/Player.PanoTextLabelData.html +2 -2
- package/docs/types/Player.PrompterData.html +2 -2
- package/docs/types/Player.QuadrangleVertexs.html +1 -1
- package/docs/types/Player.Quaternion.html +2 -2
- package/docs/types/Player.UpdateVRPanoramaData.html +2 -2
- package/docs/types/Player.Vertexs.html +1 -1
- package/docs/types/Player.VideoEffectData.html +2 -2
- package/docs/types/Player.VreoKeyframeEvent.html +1 -1
- package/docs/types/Player.VreoKeyframeMap.html +2 -2
- package/docs/types/Player.VreoSubscribe.html +1 -1
- package/docs/types/Player.WaveAppearance.html +1 -0
- package/docs/types/fivePlugins.CSS3DRenderPluginParameterType.html +1 -0
- package/docs/types/fivePlugins.MoveArgs.html +1 -1
- package/docs/types/fivePlugins.MoveOpts.html +1 -1
- package/docs/types/fivePlugins.RotateArgs.html +1 -1
- package/docs/types/fivePlugins.RotateOpts.html +1 -1
- package/docs/variables/fivePlugins.CSS3DRenderPlugin.html +2 -2
- package/docs/variables/fivePlugins.CameraMovementPlugin.html +1 -1
- package/docs/variables/fivePlugins.ModelTVVideoPlugin.html +1 -1
- package/docs/variables/react.VreoProvider.html +9 -1
- package/lib/PlayController/createHTMLAudioElement.js +5 -12
- package/lib/PlayController/index.js +27 -34
- package/lib/Player/App.js +25 -34
- package/lib/Player/Controller.d.ts +106 -2
- package/lib/Player/Controller.js +190 -78
- package/lib/Player/custom/SpatialScenePanel/index.js +20 -31
- package/lib/Player/hooks.js +6 -15
- package/lib/Player/index.d.ts +103 -0
- package/lib/Player/index.js +153 -45
- package/lib/Player/modules/Drawer/index.js +8 -17
- package/lib/Player/modules/PopUp/index.js +8 -17
- package/lib/Player/modules/ResizeObserver/index.js +10 -17
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +108 -7
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +157 -52
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +16 -25
- package/lib/Player/modules/VideoAgent/index.js +8 -17
- package/lib/Player/modules/Wave/index.js +24 -33
- package/lib/Player/modules/keyframes/BgMusic/index.js +13 -22
- package/lib/Player/modules/keyframes/CameraMovement/index.js +17 -26
- package/lib/Player/modules/keyframes/InfoPanel/index.js +13 -21
- package/lib/Player/modules/keyframes/ModelVideo/index.js +17 -26
- package/lib/Player/modules/keyframes/PanoEffect/index.js +21 -30
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +6 -14
- package/lib/Player/modules/keyframes/PanoTag/index.js +10 -18
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +19 -28
- package/lib/Player/modules/keyframes/Prompter/index.js +13 -22
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +16 -24
- package/lib/Player/modules/keyframes/VideoEffect/index.js +18 -28
- package/lib/Player/typings.js +1 -5
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +3 -9
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +1 -7
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +1 -7
- package/lib/fivePlugins/CSS3DRenderPlugin/index.d.ts +6 -12
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +27 -37
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +3 -9
- package/lib/fivePlugins/CameraMovementPlugin/index.js +15 -22
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +6 -10
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +9 -18
- package/lib/index.js +1 -12
- package/lib/react/index.d.ts +111 -0
- package/lib/react/index.js +148 -24
- package/lib/shared-utils/Audio.js +27 -37
- package/lib/shared-utils/AudioLike.js +22 -29
- package/lib/shared-utils/Preloader.js +1 -7
- package/lib/shared-utils/addResizeListener.js +4 -11
- package/lib/shared-utils/animationFrame/BetterTween.js +23 -33
- package/lib/shared-utils/animationFrame/index.js +4 -13
- package/lib/shared-utils/animationFrame/tween.js +9 -17
- package/lib/shared-utils/createTransMatrix.js +5 -14
- package/lib/shared-utils/getFileExpandedName.js +1 -7
- package/lib/shared-utils/getMediaInfo.js +8 -19
- package/lib/shared-utils/setElementDataset.js +1 -7
- package/lib/typings/VreoUnit.js +15 -17
- package/package.json +58 -5
- package/stylesheets/custom/SpatialScenePanel.css +7 -7
- package/stylesheets/default.css +1 -1
- package/docs/demo/assets/react-dPVEotm3.css +0 -1
- /package/docs/demo/assets/{react-BLZb_LNZ.js → react-C4h9qndP.js} +0 -0
|
@@ -1,36 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
13
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
-
var _five = require("@realsee/five");
|
|
18
|
-
var _animationFrame = require("../shared-utils/animationFrame");
|
|
19
|
-
var _createHTMLAudioElement = require("./createHTMLAudioElement");
|
|
20
|
-
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2["default"])(t); if (r) { var s = (0, _getPrototypeOf2["default"])(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2["default"])(this, e); }; }
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
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
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
7
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
|
|
21
11
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
|
+
import { Subscribe } from '@realsee/five';
|
|
13
|
+
import { requestAnimationFrameInterval } from "../shared-utils/animationFrame/index.js";
|
|
14
|
+
import { createHTMLAudioElement } from "./createHTMLAudioElement.js";
|
|
22
15
|
var closures = {};
|
|
23
|
-
var PlayController =
|
|
24
|
-
(
|
|
16
|
+
export var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
17
|
+
_inherits(PlayController, _Subscribe);
|
|
25
18
|
var _super = _createSuper(PlayController);
|
|
26
19
|
function PlayController() {
|
|
27
20
|
var _this;
|
|
28
21
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
29
|
-
(
|
|
22
|
+
_classCallCheck(this, PlayController);
|
|
30
23
|
_this = _super.call(this);
|
|
31
|
-
(
|
|
24
|
+
_defineProperty(_assertThisInitialized(_this), "config", {});
|
|
32
25
|
if (!config.audio) {
|
|
33
|
-
config.audio =
|
|
26
|
+
config.audio = createHTMLAudioElement();
|
|
34
27
|
}
|
|
35
28
|
_this.config = Object.assign(_this.config, config);
|
|
36
29
|
closures.onPlaying = function () {
|
|
@@ -45,7 +38,7 @@ var PlayController = exports.PlayController = /*#__PURE__*/function (_Subscribe)
|
|
|
45
38
|
_this.audioInstance.addEventListener('play', closures.onPlaying);
|
|
46
39
|
_this.audioInstance.addEventListener('pause', closures.onPaused);
|
|
47
40
|
_this.audioInstance.addEventListener('ended', closures.onEnded);
|
|
48
|
-
_this.stopInterval =
|
|
41
|
+
_this.stopInterval = requestAnimationFrameInterval(function () {
|
|
49
42
|
if (_this.audioInstance.paused) {
|
|
50
43
|
return;
|
|
51
44
|
}
|
|
@@ -72,7 +65,7 @@ var PlayController = exports.PlayController = /*#__PURE__*/function (_Subscribe)
|
|
|
72
65
|
/**
|
|
73
66
|
* 载入数据
|
|
74
67
|
*/
|
|
75
|
-
(
|
|
68
|
+
_createClass(PlayController, [{
|
|
76
69
|
key: "paused",
|
|
77
70
|
get: function get() {
|
|
78
71
|
return this.audioInstance.paused;
|
|
@@ -112,9 +105,9 @@ var PlayController = exports.PlayController = /*#__PURE__*/function (_Subscribe)
|
|
|
112
105
|
}, {
|
|
113
106
|
key: "load",
|
|
114
107
|
value: (function () {
|
|
115
|
-
var _load = (
|
|
108
|
+
var _load = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(vreoUnit) {
|
|
116
109
|
var _this3 = this;
|
|
117
|
-
return
|
|
110
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
118
111
|
while (1) {
|
|
119
112
|
switch (_context.prev = _context.next) {
|
|
120
113
|
case 0:
|
|
@@ -160,8 +153,8 @@ var PlayController = exports.PlayController = /*#__PURE__*/function (_Subscribe)
|
|
|
160
153
|
}, {
|
|
161
154
|
key: "play",
|
|
162
155
|
value: (function () {
|
|
163
|
-
var _play = (
|
|
164
|
-
return
|
|
156
|
+
var _play = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
157
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
165
158
|
while (1) {
|
|
166
159
|
switch (_context2.prev = _context2.next) {
|
|
167
160
|
case 0:
|
|
@@ -185,8 +178,8 @@ var PlayController = exports.PlayController = /*#__PURE__*/function (_Subscribe)
|
|
|
185
178
|
}, {
|
|
186
179
|
key: "pause",
|
|
187
180
|
value: (function () {
|
|
188
|
-
var _pause = (
|
|
189
|
-
return
|
|
181
|
+
var _pause = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
182
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
190
183
|
while (1) {
|
|
191
184
|
switch (_context3.prev = _context3.next) {
|
|
192
185
|
case 0:
|
|
@@ -230,4 +223,4 @@ var PlayController = exports.PlayController = /*#__PURE__*/function (_Subscribe)
|
|
|
230
223
|
}
|
|
231
224
|
}]);
|
|
232
225
|
return PlayController;
|
|
233
|
-
}(
|
|
226
|
+
}(Subscribe);
|
package/lib/Player/App.js
CHANGED
|
@@ -1,43 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
var _PanoTextLabel = require("./modules/keyframes/PanoTextLabel");
|
|
20
|
-
var _Prompter = require("./modules/keyframes/Prompter");
|
|
21
|
-
var _UpdateVRPanorama = require("./modules/keyframes/UpdateVRPanorama");
|
|
22
|
-
var _VideoEffect = require("./modules/keyframes/VideoEffect");
|
|
23
|
-
var _VideoAgent = require("./modules/VideoAgent");
|
|
24
|
-
var _BgMusic = require("./modules/keyframes/BgMusic");
|
|
25
|
-
var _Wave = require("./modules/Wave");
|
|
26
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) { "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); } return f; })(e, t); }
|
|
27
|
-
var AppView = (0, _mobxReact.observer)(function (_ref) {
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { observer } from 'mobx-react';
|
|
4
|
+
import { useController } from "./hooks.js";
|
|
5
|
+
import { CameraMovement } from "./modules/keyframes/CameraMovement/index.js";
|
|
6
|
+
import { ResizeObserver } from "./modules/ResizeObserver/index.js";
|
|
7
|
+
import { InfoPanel } from "./modules/keyframes/InfoPanel/index.js";
|
|
8
|
+
import { ModelVideo } from "./modules/keyframes/ModelVideo/index.js";
|
|
9
|
+
import { PanoEffect } from "./modules/keyframes/PanoEffect/index.js";
|
|
10
|
+
import { PanoTag } from "./modules/keyframes/PanoTag/index.js";
|
|
11
|
+
import { PanoTextLabel } from "./modules/keyframes/PanoTextLabel/index.js";
|
|
12
|
+
import { Prompter } from "./modules/keyframes/Prompter/index.js";
|
|
13
|
+
import { UpdateVRPanorama } from "./modules/keyframes/UpdateVRPanorama/index.js";
|
|
14
|
+
import { VideoEffect } from "./modules/keyframes/VideoEffect/index.js";
|
|
15
|
+
import { VideoAgent } from "./modules/VideoAgent/index.js";
|
|
16
|
+
import { BgMusic } from "./modules/keyframes/BgMusic/index.js";
|
|
17
|
+
import { Wave } from "./modules/Wave/index.js";
|
|
18
|
+
var AppView = observer(function (_ref) {
|
|
28
19
|
var _controller$configs, _controller$waveAppea, _controller$configs3, _controller$configs4;
|
|
29
20
|
var controller = _ref.controller;
|
|
30
21
|
return /*#__PURE__*/React.createElement("div", {
|
|
31
|
-
className: (
|
|
22
|
+
className: classNames('vreo-panel', {
|
|
32
23
|
'vreo-panel--hidden': !controller.visible
|
|
33
24
|
})
|
|
34
25
|
}, /*#__PURE__*/React.createElement("div", {
|
|
35
26
|
className: "vreo-panel-inner"
|
|
36
|
-
}, /*#__PURE__*/React.createElement(
|
|
27
|
+
}, /*#__PURE__*/React.createElement(Wave, {
|
|
37
28
|
onClick: (_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : _controller$configs.onWaveClick,
|
|
38
29
|
appearance: (_controller$waveAppea = controller.waveAppearance) !== null && _controller$waveAppea !== void 0 ? _controller$waveAppea : 'single',
|
|
39
30
|
staticPrefix: controller.configs.waveStaticPrefix
|
|
40
|
-
}), /*#__PURE__*/React.createElement(
|
|
31
|
+
}), /*#__PURE__*/React.createElement(VideoAgent, {
|
|
41
32
|
onClick: function onClick() {
|
|
42
33
|
var _controller$configs2;
|
|
43
34
|
if ((_controller$configs2 = controller.configs) !== null && _controller$configs2 !== void 0 && _controller$configs2.onAvatarClick) {
|
|
@@ -51,11 +42,11 @@ var AppView = (0, _mobxReact.observer)(function (_ref) {
|
|
|
51
42
|
}
|
|
52
43
|
},
|
|
53
44
|
options: ((_controller$configs3 = controller.configs) === null || _controller$configs3 === void 0 ? void 0 : _controller$configs3.videoAgentMeshOptions) || {}
|
|
54
|
-
}), /*#__PURE__*/React.createElement(
|
|
45
|
+
}), /*#__PURE__*/React.createElement(Prompter, null), (_controller$configs4 = controller.configs) === null || _controller$configs4 === void 0 ? void 0 : _controller$configs4.customPanelChildren));
|
|
55
46
|
});
|
|
56
|
-
function App() {
|
|
57
|
-
var controller =
|
|
58
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
47
|
+
export function App() {
|
|
48
|
+
var controller = useController();
|
|
49
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ResizeObserver, null), /*#__PURE__*/React.createElement(CameraMovement, null), /*#__PURE__*/React.createElement(ModelVideo, null), /*#__PURE__*/React.createElement(UpdateVRPanorama, null), /*#__PURE__*/React.createElement(VideoEffect, null), /*#__PURE__*/React.createElement(PanoTag, null), /*#__PURE__*/React.createElement(PanoTextLabel, null), /*#__PURE__*/React.createElement(InfoPanel, null), /*#__PURE__*/React.createElement(PanoEffect, null), /*#__PURE__*/React.createElement(BgMusic, null)), /*#__PURE__*/React.createElement(AppView, {
|
|
59
50
|
controller: controller
|
|
60
51
|
}));
|
|
61
52
|
}
|
|
@@ -4,7 +4,28 @@ import { VreoKeyframe, VreoKeyframeEnum, VreoKeyframeEvent, VreoUnit, VreoVideo
|
|
|
4
4
|
import { VideoAgentScene } from './modules/VideoAgent/VideoAgentScene';
|
|
5
5
|
import { Appearance, PlayerConfigs, WaveAppearance } from './typings';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Vreo 播放器逻辑控制器
|
|
8
|
+
*
|
|
9
|
+
* 负责管理播放器的内部状态、事件处理、UI 控制和剧本执行。
|
|
10
|
+
* 提供播放控制、外观设置、弹窗管理、抽屉控制等功能。
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const controller = new Controller({
|
|
15
|
+
* five: fiveInstance,
|
|
16
|
+
* container: document.getElementById('container'),
|
|
17
|
+
* configs: playerConfigs
|
|
18
|
+
* })
|
|
19
|
+
*
|
|
20
|
+
* // 设置播放状态
|
|
21
|
+
* controller.setPlaying(true)
|
|
22
|
+
*
|
|
23
|
+
* // 打开弹窗
|
|
24
|
+
* controller.openPopUp('弹窗内容')
|
|
25
|
+
*
|
|
26
|
+
* // 打开抽屉
|
|
27
|
+
* controller.openDrawer({ content: '抽屉内容', height: 300 })
|
|
28
|
+
* ```
|
|
8
29
|
*/
|
|
9
30
|
export declare class Controller extends Subscribe<VreoKeyframeEvent> {
|
|
10
31
|
five: Five;
|
|
@@ -25,39 +46,122 @@ export declare class Controller extends Subscribe<VreoKeyframeEvent> {
|
|
|
25
46
|
appearance: Appearance;
|
|
26
47
|
avatar: VreoVideo['avatar'];
|
|
27
48
|
visible: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* 获取当前播放媒体的类型
|
|
51
|
+
* @returns 'video' | 'avatar' | 'none' - 媒体类型
|
|
52
|
+
*/
|
|
28
53
|
get agentType(): "video" | "none" | "avatar";
|
|
29
54
|
popUp: string | JSX.Element | null;
|
|
55
|
+
/**
|
|
56
|
+
* 打开或关闭弹窗
|
|
57
|
+
* @param popUp - 弹窗内容,可以是字符串、JSX元素或false(关闭弹窗)
|
|
58
|
+
*/
|
|
30
59
|
openPopUp(popUp: string | JSX.Element | false): void;
|
|
60
|
+
/**
|
|
61
|
+
* 设置加载状态
|
|
62
|
+
* @param loading - 加载状态:true(加载中)、false(加载完成)、null(加载失败)
|
|
63
|
+
*/
|
|
31
64
|
setLoading(loading: boolean | null): void;
|
|
32
65
|
drawerConfig: {
|
|
33
66
|
content: string | JSX.Element;
|
|
34
67
|
height?: number | string;
|
|
35
68
|
} | null;
|
|
69
|
+
/**
|
|
70
|
+
* 设置虚拟形象配置
|
|
71
|
+
* @param avatar - 虚拟形象配置对象
|
|
72
|
+
*/
|
|
36
73
|
setAvatar(avatar: VreoVideo['avatar']): void;
|
|
74
|
+
/**
|
|
75
|
+
* 设置容器尺寸
|
|
76
|
+
* @param width - 容器宽度
|
|
77
|
+
* @param height - 容器高度
|
|
78
|
+
*/
|
|
37
79
|
setContainerSize(width: number, height: number): void;
|
|
80
|
+
/**
|
|
81
|
+
* 设置播放器可见性
|
|
82
|
+
* @param v - 是否可见
|
|
83
|
+
*/
|
|
38
84
|
setVisible(v: boolean): void;
|
|
85
|
+
/**
|
|
86
|
+
* 设置播放状态
|
|
87
|
+
* @param playing - 是否正在播放
|
|
88
|
+
*/
|
|
39
89
|
setPlaying(playing: boolean): void;
|
|
90
|
+
/**
|
|
91
|
+
* 设置结束状态
|
|
92
|
+
* @param ended - 是否已结束
|
|
93
|
+
*/
|
|
40
94
|
setEnded(ended: boolean): void;
|
|
95
|
+
/**
|
|
96
|
+
* 设置播放器外观
|
|
97
|
+
* @param appearance - 外观配置对象
|
|
98
|
+
*/
|
|
41
99
|
setAppearance(appearance: Appearance): void;
|
|
100
|
+
/**
|
|
101
|
+
* 打开或关闭抽屉
|
|
102
|
+
* @param drawerConfig - 抽屉配置对象,false表示关闭抽屉
|
|
103
|
+
*/
|
|
42
104
|
openDrawer(drawerConfig?: false | {
|
|
43
105
|
content: string | JSX.Element;
|
|
44
106
|
height?: number | string;
|
|
45
107
|
}): void;
|
|
108
|
+
/**
|
|
109
|
+
* 创建 Controller 实例
|
|
110
|
+
* @param params - 构造参数对象
|
|
111
|
+
* @param params.five - Five 渲染引擎实例
|
|
112
|
+
* @param params.container - DOM 容器元素
|
|
113
|
+
* @param params.configs - 播放器配置
|
|
114
|
+
*/
|
|
46
115
|
constructor({ five, container, configs }: {
|
|
47
116
|
five: Five;
|
|
48
117
|
container: Element;
|
|
49
118
|
configs: PlayerConfigs;
|
|
50
119
|
});
|
|
120
|
+
/**
|
|
121
|
+
* 获取播放器是否准备就绪
|
|
122
|
+
* @returns 是否有可用的视频代理场景
|
|
123
|
+
*/
|
|
51
124
|
get ready(): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* 获取当前播放时间(毫秒)
|
|
127
|
+
* @returns 当前播放时间戳
|
|
128
|
+
*/
|
|
52
129
|
get currentTime(): number;
|
|
130
|
+
/**
|
|
131
|
+
* 获取当前时间点应该触发的关键帧
|
|
132
|
+
* @returns 当前应该执行的关键帧数组
|
|
133
|
+
*/
|
|
53
134
|
get currentKeyframes(): VreoKeyframe[];
|
|
135
|
+
/**
|
|
136
|
+
* 获取当前媒体实例(音频或视频元素)
|
|
137
|
+
* @returns HTML媒体元素实例
|
|
138
|
+
*/
|
|
54
139
|
get mediaInstance(): HTMLVideoElement | HTMLAudioElement | import("../shared-utils/AudioLike").AudioLike | undefined;
|
|
55
140
|
/**
|
|
56
|
-
*
|
|
141
|
+
* 逐帧任务循环处理
|
|
142
|
+
*
|
|
143
|
+
* 在每个动画帧中检查播放状态、处理关键帧触发等
|
|
144
|
+
* @param callback - 关键帧触发时的回调函数
|
|
57
145
|
*/
|
|
58
146
|
requestAnimationFrameLoop(callback: (type: VreoKeyframeEnum, keyframe: VreoKeyframe, currentTime: number) => void): void;
|
|
147
|
+
/**
|
|
148
|
+
* 开始运行播放器逻辑循环
|
|
149
|
+
*
|
|
150
|
+
* 启动帧循环,持续监听并处理关键帧事件
|
|
151
|
+
* @param callback - 关键帧触发时的回调函数
|
|
152
|
+
*/
|
|
59
153
|
run(callback: (type: VreoKeyframeEnum, keyframe: VreoKeyframe) => void): void;
|
|
154
|
+
/**
|
|
155
|
+
* 清理播放器状态
|
|
156
|
+
*
|
|
157
|
+
* 停止播放、重置关键帧状态、清理数据和定时器
|
|
158
|
+
*/
|
|
60
159
|
clear(): void;
|
|
160
|
+
/**
|
|
161
|
+
* 销毁控制器实例
|
|
162
|
+
*
|
|
163
|
+
* 清理所有状态和资源,释放内存
|
|
164
|
+
*/
|
|
61
165
|
dispose(): void;
|
|
62
166
|
}
|
|
63
167
|
declare const ControllerContext: React.Context<Controller | null>;
|