@realsee/vreo 2.4.7 → 2.5.0
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/Player/Controller.d.ts +106 -2
- package/lib/Player/Controller.js +124 -4
- package/lib/Player/index.d.ts +103 -0
- package/lib/Player/index.js +117 -1
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +108 -7
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +124 -11
- package/lib/Player/modules/keyframes/VideoEffect/index.js +1 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/index.d.ts +6 -12
- package/lib/react/index.d.ts +111 -0
- package/lib/react/index.js +136 -0
- package/package.json +1 -1
- 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
|
@@ -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>;
|
package/lib/Player/Controller.js
CHANGED
|
@@ -27,11 +27,39 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
27
27
|
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); }; }
|
|
28
28
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* Vreo 播放器逻辑控制器
|
|
31
|
+
*
|
|
32
|
+
* 负责管理播放器的内部状态、事件处理、UI 控制和剧本执行。
|
|
33
|
+
* 提供播放控制、外观设置、弹窗管理、抽屉控制等功能。
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const controller = new Controller({
|
|
38
|
+
* five: fiveInstance,
|
|
39
|
+
* container: document.getElementById('container'),
|
|
40
|
+
* configs: playerConfigs
|
|
41
|
+
* })
|
|
42
|
+
*
|
|
43
|
+
* // 设置播放状态
|
|
44
|
+
* controller.setPlaying(true)
|
|
45
|
+
*
|
|
46
|
+
* // 打开弹窗
|
|
47
|
+
* controller.openPopUp('弹窗内容')
|
|
48
|
+
*
|
|
49
|
+
* // 打开抽屉
|
|
50
|
+
* controller.openDrawer({ content: '抽屉内容', height: 300 })
|
|
51
|
+
* ```
|
|
31
52
|
*/
|
|
32
53
|
var Controller = exports.Controller = /*#__PURE__*/function (_Subscribe) {
|
|
33
54
|
(0, _inherits2["default"])(Controller, _Subscribe);
|
|
34
55
|
var _super = _createSuper(Controller);
|
|
56
|
+
/**
|
|
57
|
+
* 创建 Controller 实例
|
|
58
|
+
* @param params - 构造参数对象
|
|
59
|
+
* @param params.five - Five 渲染引擎实例
|
|
60
|
+
* @param params.container - DOM 容器元素
|
|
61
|
+
* @param params.configs - 播放器配置
|
|
62
|
+
*/
|
|
35
63
|
function Controller(_ref) {
|
|
36
64
|
var _this;
|
|
37
65
|
var five = _ref.five,
|
|
@@ -163,11 +191,20 @@ var Controller = exports.Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
163
191
|
});
|
|
164
192
|
return _this;
|
|
165
193
|
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* 获取播放器是否准备就绪
|
|
197
|
+
* @returns 是否有可用的视频代理场景
|
|
198
|
+
*/
|
|
166
199
|
(0, _createClass2["default"])(Controller, [{
|
|
167
200
|
key: "agentType",
|
|
168
201
|
get:
|
|
169
202
|
// null 表示加载失败
|
|
170
203
|
|
|
204
|
+
/**
|
|
205
|
+
* 获取当前播放媒体的类型
|
|
206
|
+
* @returns 'video' | 'avatar' | 'none' - 媒体类型
|
|
207
|
+
*/
|
|
171
208
|
function get() {
|
|
172
209
|
var _this$videoAgentScene, _this$avatar;
|
|
173
210
|
var type = (0, _getMediaInfo.getMediaType)((_this$videoAgentScene = this.videoAgentScene) === null || _this$videoAgentScene === void 0 ? void 0 : _this$videoAgentScene.videoAgentMesh.videoUrl);
|
|
@@ -177,13 +214,23 @@ var Controller = exports.Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
177
214
|
}
|
|
178
215
|
}, {
|
|
179
216
|
key: "openPopUp",
|
|
180
|
-
value:
|
|
217
|
+
value:
|
|
218
|
+
/**
|
|
219
|
+
* 打开或关闭弹窗
|
|
220
|
+
* @param popUp - 弹窗内容,可以是字符串、JSX元素或false(关闭弹窗)
|
|
221
|
+
*/
|
|
222
|
+
function openPopUp(popUp) {
|
|
181
223
|
if (!popUp) {
|
|
182
224
|
this.popUp = null;
|
|
183
225
|
return;
|
|
184
226
|
}
|
|
185
227
|
this.popUp = popUp;
|
|
186
228
|
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* 设置加载状态
|
|
232
|
+
* @param loading - 加载状态:true(加载中)、false(加载完成)、null(加载失败)
|
|
233
|
+
*/
|
|
187
234
|
}, {
|
|
188
235
|
key: "setLoading",
|
|
189
236
|
value: function setLoading(loading) {
|
|
@@ -191,9 +238,20 @@ var Controller = exports.Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
191
238
|
}
|
|
192
239
|
}, {
|
|
193
240
|
key: "setAvatar",
|
|
194
|
-
value:
|
|
241
|
+
value:
|
|
242
|
+
/**
|
|
243
|
+
* 设置虚拟形象配置
|
|
244
|
+
* @param avatar - 虚拟形象配置对象
|
|
245
|
+
*/
|
|
246
|
+
function setAvatar(avatar) {
|
|
195
247
|
this.avatar = avatar;
|
|
196
248
|
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* 设置容器尺寸
|
|
252
|
+
* @param width - 容器宽度
|
|
253
|
+
* @param height - 容器高度
|
|
254
|
+
*/
|
|
197
255
|
}, {
|
|
198
256
|
key: "setContainerSize",
|
|
199
257
|
value: function setContainerSize(width, height) {
|
|
@@ -202,26 +260,51 @@ var Controller = exports.Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
202
260
|
height: height
|
|
203
261
|
};
|
|
204
262
|
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* 设置播放器可见性
|
|
266
|
+
* @param v - 是否可见
|
|
267
|
+
*/
|
|
205
268
|
}, {
|
|
206
269
|
key: "setVisible",
|
|
207
270
|
value: function setVisible(v) {
|
|
208
271
|
this.visible = v;
|
|
209
272
|
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* 设置播放状态
|
|
276
|
+
* @param playing - 是否正在播放
|
|
277
|
+
*/
|
|
210
278
|
}, {
|
|
211
279
|
key: "setPlaying",
|
|
212
280
|
value: function setPlaying(playing) {
|
|
213
281
|
this.playing = playing;
|
|
214
282
|
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* 设置结束状态
|
|
286
|
+
* @param ended - 是否已结束
|
|
287
|
+
*/
|
|
215
288
|
}, {
|
|
216
289
|
key: "setEnded",
|
|
217
290
|
value: function setEnded(ended) {
|
|
218
291
|
this.ended = ended;
|
|
219
292
|
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* 设置播放器外观
|
|
296
|
+
* @param appearance - 外观配置对象
|
|
297
|
+
*/
|
|
220
298
|
}, {
|
|
221
299
|
key: "setAppearance",
|
|
222
300
|
value: function setAppearance(appearance) {
|
|
223
301
|
this.appearance = _objectSpread(_objectSpread({}, this.appearance), appearance);
|
|
224
302
|
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* 打开或关闭抽屉
|
|
306
|
+
* @param drawerConfig - 抽屉配置对象,false表示关闭抽屉
|
|
307
|
+
*/
|
|
225
308
|
}, {
|
|
226
309
|
key: "openDrawer",
|
|
227
310
|
value: function openDrawer(drawerConfig) {
|
|
@@ -240,12 +323,22 @@ var Controller = exports.Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
240
323
|
get: function get() {
|
|
241
324
|
return !!this.videoAgentScene;
|
|
242
325
|
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* 获取当前播放时间(毫秒)
|
|
329
|
+
* @returns 当前播放时间戳
|
|
330
|
+
*/
|
|
243
331
|
}, {
|
|
244
332
|
key: "currentTime",
|
|
245
333
|
get: function get() {
|
|
246
334
|
var _this$videoAgentScene2;
|
|
247
335
|
return ((_this$videoAgentScene2 = this.videoAgentScene) === null || _this$videoAgentScene2 === void 0 ? void 0 : _this$videoAgentScene2.videoAgentMesh.currentTime) || 0;
|
|
248
336
|
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* 获取当前时间点应该触发的关键帧
|
|
340
|
+
* @returns 当前应该执行的关键帧数组
|
|
341
|
+
*/
|
|
249
342
|
}, {
|
|
250
343
|
key: "currentKeyframes",
|
|
251
344
|
get: function get() {
|
|
@@ -265,6 +358,11 @@ var Controller = exports.Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
265
358
|
return dur <= 100 && dur >= 0;
|
|
266
359
|
});
|
|
267
360
|
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* 获取当前媒体实例(音频或视频元素)
|
|
364
|
+
* @returns HTML媒体元素实例
|
|
365
|
+
*/
|
|
268
366
|
}, {
|
|
269
367
|
key: "mediaInstance",
|
|
270
368
|
get: function get() {
|
|
@@ -273,7 +371,10 @@ var Controller = exports.Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
273
371
|
}
|
|
274
372
|
|
|
275
373
|
/**
|
|
276
|
-
*
|
|
374
|
+
* 逐帧任务循环处理
|
|
375
|
+
*
|
|
376
|
+
* 在每个动画帧中检查播放状态、处理关键帧触发等
|
|
377
|
+
* @param callback - 关键帧触发时的回调函数
|
|
277
378
|
*/
|
|
278
379
|
}, {
|
|
279
380
|
key: "requestAnimationFrameLoop",
|
|
@@ -314,6 +415,13 @@ var Controller = exports.Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
314
415
|
}
|
|
315
416
|
});
|
|
316
417
|
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* 开始运行播放器逻辑循环
|
|
421
|
+
*
|
|
422
|
+
* 启动帧循环,持续监听并处理关键帧事件
|
|
423
|
+
* @param callback - 关键帧触发时的回调函数
|
|
424
|
+
*/
|
|
317
425
|
}, {
|
|
318
426
|
key: "run",
|
|
319
427
|
value: function run(callback) {
|
|
@@ -323,6 +431,12 @@ var Controller = exports.Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
323
431
|
return _this4.requestAnimationFrameLoop(callback);
|
|
324
432
|
});
|
|
325
433
|
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* 清理播放器状态
|
|
437
|
+
*
|
|
438
|
+
* 停止播放、重置关键帧状态、清理数据和定时器
|
|
439
|
+
*/
|
|
326
440
|
}, {
|
|
327
441
|
key: "clear",
|
|
328
442
|
value: function clear() {
|
|
@@ -343,6 +457,12 @@ var Controller = exports.Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
343
457
|
(_this$stopInterval = this.stopInterval) === null || _this$stopInterval === void 0 ? void 0 : _this$stopInterval.call(this);
|
|
344
458
|
this.stopInterval = undefined;
|
|
345
459
|
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* 销毁控制器实例
|
|
463
|
+
*
|
|
464
|
+
* 清理所有状态和资源,释放内存
|
|
465
|
+
*/
|
|
346
466
|
}, {
|
|
347
467
|
key: "dispose",
|
|
348
468
|
value: function dispose() {
|
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
|
@@ -30,9 +30,45 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
30
30
|
var DefaultAudioCacheLength = 3;
|
|
31
31
|
var id = "vreo-app-dhjskadhksahdjskahdjksa";
|
|
32
32
|
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
|
+
/**
|
|
35
|
+
* Vreo 播放器核心类
|
|
36
|
+
*
|
|
37
|
+
* 提供 VR 视频播放、剧本执行、相机运镜等功能的主要接口。
|
|
38
|
+
* 基于 Five 渲染引擎和 React 构建的 3D 空间剧本播放器。
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* import { Five } from '@realsee/five'
|
|
43
|
+
* import { Player } from '@realsee/vreo'
|
|
44
|
+
*
|
|
45
|
+
* const five = new Five({
|
|
46
|
+
* // Five 配置选项
|
|
47
|
+
* })
|
|
48
|
+
* const player = new Player(five, {
|
|
49
|
+
* autoPreload: true,
|
|
50
|
+
* imageOptions: { size: 1024 }
|
|
51
|
+
* })
|
|
52
|
+
*
|
|
53
|
+
* await player.load(vreoUnit)
|
|
54
|
+
* player.play()
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
33
57
|
var Player = exports.Player = /*#__PURE__*/function (_Subscribe) {
|
|
34
58
|
(0, _inherits2["default"])(Player, _Subscribe);
|
|
35
59
|
var _super = _createSuper(Player);
|
|
60
|
+
/** Five 渲染引擎实例 */
|
|
61
|
+
|
|
62
|
+
/** 内部控制器 */
|
|
63
|
+
|
|
64
|
+
/** 播放器配置(只读) */
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 创建 Vreo 播放器实例
|
|
68
|
+
*
|
|
69
|
+
* @param five - Five 渲染引擎实例
|
|
70
|
+
* @param configs - 播放器配置选项
|
|
71
|
+
*/
|
|
36
72
|
function Player(five) {
|
|
37
73
|
var _this;
|
|
38
74
|
var configs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -106,9 +142,33 @@ var Player = exports.Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
106
142
|
});
|
|
107
143
|
return _this;
|
|
108
144
|
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* 加载剧本数据
|
|
148
|
+
*
|
|
149
|
+
* 加载 VreoUnit 剧本数据,准备播放器状态,预载资源,并初始化播放环境。
|
|
150
|
+
*
|
|
151
|
+
* @param vreoUnit - 剧本数据对象,包含视频信息和关键帧序列
|
|
152
|
+
* @param currentTime - 起始播放时间(毫秒),默认为 0
|
|
153
|
+
* @param preload - 是否预载相关资源,默认为 false
|
|
154
|
+
* @param force - 是否强制重新载入(深拷贝数据),默认为 false
|
|
155
|
+
* @returns Promise<boolean> 返回加载是否成功
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```typescript
|
|
159
|
+
* // 基本加载
|
|
160
|
+
* await player.load(vreoUnit)
|
|
161
|
+
*
|
|
162
|
+
* // 从指定时间开始加载,并预载资源
|
|
163
|
+
* await player.load(vreoUnit, 5000, true)
|
|
164
|
+
*
|
|
165
|
+
* // 强制重新加载
|
|
166
|
+
* await player.load(vreoUnit, 0, false, true)
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
109
169
|
(0, _createClass2["default"])(Player, [{
|
|
110
170
|
key: "load",
|
|
111
|
-
value: function () {
|
|
171
|
+
value: (function () {
|
|
112
172
|
var _load = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(vreoUnit) {
|
|
113
173
|
var _this$controller$medi,
|
|
114
174
|
_this$configs$imageOp,
|
|
@@ -222,11 +282,32 @@ var Player = exports.Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
222
282
|
}
|
|
223
283
|
return load;
|
|
224
284
|
}()
|
|
285
|
+
/**
|
|
286
|
+
* 获取播放器是否处于暂停状态
|
|
287
|
+
* @returns 是否暂停中
|
|
288
|
+
*/
|
|
289
|
+
)
|
|
225
290
|
}, {
|
|
226
291
|
key: "paused",
|
|
227
292
|
get: function get() {
|
|
228
293
|
return !this.controller.playing;
|
|
229
294
|
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* 开始播放
|
|
298
|
+
*
|
|
299
|
+
* @param currentTime - 可选的播放起始时间(毫秒)
|
|
300
|
+
* @returns 是否开始播放成功
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* ```typescript
|
|
304
|
+
* // 从当前位置播放
|
|
305
|
+
* player.play()
|
|
306
|
+
*
|
|
307
|
+
* // 从指定时间开始播放
|
|
308
|
+
* player.play(10000) // 从10秒处开始
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
230
311
|
}, {
|
|
231
312
|
key: "play",
|
|
232
313
|
value: function play(currentTime) {
|
|
@@ -247,31 +328,66 @@ var Player = exports.Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
247
328
|
});
|
|
248
329
|
return true;
|
|
249
330
|
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* 设置播放器外观
|
|
334
|
+
* @param appearance - 外观配置对象
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* ```typescript
|
|
338
|
+
* player.setAppearance({
|
|
339
|
+
* waveStyle: 'solid'
|
|
340
|
+
* })
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
250
343
|
}, {
|
|
251
344
|
key: "setAppearance",
|
|
252
345
|
value: function setAppearance(appearance) {
|
|
253
346
|
this.controller.setAppearance(appearance);
|
|
254
347
|
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* 暂停播放
|
|
351
|
+
*/
|
|
255
352
|
}, {
|
|
256
353
|
key: "pause",
|
|
257
354
|
value: function pause() {
|
|
258
355
|
this.controller.setPlaying(false);
|
|
259
356
|
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* 显示播放器界面
|
|
360
|
+
*/
|
|
260
361
|
}, {
|
|
261
362
|
key: "show",
|
|
262
363
|
value: function show() {
|
|
263
364
|
this.controller.setVisible(true);
|
|
264
365
|
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* 隐藏播放器界面
|
|
369
|
+
*/
|
|
265
370
|
}, {
|
|
266
371
|
key: "hide",
|
|
267
372
|
value: function hide() {
|
|
268
373
|
this.controller.setVisible(false);
|
|
269
374
|
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* 获取当前播放时间
|
|
378
|
+
* @returns 当前播放时间(毫秒)
|
|
379
|
+
*/
|
|
270
380
|
}, {
|
|
271
381
|
key: "getCurrentTime",
|
|
272
382
|
value: function getCurrentTime() {
|
|
273
383
|
return this.controller.currentTime;
|
|
274
384
|
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* 销毁播放器实例
|
|
388
|
+
*
|
|
389
|
+
* 清理所有资源、事件监听器和DOM元素
|
|
390
|
+
*/
|
|
275
391
|
}, {
|
|
276
392
|
key: "dispose",
|
|
277
393
|
value: function dispose() {
|