@realsee/vreo 2.6.4-alpha.5 → 2.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/lib/PlayController/createHTMLAudioElement.js +14 -10
- package/lib/PlayController/index.js +73 -63
- package/lib/Player/Controller.js +56 -50
- package/lib/Player/PlaybackLifecycle.js +7 -6
- package/lib/Player/custom/SpatialScenePanel/index.js +11 -34
- package/lib/Player/index.js +166 -160
- package/lib/Player/modules/Drawer/index.js +2 -1
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +157 -146
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +1 -1
- package/lib/Player/modules/VideoAgent/index.js +3 -3
- package/lib/Player/modules/keyframes/BgMusic/index.js +12 -12
- package/lib/Player/modules/keyframes/CameraMovement/index.js +45 -43
- package/lib/Player/modules/keyframes/InfoPanel/index.js +8 -8
- package/lib/Player/modules/keyframes/ModelVideo/index.js +83 -81
- 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 +71 -69
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +6 -6
- package/lib/fivePlugins/CameraMovementPlugin/index.js +180 -173
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +6 -6
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +59 -57
- package/lib/react/index.js +1 -1
- package/lib/shared-utils/Audio.js +56 -52
- package/lib/shared-utils/AudioLike.js +14 -11
- package/lib/shared-utils/animationFrame/BetterTween.js +15 -13
- package/lib/shared-utils/animationFrame/tween.js +3 -1
- package/lib/shared-utils/getMediaInfo.js +1 -0
- package/lib/typings/VreoUnit.js +27 -134
- package/package.json +3 -3
|
@@ -4,30 +4,7 @@ import { createRoot } from 'react-dom/client';
|
|
|
4
4
|
import { Raycaster, Vector3 } from 'three';
|
|
5
5
|
import { tweenProgress } from "../../../shared-utils/animationFrame/BetterTween.js";
|
|
6
6
|
import { CSS3DRenderPlugin } from "../../../fivePlugins/CSS3DRenderPlugin/index.js";
|
|
7
|
-
import { VreoKeyframeEnum } from "../../../typings/VreoUnit.js";
|
|
8
|
-
// const mockData: SpatialScenePanelData = {
|
|
9
|
-
// customType: 'SpatialScenePanel',
|
|
10
|
-
// "stateList": [
|
|
11
|
-
// {
|
|
12
|
-
// "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___fc42f951076607a22fd5c54f005ba553.png",
|
|
13
|
-
// "text": "窗帘关闭"
|
|
14
|
-
// },
|
|
15
|
-
// {
|
|
16
|
-
// "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___b331e7ad732debc07250a169a3393b13.png",
|
|
17
|
-
// "text": "摄像头休眠"
|
|
18
|
-
// },
|
|
19
|
-
// {
|
|
20
|
-
// "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___2e425a81ac0ad88232d50d4e52a9abfa.png",
|
|
21
|
-
// "text": "氛围音乐"
|
|
22
|
-
// },
|
|
23
|
-
// {
|
|
24
|
-
// "icon": "http://vrlab-public.ljcdn.com/release/seesay/tools/___bff48bb81cde37aa6a319d6f5d56e3a4.png",
|
|
25
|
-
// "text": "空调打开"
|
|
26
|
-
// }
|
|
27
|
-
// ],
|
|
28
|
-
// "temperature": "27",
|
|
29
|
-
// "title": "沉浸式回家"
|
|
30
|
-
// }
|
|
7
|
+
import { VreoKeyframeEnum } from "../../../typings/VreoUnit.js";
|
|
31
8
|
// const getSphere = (position: Vector3, color = 0xffff00) => {
|
|
32
9
|
// const geometry = new SphereGeometry(0.05, 32, 16)
|
|
33
10
|
// const material = new MeshBasicMaterial({ color })
|
|
@@ -118,7 +95,7 @@ export function SpatialScenePanel(props) {
|
|
|
118
95
|
});
|
|
119
96
|
if (!container) return;
|
|
120
97
|
var root = createRoot(container);
|
|
121
|
-
root.render(/*#__PURE__*/React.createElement(Panel, {
|
|
98
|
+
root.render( /*#__PURE__*/React.createElement(Panel, {
|
|
122
99
|
ref: function ref(_ref3) {
|
|
123
100
|
return panelRef.current = _ref3;
|
|
124
101
|
},
|
|
@@ -130,15 +107,15 @@ export function SpatialScenePanel(props) {
|
|
|
130
107
|
var progress = _ref4.progress;
|
|
131
108
|
var needRotateY = Math.PI / 90 * 11 * progress;
|
|
132
109
|
var rotateY = needRotateY - lastRotateY;
|
|
133
|
-
css3DObject === null || css3DObject === void 0
|
|
110
|
+
css3DObject === null || css3DObject === void 0 ? void 0 : css3DObject.rotateY(rotateY);
|
|
134
111
|
// css3DObject?.rotateZ
|
|
135
112
|
lastRotateY = needRotateY;
|
|
136
113
|
}).onStart(function () {
|
|
137
|
-
css3DObject === null || css3DObject === void 0
|
|
114
|
+
css3DObject === null || css3DObject === void 0 ? void 0 : css3DObject.rotateY(startRotateY);
|
|
138
115
|
render();
|
|
139
116
|
}).onDispose(function () {
|
|
140
117
|
var _panelRef$current;
|
|
141
|
-
(_panelRef$current = panelRef.current) === null || _panelRef$current === void 0
|
|
118
|
+
(_panelRef$current = panelRef.current) === null || _panelRef$current === void 0 ? void 0 : _panelRef$current.classList.add('show');
|
|
142
119
|
}).play();
|
|
143
120
|
|
|
144
121
|
// Object.assign(window, { $dispose: () => {
|
|
@@ -150,9 +127,9 @@ export function SpatialScenePanel(props) {
|
|
|
150
127
|
end = keyframe.end;
|
|
151
128
|
timeoutRef.current = setTimeout(function () {
|
|
152
129
|
var _panelRef$current2;
|
|
153
|
-
(_panelRef$current2 = panelRef.current) === null || _panelRef$current2 === void 0
|
|
130
|
+
(_panelRef$current2 = panelRef.current) === null || _panelRef$current2 === void 0 ? void 0 : _panelRef$current2.classList.add('hide');
|
|
154
131
|
timeoutRef.current = setTimeout(function () {
|
|
155
|
-
dispose === null || dispose === void 0
|
|
132
|
+
dispose === null || dispose === void 0 ? void 0 : dispose();
|
|
156
133
|
timeoutRef.current = null;
|
|
157
134
|
}, 1500);
|
|
158
135
|
}, end - start);
|
|
@@ -184,10 +161,10 @@ function SpatialScenePanelBg() {
|
|
|
184
161
|
if (!ref.current) return;
|
|
185
162
|
var listener = function listener() {
|
|
186
163
|
var _ref$current;
|
|
187
|
-
(_ref$current = ref.current) === null || _ref$current === void 0
|
|
164
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.setAttribute('class', 'SpatialScenePanel-bg');
|
|
188
165
|
timeoutRef.current = setTimeout(function () {
|
|
189
166
|
var _ref$current2;
|
|
190
|
-
(_ref$current2 = ref.current) === null || _ref$current2 === void 0
|
|
167
|
+
(_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.setAttribute('class', 'SpatialScenePanel-bg SpatialScenePanel-bg--animation');
|
|
191
168
|
timeoutRef.current = null;
|
|
192
169
|
}, 3000);
|
|
193
170
|
};
|
|
@@ -203,7 +180,7 @@ function SpatialScenePanelBg() {
|
|
|
203
180
|
});
|
|
204
181
|
}
|
|
205
182
|
var Panel = /*#__PURE__*/React.forwardRef(function (props, myRef) {
|
|
206
|
-
var _props$data, _props$data2, _props$data3;
|
|
183
|
+
var _props$data, _props$data2, _props$data3, _props$data3$stateLis;
|
|
207
184
|
return /*#__PURE__*/React.createElement("div", {
|
|
208
185
|
className: "SpatialScenePanel",
|
|
209
186
|
ref: myRef
|
|
@@ -217,7 +194,7 @@ var Panel = /*#__PURE__*/React.forwardRef(function (props, myRef) {
|
|
|
217
194
|
className: "SpatialScenePanel-temperature"
|
|
218
195
|
}, (_props$data2 = props.data) === null || _props$data2 === void 0 ? void 0 : _props$data2.temperature, "\u2103")), /*#__PURE__*/React.createElement("div", {
|
|
219
196
|
className: "SpatialScenePanel-body"
|
|
220
|
-
}, (_props$data3 = props.data) === null || _props$data3 === void 0
|
|
197
|
+
}, (_props$data3 = props.data) === null || _props$data3 === void 0 ? void 0 : (_props$data3$stateLis = _props$data3.stateList) === null || _props$data3$stateLis === void 0 ? void 0 : _props$data3$stateLis.map(function (state, index) {
|
|
221
198
|
return /*#__PURE__*/React.createElement("div", {
|
|
222
199
|
key: "scene-".concat(state.text),
|
|
223
200
|
className: "SpatialScenePanel-item index_".concat(index)
|
package/lib/Player/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
5
7
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
9
|
var _location$search$matc, _location$search$matc2;
|
|
9
|
-
|
|
10
|
-
function
|
|
11
|
-
function
|
|
12
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
10
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
11
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
13
|
// 下面这一行不能删
|
|
14
14
|
import * as React from 'react';
|
|
15
15
|
import { createRoot } from 'react-dom/client';
|
|
@@ -49,6 +49,8 @@ var audioCacheLength = Number((_location$search$matc = (_location$search$matc2 =
|
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
51
|
export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
52
|
+
_inherits(Player, _Subscribe);
|
|
53
|
+
var _super = _createSuper(Player);
|
|
52
54
|
/**
|
|
53
55
|
* 创建 Vreo 播放器实例
|
|
54
56
|
*
|
|
@@ -59,12 +61,10 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
59
61
|
var _this;
|
|
60
62
|
var configs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
61
63
|
_classCallCheck(this, Player);
|
|
62
|
-
_this =
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
_defineProperty(_this, "
|
|
66
|
-
_defineProperty(_this, "loadGeneration", 0);
|
|
67
|
-
_defineProperty(_this, "disposed", false);
|
|
64
|
+
_this = _super.call(this);
|
|
65
|
+
_defineProperty(_assertThisInitialized(_this), "disposers", []);
|
|
66
|
+
_defineProperty(_assertThisInitialized(_this), "loadGeneration", 0);
|
|
67
|
+
_defineProperty(_assertThisInitialized(_this), "disposed", false);
|
|
68
68
|
_this.$five = five;
|
|
69
69
|
generateBlankAudio(audioCacheLength);
|
|
70
70
|
if (!configs.container) {
|
|
@@ -96,7 +96,7 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
96
96
|
configs: _this.configs
|
|
97
97
|
});
|
|
98
98
|
_this.root = createRoot(configs.container);
|
|
99
|
-
_this.root.render(/*#__PURE__*/React.createElement(ControllerContext.Provider, {
|
|
99
|
+
_this.root.render( /*#__PURE__*/React.createElement(ControllerContext.Provider, {
|
|
100
100
|
value: _this.controller
|
|
101
101
|
}, /*#__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) {
|
|
102
102
|
return /*#__PURE__*/React.createElement(CustomCmpt, {
|
|
@@ -160,18 +160,21 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
160
160
|
* await player.load(vreoUnit, 0, false, true)
|
|
161
161
|
* ```
|
|
162
162
|
*/
|
|
163
|
-
|
|
164
|
-
return _createClass(Player, [{
|
|
163
|
+
_createClass(Player, [{
|
|
165
164
|
key: "getMediaManager",
|
|
166
|
-
value:
|
|
165
|
+
value: /** Five 渲染引擎实例 */
|
|
166
|
+
|
|
167
|
+
/** 内部控制器 */
|
|
168
|
+
|
|
169
|
+
function getMediaManager() {
|
|
167
170
|
var _this$controller$play;
|
|
168
171
|
return (_this$controller$play = this.controller.playback.capture()) === null || _this$controller$play === void 0 ? void 0 : _this$controller$play.mediaManager;
|
|
169
172
|
}
|
|
170
173
|
/** 播放器配置(只读) */
|
|
171
174
|
}, {
|
|
172
175
|
key: "load",
|
|
173
|
-
value:
|
|
174
|
-
var _load = _asyncToGenerator(/*#__PURE__*/
|
|
176
|
+
value: function () {
|
|
177
|
+
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(vreoUnit) {
|
|
175
178
|
var _this2 = this;
|
|
176
179
|
var currentTime,
|
|
177
180
|
preload,
|
|
@@ -181,158 +184,161 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
181
184
|
run,
|
|
182
185
|
valid,
|
|
183
186
|
_this$controller$vide,
|
|
184
|
-
_this$configs$imageOp,
|
|
185
187
|
_this$controller$vide2,
|
|
188
|
+
_this$configs$imageOp,
|
|
186
189
|
_this$controller$vide3,
|
|
190
|
+
_this$controller$vide4,
|
|
187
191
|
panoIndexMap,
|
|
188
192
|
panoIndexes,
|
|
189
193
|
i,
|
|
190
|
-
_args = arguments
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
194
|
+
_args = arguments;
|
|
195
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
196
|
+
while (1) {
|
|
197
|
+
switch (_context.prev = _context.next) {
|
|
198
|
+
case 0:
|
|
199
|
+
currentTime = _args.length > 1 && _args[1] !== undefined ? _args[1] : 0;
|
|
200
|
+
preload = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
|
|
201
|
+
force = _args.length > 3 && _args[3] !== undefined ? _args[3] : false;
|
|
202
|
+
userAction = _args.length > 4 && _args[4] !== undefined ? _args[4] : false;
|
|
203
|
+
generation = ++this.loadGeneration;
|
|
204
|
+
this.controller.playback.cancel();
|
|
205
|
+
if (!(this.disposed || !this.controller.playback.begin(userAction))) {
|
|
206
|
+
_context.next = 8;
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
return _context.abrupt("return", false);
|
|
210
|
+
case 8:
|
|
211
|
+
run = this.controller.playback.capture();
|
|
212
|
+
valid = function valid() {
|
|
213
|
+
return run.valid();
|
|
214
|
+
};
|
|
215
|
+
_context.prev = 10;
|
|
216
|
+
this.controller.clear();
|
|
217
|
+
this.controller.setLoading(true);
|
|
218
|
+
if (force) {
|
|
219
|
+
vreoUnit = JSON.parse(JSON.stringify(vreoUnit));
|
|
220
|
+
}
|
|
221
|
+
// if (!this.controller.visible) {
|
|
222
|
+
// this.controller.setVisible(true)
|
|
223
|
+
// // 延迟 500ms 规避跟 DOM 动画冲突
|
|
224
|
+
// await new Promise((resolve) => {
|
|
225
|
+
// setTimeout(() => resolve(true), 500)
|
|
226
|
+
// })
|
|
227
|
+
// }
|
|
224
228
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
229
|
+
if (this.controller.stopInterval) {
|
|
230
|
+
this.controller.stopInterval();
|
|
231
|
+
this.controller.stopInterval = undefined;
|
|
232
|
+
}
|
|
233
|
+
this.controller.vreoUnit = vreoUnit;
|
|
234
|
+
(_this$controller$vide = this.controller.videoAgentScene) === null || _this$controller$vide === void 0 ? void 0 : (_this$controller$vide2 = _this$controller$vide.videoAgentMesh.mediaOperations) === null || _this$controller$vide2 === void 0 ? void 0 : _this$controller$vide2.pause();
|
|
231
235
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
236
|
+
// 预载逻辑
|
|
237
|
+
// 是否降低图片分辨率
|
|
238
|
+
if (this.$five.imageOptions.size && (_this$configs$imageOp = this.configs.imageOptions) !== null && _this$configs$imageOp !== void 0 && _this$configs$imageOp.size && this.$five.imageOptions.size > this.configs.imageOptions.size) {
|
|
239
|
+
this.$five.imageOptions.size = this.configs.imageOptions.size;
|
|
240
|
+
}
|
|
237
241
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
panoIndexMap = vreoUnit.keyframes.filter(function (vreoKeyframe) {
|
|
244
|
-
if (vreoKeyframe.type !== VreoKeyframeEnum.CameraMovement) {
|
|
245
|
-
return false;
|
|
242
|
+
// 预载数据中的点位
|
|
243
|
+
if (!(preload || preload === undefined && this.configs.autoPreload)) {
|
|
244
|
+
_context.next = 30;
|
|
245
|
+
break;
|
|
246
246
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
panoIndexMap = vreoUnit.keyframes.filter(function (vreoKeyframe) {
|
|
248
|
+
if (vreoKeyframe.type !== VreoKeyframeEnum.CameraMovement) {
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
var data = vreoKeyframe.data;
|
|
252
|
+
if (data.panoIndex === undefined) {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
return true;
|
|
256
|
+
}).reduce(function (accu, curr) {
|
|
257
|
+
var panoIndex = curr.data.panoIndex;
|
|
258
|
+
if (!accu[panoIndex]) {
|
|
259
|
+
accu[panoIndex] = true;
|
|
260
|
+
}
|
|
261
|
+
return accu;
|
|
262
|
+
}, {});
|
|
263
|
+
panoIndexes = Object.keys(panoIndexMap);
|
|
264
|
+
i = 0;
|
|
265
|
+
case 22:
|
|
266
|
+
if (!(i < panoIndexes.length)) {
|
|
267
|
+
_context.next = 30;
|
|
268
|
+
break;
|
|
250
269
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
if (!
|
|
255
|
-
|
|
270
|
+
_context.next = 25;
|
|
271
|
+
return this.$five.preloadPano(Number(panoIndexes[i]));
|
|
272
|
+
case 25:
|
|
273
|
+
if (!(!valid() || generation !== this.loadGeneration)) {
|
|
274
|
+
_context.next = 27;
|
|
275
|
+
break;
|
|
256
276
|
}
|
|
257
|
-
return
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
case 3:
|
|
262
|
-
if (!(i < panoIndexes.length)) {
|
|
263
|
-
_context.n = 6;
|
|
264
|
-
break;
|
|
265
|
-
}
|
|
266
|
-
_context.n = 4;
|
|
267
|
-
return this.$five.preloadPano(Number(panoIndexes[i]));
|
|
268
|
-
case 4:
|
|
269
|
-
if (!(!valid() || generation !== this.loadGeneration)) {
|
|
270
|
-
_context.n = 5;
|
|
271
|
-
break;
|
|
272
|
-
}
|
|
273
|
-
return _context.a(2, false);
|
|
274
|
-
case 5:
|
|
275
|
-
i++;
|
|
276
|
-
_context.n = 3;
|
|
277
|
-
break;
|
|
278
|
-
case 6:
|
|
279
|
-
// 新数据载入就绪
|
|
280
|
-
this.emit('loaded', vreoUnit);
|
|
281
|
-
this.controller.emit('loaded', vreoUnit);
|
|
282
|
-
if (!(!valid() || generation !== this.loadGeneration)) {
|
|
283
|
-
_context.n = 7;
|
|
284
|
-
break;
|
|
285
|
-
}
|
|
286
|
-
return _context.a(2, false);
|
|
287
|
-
case 7:
|
|
288
|
-
if ((_this$controller$vide2 = this.controller.videoAgentScene) !== null && _this$controller$vide2 !== void 0 && _this$controller$vide2.videoAgentMesh.mediaOperations) {
|
|
289
|
-
this.controller.videoAgentScene.videoAgentMesh.mediaOperations.currentTime = currentTime / 1000;
|
|
290
|
-
}
|
|
291
|
-
this.controller.setAvatar(vreoUnit.video.avatar);
|
|
292
|
-
_context.n = 8;
|
|
293
|
-
return waitForBlankAudioGenerated();
|
|
294
|
-
case 8:
|
|
295
|
-
if (!(!valid() || generation !== this.loadGeneration)) {
|
|
296
|
-
_context.n = 9;
|
|
297
|
-
break;
|
|
298
|
-
}
|
|
299
|
-
return _context.a(2, false);
|
|
300
|
-
case 9:
|
|
301
|
-
_context.n = 10;
|
|
302
|
-
return (_this$controller$vide3 = this.controller.videoAgentScene) === null || _this$controller$vide3 === void 0 ? void 0 : _this$controller$vide3.videoAgentMesh.play(vreoUnit.video.url, currentTime / 1000, vreoUnit.video.duration);
|
|
303
|
-
case 10:
|
|
304
|
-
if (!(!valid() || generation !== this.loadGeneration)) {
|
|
305
|
-
_context.n = 11;
|
|
277
|
+
return _context.abrupt("return", false);
|
|
278
|
+
case 27:
|
|
279
|
+
i++;
|
|
280
|
+
_context.next = 22;
|
|
306
281
|
break;
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
_context.
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
282
|
+
case 30:
|
|
283
|
+
// 新数据载入就绪
|
|
284
|
+
this.emit('loaded', vreoUnit);
|
|
285
|
+
this.controller.emit('loaded', vreoUnit);
|
|
286
|
+
if (!(!valid() || generation !== this.loadGeneration)) {
|
|
287
|
+
_context.next = 34;
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
return _context.abrupt("return", false);
|
|
291
|
+
case 34:
|
|
292
|
+
if ((_this$controller$vide3 = this.controller.videoAgentScene) !== null && _this$controller$vide3 !== void 0 && _this$controller$vide3.videoAgentMesh.mediaOperations) {
|
|
293
|
+
this.controller.videoAgentScene.videoAgentMesh.mediaOperations.currentTime = currentTime / 1000;
|
|
294
|
+
}
|
|
295
|
+
this.controller.setAvatar(vreoUnit.video.avatar);
|
|
296
|
+
_context.next = 38;
|
|
297
|
+
return waitForBlankAudioGenerated();
|
|
298
|
+
case 38:
|
|
299
|
+
if (!(!valid() || generation !== this.loadGeneration)) {
|
|
300
|
+
_context.next = 40;
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
return _context.abrupt("return", false);
|
|
304
|
+
case 40:
|
|
305
|
+
_context.next = 42;
|
|
306
|
+
return (_this$controller$vide4 = this.controller.videoAgentScene) === null || _this$controller$vide4 === void 0 ? void 0 : _this$controller$vide4.videoAgentMesh.play(vreoUnit.video.url, currentTime / 1000, vreoUnit.video.duration);
|
|
307
|
+
case 42:
|
|
308
|
+
if (!(!valid() || generation !== this.loadGeneration)) {
|
|
309
|
+
_context.next = 44;
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
return _context.abrupt("return", false);
|
|
313
|
+
case 44:
|
|
314
|
+
this.controller.setEnded(false);
|
|
315
|
+
this.play(undefined, userAction);
|
|
316
|
+
this.controller.run(function (type, keyframe) {
|
|
317
|
+
return _this2.emit(type, keyframe, _this2.controller.currentTime);
|
|
318
|
+
});
|
|
319
|
+
this.controller.setLoading(false);
|
|
320
|
+
return _context.abrupt("return", true);
|
|
321
|
+
case 51:
|
|
322
|
+
_context.prev = 51;
|
|
323
|
+
_context.t0 = _context["catch"](10);
|
|
324
|
+
if (valid()) {
|
|
325
|
+
_context.next = 55;
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
return _context.abrupt("return", false);
|
|
329
|
+
case 55:
|
|
330
|
+
this.controller.playback.cancel();
|
|
331
|
+
throw _context.t0;
|
|
332
|
+
case 57:
|
|
333
|
+
_context.prev = 57;
|
|
334
|
+
if (generation === this.loadGeneration) this.controller.setLoading(false);
|
|
335
|
+
return _context.finish(57);
|
|
336
|
+
case 60:
|
|
337
|
+
case "end":
|
|
338
|
+
return _context.stop();
|
|
339
|
+
}
|
|
334
340
|
}
|
|
335
|
-
}, _callee, this, [[
|
|
341
|
+
}, _callee, this, [[10, 51, 57, 60]]);
|
|
336
342
|
}));
|
|
337
343
|
function load(_x) {
|
|
338
344
|
return _load.apply(this, arguments);
|
|
@@ -343,7 +349,6 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
343
349
|
* 获取播放器是否处于暂停状态
|
|
344
350
|
* @returns 是否暂停中
|
|
345
351
|
*/
|
|
346
|
-
)
|
|
347
352
|
}, {
|
|
348
353
|
key: "paused",
|
|
349
354
|
get: function get() {
|
|
@@ -368,11 +373,11 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
368
373
|
}, {
|
|
369
374
|
key: "play",
|
|
370
375
|
value: function play(currentTime) {
|
|
371
|
-
var _this$controller$
|
|
376
|
+
var _this$controller$vide5, _this$controller$vreo;
|
|
372
377
|
var userAction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
373
378
|
if (this.disposed || !this.controller.playback.begin(userAction)) return false;
|
|
374
379
|
if (this.controller.playing) return true;
|
|
375
|
-
if (currentTime && (_this$controller$
|
|
380
|
+
if (currentTime && (_this$controller$vide5 = this.controller.videoAgentScene) !== null && _this$controller$vide5 !== void 0 && _this$controller$vide5.videoAgentMesh.mediaOperations) {
|
|
376
381
|
this.controller.videoAgentScene.videoAgentMesh.mediaOperations.currentTime = currentTime / 1000;
|
|
377
382
|
}
|
|
378
383
|
Object.assign(window, {
|
|
@@ -380,7 +385,7 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
380
385
|
});
|
|
381
386
|
this.controller.setEnded(false);
|
|
382
387
|
this.controller.setPlaying(true);
|
|
383
|
-
(_this$controller$vreo = this.controller.vreoUnit) === null || _this$controller$vreo === void 0
|
|
388
|
+
(_this$controller$vreo = this.controller.vreoUnit) === null || _this$controller$vreo === void 0 ? void 0 : _this$controller$vreo.keyframes.forEach(function (keyframe) {
|
|
384
389
|
if (keyframe.type === VreoKeyframeEnum.BgMusic) {
|
|
385
390
|
keyframe.parsed = false;
|
|
386
391
|
}
|
|
@@ -462,6 +467,7 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
462
467
|
this.root.unmount();
|
|
463
468
|
}
|
|
464
469
|
}]);
|
|
470
|
+
return Player;
|
|
465
471
|
}(Subscribe);
|
|
466
472
|
|
|
467
473
|
// 导出自定义组件
|
|
@@ -6,7 +6,8 @@ var DrawerView = observer(function (_ref) {
|
|
|
6
6
|
var _controller$drawerCon2;
|
|
7
7
|
var controller = _ref.controller;
|
|
8
8
|
var maxHeight = '400px';
|
|
9
|
-
var height = function (
|
|
9
|
+
var height = function () {
|
|
10
|
+
var _controller$drawerCon;
|
|
10
11
|
var height = (_controller$drawerCon = controller.drawerConfig) === null || _controller$drawerCon === void 0 ? void 0 : _controller$drawerCon.height;
|
|
11
12
|
if (!height) {
|
|
12
13
|
return 'max-content';
|