@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
package/lib/Player/index.d.ts
CHANGED
|
@@ -1,18 +1,121 @@
|
|
|
1
1
|
import { Five, Subscribe } from '@realsee/five';
|
|
2
2
|
import { VreoKeyframeEvent, VreoUnit } from '../typings/VreoUnit';
|
|
3
3
|
import { Appearance, PlayerConfigs } from './typings';
|
|
4
|
+
/**
|
|
5
|
+
* Vreo 播放器核心类
|
|
6
|
+
*
|
|
7
|
+
* 提供 VR 视频播放、剧本执行、相机运镜等功能的主要接口。
|
|
8
|
+
* 基于 Five 渲染引擎和 React 构建的 3D 空间剧本播放器。
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { Five } from '@realsee/five'
|
|
13
|
+
* import { Player } from '@realsee/vreo'
|
|
14
|
+
*
|
|
15
|
+
* const five = new Five({
|
|
16
|
+
* // Five 配置选项
|
|
17
|
+
* })
|
|
18
|
+
* const player = new Player(five, {
|
|
19
|
+
* autoPreload: true,
|
|
20
|
+
* imageOptions: { size: 1024 }
|
|
21
|
+
* })
|
|
22
|
+
*
|
|
23
|
+
* await player.load(vreoUnit)
|
|
24
|
+
* player.play()
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
4
27
|
export declare class Player extends Subscribe<VreoKeyframeEvent> {
|
|
28
|
+
/** Five 渲染引擎实例 */
|
|
5
29
|
$five: Five;
|
|
30
|
+
/** 内部控制器 */
|
|
6
31
|
private controller;
|
|
32
|
+
/** 播放器配置(只读) */
|
|
7
33
|
configs: Readonly<PlayerConfigs>;
|
|
34
|
+
/**
|
|
35
|
+
* 创建 Vreo 播放器实例
|
|
36
|
+
*
|
|
37
|
+
* @param five - Five 渲染引擎实例
|
|
38
|
+
* @param configs - 播放器配置选项
|
|
39
|
+
*/
|
|
8
40
|
constructor(five: Five, configs?: Partial<PlayerConfigs>);
|
|
41
|
+
/**
|
|
42
|
+
* 加载剧本数据
|
|
43
|
+
*
|
|
44
|
+
* 加载 VreoUnit 剧本数据,准备播放器状态,预载资源,并初始化播放环境。
|
|
45
|
+
*
|
|
46
|
+
* @param vreoUnit - 剧本数据对象,包含视频信息和关键帧序列
|
|
47
|
+
* @param currentTime - 起始播放时间(毫秒),默认为 0
|
|
48
|
+
* @param preload - 是否预载相关资源,默认为 false
|
|
49
|
+
* @param force - 是否强制重新载入(深拷贝数据),默认为 false
|
|
50
|
+
* @returns Promise<boolean> 返回加载是否成功
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* // 基本加载
|
|
55
|
+
* await player.load(vreoUnit)
|
|
56
|
+
*
|
|
57
|
+
* // 从指定时间开始加载,并预载资源
|
|
58
|
+
* await player.load(vreoUnit, 5000, true)
|
|
59
|
+
*
|
|
60
|
+
* // 强制重新加载
|
|
61
|
+
* await player.load(vreoUnit, 0, false, true)
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
9
64
|
load(vreoUnit: VreoUnit, currentTime?: number, preload?: boolean, force?: boolean): Promise<boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* 获取播放器是否处于暂停状态
|
|
67
|
+
* @returns 是否暂停中
|
|
68
|
+
*/
|
|
10
69
|
get paused(): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* 开始播放
|
|
72
|
+
*
|
|
73
|
+
* @param currentTime - 可选的播放起始时间(毫秒)
|
|
74
|
+
* @returns 是否开始播放成功
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* // 从当前位置播放
|
|
79
|
+
* player.play()
|
|
80
|
+
*
|
|
81
|
+
* // 从指定时间开始播放
|
|
82
|
+
* player.play(10000) // 从10秒处开始
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
11
85
|
play(currentTime?: number): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* 设置播放器外观
|
|
88
|
+
* @param appearance - 外观配置对象
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* player.setAppearance({
|
|
93
|
+
* waveStyle: 'solid'
|
|
94
|
+
* })
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
12
97
|
setAppearance(appearance: Appearance): void;
|
|
98
|
+
/**
|
|
99
|
+
* 暂停播放
|
|
100
|
+
*/
|
|
13
101
|
pause(): void;
|
|
102
|
+
/**
|
|
103
|
+
* 显示播放器界面
|
|
104
|
+
*/
|
|
14
105
|
show(): void;
|
|
106
|
+
/**
|
|
107
|
+
* 隐藏播放器界面
|
|
108
|
+
*/
|
|
15
109
|
hide(): void;
|
|
110
|
+
/**
|
|
111
|
+
* 获取当前播放时间
|
|
112
|
+
* @returns 当前播放时间(毫秒)
|
|
113
|
+
*/
|
|
16
114
|
getCurrentTime(): number;
|
|
115
|
+
/**
|
|
116
|
+
* 销毁播放器实例
|
|
117
|
+
*
|
|
118
|
+
* 清理所有资源、事件监听器和DOM元素
|
|
119
|
+
*/
|
|
17
120
|
dispose(): void;
|
|
18
121
|
}
|
package/lib/Player/index.js
CHANGED
|
@@ -1,45 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
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 React = _interopRequireWildcard(require("react"));
|
|
17
|
-
var ReactDOM = _interopRequireWildcard(require("react-dom"));
|
|
18
|
-
var _five = require("@realsee/five");
|
|
19
|
-
var _App = require("./App");
|
|
20
|
-
var _Controller = require("./Controller");
|
|
21
|
-
var _VreoUnit = require("../typings/VreoUnit");
|
|
22
|
-
var _mobx = require("mobx");
|
|
23
|
-
var _Drawer = require("./modules/Drawer");
|
|
24
|
-
var _PopUp = require("./modules/PopUp");
|
|
25
|
-
var _Audio = require("../shared-utils/Audio");
|
|
26
|
-
var _location$search$matc, _location$search$matc2; // 下面这一行不能删
|
|
27
|
-
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); }
|
|
28
|
-
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 _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
7
|
+
var _location$search$matc, _location$search$matc2;
|
|
8
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
|
+
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); }; }
|
|
29
10
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
|
+
// 下面这一行不能删
|
|
12
|
+
import * as React from 'react';
|
|
13
|
+
import * as ReactDOM from 'react-dom';
|
|
14
|
+
import { Subscribe } from '@realsee/five';
|
|
15
|
+
import { App } from "./App.js";
|
|
16
|
+
import { Controller, ControllerContext } from "./Controller.js";
|
|
17
|
+
import { VreoKeyframeEnum } from "../typings/VreoUnit.js";
|
|
18
|
+
import { reaction } from 'mobx';
|
|
19
|
+
import { Drawer } from "./modules/Drawer/index.js";
|
|
20
|
+
import { PopUp } from "./modules/PopUp/index.js";
|
|
21
|
+
import { generateBlankAudio, waitForBlankAudioGenerated } from "../shared-utils/Audio.js";
|
|
30
22
|
var DefaultAudioCacheLength = 3;
|
|
31
23
|
var id = "vreo-app-dhjskadhksahdjskahdjksa";
|
|
32
24
|
var audioCacheLength = Number((_location$search$matc = (_location$search$matc2 = location.search.match(/audio_cache=(\d+)/)) === null || _location$search$matc2 === void 0 ? void 0 : _location$search$matc2[1]) !== null && _location$search$matc !== void 0 ? _location$search$matc : DefaultAudioCacheLength);
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Vreo 播放器核心类
|
|
28
|
+
*
|
|
29
|
+
* 提供 VR 视频播放、剧本执行、相机运镜等功能的主要接口。
|
|
30
|
+
* 基于 Five 渲染引擎和 React 构建的 3D 空间剧本播放器。
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* import { Five } from '@realsee/five'
|
|
35
|
+
* import { Player } from '@realsee/vreo'
|
|
36
|
+
*
|
|
37
|
+
* const five = new Five({
|
|
38
|
+
* // Five 配置选项
|
|
39
|
+
* })
|
|
40
|
+
* const player = new Player(five, {
|
|
41
|
+
* autoPreload: true,
|
|
42
|
+
* imageOptions: { size: 1024 }
|
|
43
|
+
* })
|
|
44
|
+
*
|
|
45
|
+
* await player.load(vreoUnit)
|
|
46
|
+
* player.play()
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
50
|
+
_inherits(Player, _Subscribe);
|
|
35
51
|
var _super = _createSuper(Player);
|
|
52
|
+
/** Five 渲染引擎实例 */
|
|
53
|
+
|
|
54
|
+
/** 内部控制器 */
|
|
55
|
+
|
|
56
|
+
/** 播放器配置(只读) */
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 创建 Vreo 播放器实例
|
|
60
|
+
*
|
|
61
|
+
* @param five - Five 渲染引擎实例
|
|
62
|
+
* @param configs - 播放器配置选项
|
|
63
|
+
*/
|
|
36
64
|
function Player(five) {
|
|
37
65
|
var _this;
|
|
38
66
|
var configs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
39
|
-
(
|
|
67
|
+
_classCallCheck(this, Player);
|
|
40
68
|
_this = _super.call(this);
|
|
41
69
|
_this.$five = five;
|
|
42
|
-
|
|
70
|
+
generateBlankAudio(audioCacheLength);
|
|
43
71
|
if (!configs.container) {
|
|
44
72
|
configs.container = configs.containter;
|
|
45
73
|
}
|
|
@@ -64,14 +92,14 @@ var Player = exports.Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
64
92
|
_this.configs = Object.freeze(Object.assign({
|
|
65
93
|
keyframeMap: {}
|
|
66
94
|
}, configs));
|
|
67
|
-
_this.controller = new
|
|
95
|
+
_this.controller = new Controller({
|
|
68
96
|
five: five,
|
|
69
97
|
container: configs.container,
|
|
70
98
|
configs: _this.configs
|
|
71
99
|
});
|
|
72
|
-
ReactDOM.render(/*#__PURE__*/React.createElement(
|
|
100
|
+
ReactDOM.render(/*#__PURE__*/React.createElement(ControllerContext.Provider, {
|
|
73
101
|
value: _this.controller
|
|
74
|
-
}, /*#__PURE__*/React.createElement(
|
|
102
|
+
}, /*#__PURE__*/React.createElement(App, null), /*#__PURE__*/React.createElement(Drawer, null), /*#__PURE__*/React.createElement(PopUp, null), _this.configs.customKeyframes && _this.configs.customKeyframes.map(function (CustomCmpt, key) {
|
|
75
103
|
return /*#__PURE__*/React.createElement(CustomCmpt, {
|
|
76
104
|
key: key,
|
|
77
105
|
subscribe: {
|
|
@@ -90,14 +118,14 @@ var Player = exports.Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
90
118
|
})), configs.container);
|
|
91
119
|
|
|
92
120
|
// 监听播放情况:抛出触发时机
|
|
93
|
-
|
|
121
|
+
reaction(function () {
|
|
94
122
|
return _this.controller.ended;
|
|
95
123
|
}, function (ended) {
|
|
96
124
|
if (ended) {
|
|
97
125
|
_this.emit('paused', true);
|
|
98
126
|
}
|
|
99
127
|
});
|
|
100
|
-
|
|
128
|
+
reaction(function () {
|
|
101
129
|
return _this.controller.playing;
|
|
102
130
|
}, function (playing) {
|
|
103
131
|
if (!_this.controller.ended) {
|
|
@@ -106,10 +134,34 @@ var Player = exports.Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
106
134
|
});
|
|
107
135
|
return _this;
|
|
108
136
|
}
|
|
109
|
-
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* 加载剧本数据
|
|
140
|
+
*
|
|
141
|
+
* 加载 VreoUnit 剧本数据,准备播放器状态,预载资源,并初始化播放环境。
|
|
142
|
+
*
|
|
143
|
+
* @param vreoUnit - 剧本数据对象,包含视频信息和关键帧序列
|
|
144
|
+
* @param currentTime - 起始播放时间(毫秒),默认为 0
|
|
145
|
+
* @param preload - 是否预载相关资源,默认为 false
|
|
146
|
+
* @param force - 是否强制重新载入(深拷贝数据),默认为 false
|
|
147
|
+
* @returns Promise<boolean> 返回加载是否成功
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* // 基本加载
|
|
152
|
+
* await player.load(vreoUnit)
|
|
153
|
+
*
|
|
154
|
+
* // 从指定时间开始加载,并预载资源
|
|
155
|
+
* await player.load(vreoUnit, 5000, true)
|
|
156
|
+
*
|
|
157
|
+
* // 强制重新加载
|
|
158
|
+
* await player.load(vreoUnit, 0, false, true)
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
_createClass(Player, [{
|
|
110
162
|
key: "load",
|
|
111
|
-
value: function () {
|
|
112
|
-
var _load = (
|
|
163
|
+
value: (function () {
|
|
164
|
+
var _load = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(vreoUnit) {
|
|
113
165
|
var _this$controller$medi,
|
|
114
166
|
_this$configs$imageOp,
|
|
115
167
|
_this$controller$vide,
|
|
@@ -122,7 +174,7 @@ var Player = exports.Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
122
174
|
panoIndexes,
|
|
123
175
|
i,
|
|
124
176
|
_args = arguments;
|
|
125
|
-
return
|
|
177
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
126
178
|
while (1) {
|
|
127
179
|
switch (_context.prev = _context.next) {
|
|
128
180
|
case 0:
|
|
@@ -161,7 +213,7 @@ var Player = exports.Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
161
213
|
break;
|
|
162
214
|
}
|
|
163
215
|
panoIndexMap = vreoUnit.keyframes.filter(function (vreoKeyframe) {
|
|
164
|
-
if (vreoKeyframe.type !==
|
|
216
|
+
if (vreoKeyframe.type !== VreoKeyframeEnum.CameraMovement) {
|
|
165
217
|
return false;
|
|
166
218
|
}
|
|
167
219
|
var data = vreoKeyframe.data;
|
|
@@ -198,7 +250,7 @@ var Player = exports.Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
198
250
|
}
|
|
199
251
|
this.controller.setAvatar(vreoUnit.video.avatar);
|
|
200
252
|
_context.next = 26;
|
|
201
|
-
return
|
|
253
|
+
return waitForBlankAudioGenerated();
|
|
202
254
|
case 26:
|
|
203
255
|
_context.next = 28;
|
|
204
256
|
return (_this$controller$vide2 = this.controller.videoAgentScene) === null || _this$controller$vide2 === void 0 ? void 0 : _this$controller$vide2.videoAgentMesh.play(vreoUnit.video.url, currentTime / 1000, vreoUnit.video.duration);
|
|
@@ -222,11 +274,32 @@ var Player = exports.Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
222
274
|
}
|
|
223
275
|
return load;
|
|
224
276
|
}()
|
|
277
|
+
/**
|
|
278
|
+
* 获取播放器是否处于暂停状态
|
|
279
|
+
* @returns 是否暂停中
|
|
280
|
+
*/
|
|
281
|
+
)
|
|
225
282
|
}, {
|
|
226
283
|
key: "paused",
|
|
227
284
|
get: function get() {
|
|
228
285
|
return !this.controller.playing;
|
|
229
286
|
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* 开始播放
|
|
290
|
+
*
|
|
291
|
+
* @param currentTime - 可选的播放起始时间(毫秒)
|
|
292
|
+
* @returns 是否开始播放成功
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```typescript
|
|
296
|
+
* // 从当前位置播放
|
|
297
|
+
* player.play()
|
|
298
|
+
*
|
|
299
|
+
* // 从指定时间开始播放
|
|
300
|
+
* player.play(10000) // 从10秒处开始
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
230
303
|
}, {
|
|
231
304
|
key: "play",
|
|
232
305
|
value: function play(currentTime) {
|
|
@@ -241,37 +314,72 @@ var Player = exports.Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
241
314
|
this.controller.setEnded(false);
|
|
242
315
|
this.controller.setPlaying(true);
|
|
243
316
|
(_this$controller$vreo = this.controller.vreoUnit) === null || _this$controller$vreo === void 0 ? void 0 : _this$controller$vreo.keyframes.forEach(function (keyframe) {
|
|
244
|
-
if (keyframe.type ===
|
|
317
|
+
if (keyframe.type === VreoKeyframeEnum.BgMusic) {
|
|
245
318
|
keyframe.parsed = false;
|
|
246
319
|
}
|
|
247
320
|
});
|
|
248
321
|
return true;
|
|
249
322
|
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* 设置播放器外观
|
|
326
|
+
* @param appearance - 外观配置对象
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* ```typescript
|
|
330
|
+
* player.setAppearance({
|
|
331
|
+
* waveStyle: 'solid'
|
|
332
|
+
* })
|
|
333
|
+
* ```
|
|
334
|
+
*/
|
|
250
335
|
}, {
|
|
251
336
|
key: "setAppearance",
|
|
252
337
|
value: function setAppearance(appearance) {
|
|
253
338
|
this.controller.setAppearance(appearance);
|
|
254
339
|
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* 暂停播放
|
|
343
|
+
*/
|
|
255
344
|
}, {
|
|
256
345
|
key: "pause",
|
|
257
346
|
value: function pause() {
|
|
258
347
|
this.controller.setPlaying(false);
|
|
259
348
|
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* 显示播放器界面
|
|
352
|
+
*/
|
|
260
353
|
}, {
|
|
261
354
|
key: "show",
|
|
262
355
|
value: function show() {
|
|
263
356
|
this.controller.setVisible(true);
|
|
264
357
|
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* 隐藏播放器界面
|
|
361
|
+
*/
|
|
265
362
|
}, {
|
|
266
363
|
key: "hide",
|
|
267
364
|
value: function hide() {
|
|
268
365
|
this.controller.setVisible(false);
|
|
269
366
|
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* 获取当前播放时间
|
|
370
|
+
* @returns 当前播放时间(毫秒)
|
|
371
|
+
*/
|
|
270
372
|
}, {
|
|
271
373
|
key: "getCurrentTime",
|
|
272
374
|
value: function getCurrentTime() {
|
|
273
375
|
return this.controller.currentTime;
|
|
274
376
|
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* 销毁播放器实例
|
|
380
|
+
*
|
|
381
|
+
* 清理所有资源、事件监听器和DOM元素
|
|
382
|
+
*/
|
|
275
383
|
}, {
|
|
276
384
|
key: "dispose",
|
|
277
385
|
value: function dispose() {
|
|
@@ -282,5 +390,5 @@ var Player = exports.Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
282
390
|
}
|
|
283
391
|
}]);
|
|
284
392
|
return Player;
|
|
285
|
-
}(
|
|
393
|
+
}(Subscribe);
|
|
286
394
|
console.log("\n \u250F\u2501\u2501\u2501\u2513\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u250F\u2513\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n \u2503\u250F\u2501\u2513\u2503\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2503\u2503\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n \u2503\u2517\u2501\u251B\u2503\u250F\u2501\u2501\u2513\u250F\u2501\u2501\u2513\u2501\u2503\u2503\u2501\u250F\u2501\u2501\u2513\u250F\u2501\u2501\u2513\u250F\u2501\u2501\u2513\n \u2503\u250F\u2513\u250F\u251B\u2503\u250F\u2513\u2503\u2517\u2501\u2513\u2503\u2501\u2503\u2503\u2501\u2503\u2501\u2501\u252B\u2503\u250F\u2513\u2503\u2503\u250F\u2513\u2503\n \u2503\u2503\u2503\u2517\u2513\u2503\u2503\u2501\u252B\u2503\u2517\u251B\u2517\u2513\u2503\u2517\u2513\u2523\u2501\u2501\u2503\u2503\u2503\u2501\u252B\u2503\u2503\u2501\u252B\n \u2517\u251B\u2517\u2501\u251B\u2517\u2501\u2501\u251B\u2517\u2501\u2501\u2501\u251B\u2517\u2501\u251B\u2517\u2501\u2501\u251B\u2517\u2501\u2501\u251B\u2517\u2501\u2501\u251B\n \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n");
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.Drawer = Drawer;
|
|
9
|
-
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var _mobxReact = require("mobx-react");
|
|
12
|
-
var _hooks = require("../../hooks");
|
|
13
|
-
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); }
|
|
14
|
-
var DrawerView = (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
|
+
var DrawerView = observer(function (_ref) {
|
|
15
6
|
var _controller$drawerCon2;
|
|
16
7
|
var controller = _ref.controller;
|
|
17
8
|
var maxHeight = '400px';
|
|
@@ -26,7 +17,7 @@ var DrawerView = (0, _mobxReact.observer)(function (_ref) {
|
|
|
26
17
|
return height;
|
|
27
18
|
}();
|
|
28
19
|
return /*#__PURE__*/React.createElement("div", {
|
|
29
|
-
className: (
|
|
20
|
+
className: classNames('vreo-drawer', {
|
|
30
21
|
'vreo-drawer-visible': controller.drawerConfig && controller.drawerConfig.content
|
|
31
22
|
}),
|
|
32
23
|
onClick: function onClick() {
|
|
@@ -40,8 +31,8 @@ var DrawerView = (0, _mobxReact.observer)(function (_ref) {
|
|
|
40
31
|
}
|
|
41
32
|
}, ((_controller$drawerCon2 = controller.drawerConfig) === null || _controller$drawerCon2 === void 0 ? void 0 : _controller$drawerCon2.content) || ''));
|
|
42
33
|
});
|
|
43
|
-
function Drawer() {
|
|
44
|
-
var controller =
|
|
34
|
+
export function Drawer() {
|
|
35
|
+
var controller = useController();
|
|
45
36
|
return /*#__PURE__*/React.createElement(DrawerView, {
|
|
46
37
|
controller: controller
|
|
47
38
|
});
|
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.PopUp = PopUp;
|
|
9
|
-
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var _mobxReact = require("mobx-react");
|
|
12
|
-
var _hooks = require("../../hooks");
|
|
13
|
-
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); }
|
|
14
|
-
var PopUpView = (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
|
+
var PopUpView = observer(function (_ref) {
|
|
15
6
|
var controller = _ref.controller;
|
|
16
7
|
return /*#__PURE__*/React.createElement("div", {
|
|
17
|
-
className: (
|
|
8
|
+
className: classNames('vreo-PopUp', {
|
|
18
9
|
'vreo-PopUp-visible': controller.popUp
|
|
19
10
|
}),
|
|
20
11
|
onClick: function onClick() {
|
|
@@ -24,8 +15,8 @@ var PopUpView = (0, _mobxReact.observer)(function (_ref) {
|
|
|
24
15
|
className: "vreo-PopUp-inner"
|
|
25
16
|
}, controller.popUp || ''));
|
|
26
17
|
});
|
|
27
|
-
function PopUp() {
|
|
28
|
-
var controller =
|
|
18
|
+
export function PopUp() {
|
|
19
|
+
var controller = useController();
|
|
29
20
|
return /*#__PURE__*/React.createElement(PopUpView, {
|
|
30
21
|
controller: controller
|
|
31
22
|
});
|
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _addResizeListener = require("../../../shared-utils/addResizeListener");
|
|
10
|
-
var _hooks = require("../../hooks");
|
|
11
|
-
function ResizeObserver() {
|
|
12
|
-
var ref = _react["default"].useRef(null);
|
|
13
|
-
var controller = (0, _hooks.useController)();
|
|
14
|
-
_react["default"].useEffect(function () {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { addResizeListener, hasResizeListener } from "../../../shared-utils/addResizeListener.js";
|
|
3
|
+
import { useController } from "../../hooks.js";
|
|
4
|
+
export function ResizeObserver() {
|
|
5
|
+
var ref = React.useRef(null);
|
|
6
|
+
var controller = useController();
|
|
7
|
+
React.useEffect(function () {
|
|
15
8
|
if (!ref.current) return;
|
|
16
9
|
var resizeElement = controller.container.parentElement;
|
|
17
|
-
if (
|
|
18
|
-
var dispose =
|
|
10
|
+
if (hasResizeListener(resizeElement)) return;
|
|
11
|
+
var dispose = addResizeListener(resizeElement, function (width, height) {
|
|
19
12
|
controller.setContainerSize(width, height);
|
|
20
13
|
});
|
|
21
14
|
return function () {
|
|
22
15
|
dispose();
|
|
23
16
|
};
|
|
24
17
|
}, []);
|
|
25
|
-
return /*#__PURE__*/
|
|
18
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
26
19
|
className: "resizeObserver-element",
|
|
27
20
|
ref: ref
|
|
28
21
|
});
|