@realsee/vreo 2.6.4-alpha.1 → 2.6.4-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/PlayController/createHTMLAudioElement.js +10 -14
- package/lib/PlayController/index.js +63 -73
- package/lib/Player/App.js +2 -2
- package/lib/Player/Controller.d.ts +7 -1
- package/lib/Player/Controller.js +112 -75
- package/lib/Player/PlaybackLifecycle.d.ts +25 -0
- package/lib/Player/PlaybackLifecycle.js +117 -0
- package/lib/Player/custom/SpatialScenePanel/index.js +34 -11
- package/lib/Player/index.d.ts +7 -2
- package/lib/Player/index.js +198 -126
- package/lib/Player/modules/Drawer/index.js +1 -2
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +13 -1
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +209 -204
- package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +1 -0
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +6 -2
- package/lib/Player/modules/VideoAgent/index.js +10 -2
- package/lib/Player/modules/keyframes/BgMusic/index.js +50 -74
- package/lib/Player/modules/keyframes/CameraMovement/index.js +43 -45
- package/lib/Player/modules/keyframes/InfoPanel/index.js +45 -35
- package/lib/Player/modules/keyframes/ModelVideo/index.js +95 -57
- package/lib/Player/modules/keyframes/PanoTag/index.js +4 -2
- 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 +93 -79
- package/lib/Player/playback-types.d.ts +21 -0
- package/lib/Player/playback-types.js +1 -0
- package/lib/Player/typings.d.ts +3 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +6 -6
- package/lib/fivePlugins/CameraMovementPlugin/index.js +173 -180
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +6 -6
- package/lib/fivePlugins/ModelTVVideoPlugin/index.d.ts +3 -0
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +182 -75
- package/lib/index.d.ts +1 -0
- package/lib/react/index.js +1 -1
- package/lib/shared-utils/Audio.js +55 -57
- package/lib/shared-utils/AudioLike.js +12 -14
- package/lib/shared-utils/animationFrame/BetterTween.js +13 -15
- package/lib/shared-utils/animationFrame/tween.js +1 -3
- package/lib/shared-utils/getMediaInfo.js +0 -1
- package/lib/typings/VreoUnit.js +134 -27
- package/package.json +6 -4
- package/docs/.nojekyll +0 -1
- package/docs/assets/custom.css +0 -78
- package/docs/assets/hierarchy.js +0 -1
- package/docs/assets/highlight.css +0 -127
- package/docs/assets/icons.js +0 -18
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -60
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1640
- package/docs/classes/Player.AudioLike.html +0 -15
- package/docs/classes/Player.Controller.html +0 -87
- package/docs/classes/Player.Player.html +0 -54
- package/docs/classes/Player.VideoAgentMesh.html +0 -72
- package/docs/classes/Player.VideoAgentScene.html +0 -9
- package/docs/demo/assets/AppReact-CkuqZtcS.js +0 -1
- package/docs/demo/assets/default-BQGCQRLt.css +0 -1
- package/docs/demo/assets/default-CVvVdmSW.js +0 -5540
- package/docs/demo/assets/dynamic-CO5wq52h.js +0 -1
- package/docs/demo/assets/examples-BCLzFApO.css +0 -1
- package/docs/demo/assets/examples-DfiAz2fR.js +0 -25
- package/docs/demo/assets/index-CBBSwaYT.js +0 -1
- package/docs/demo/assets/index-CmEXi2sK.css +0 -1
- package/docs/demo/assets/main-BF1tvUg-.js +0 -25
- package/docs/demo/assets/react-BnzBLum3.css +0 -1
- package/docs/demo/assets/react-C4h9qndP.js +0 -25
- package/docs/demo/examples.html +0 -16
- package/docs/demo/index-react-dynamic.html +0 -18
- package/docs/demo/index-react.html +0 -19
- package/docs/demo/index.html +0 -19
- package/docs/enums/Player.InfoPanelStyleEnum.html +0 -3
- package/docs/enums/Player.InfoPanelTypeEnum.html +0 -4
- package/docs/enums/Player.PanoEffectEnum.html +0 -4
- package/docs/enums/Player.PanoTagEnum.html +0 -4
- package/docs/enums/Player.PanoTagStyleEnum.html +0 -6
- package/docs/enums/Player.VreoKeyframeEnum.html +0 -25
- package/docs/enums/fivePlugins.CameraMovementEffect.html +0 -3
- package/docs/enums/fivePlugins.Rotation.html +0 -4
- package/docs/functions/custom.SpatialScenePanel.html +0 -2
- package/docs/functions/react.useVreoAction.html +0 -8
- package/docs/functions/react.useVreoEventCallback.html +0 -10
- package/docs/functions/react.useVreoPausedState.html +0 -8
- package/docs/hierarchy.html +0 -1
- package/docs/index.html +0 -160
- package/docs/interfaces/Player.Appearance.html +0 -2
- package/docs/interfaces/Player.CustomVreoKeyframeProps.html +0 -3
- package/docs/interfaces/Player.PlayerConfigs.html +0 -20
- package/docs/interfaces/Player.Vertex.html +0 -5
- package/docs/interfaces/Player.VideoAgentMeshOptions.html +0 -9
- package/docs/interfaces/Player.VreoKeyframe.html +0 -8
- package/docs/interfaces/Player.VreoUnit.html +0 -9
- package/docs/interfaces/Player.VreoVideo.html +0 -7
- package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +0 -8
- package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +0 -3
- package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +0 -5
- package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +0 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +0 -5
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +0 -4
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +0 -2
- package/docs/interfaces/fivePlugins.Vector3Position.html +0 -5
- package/docs/interfaces/react.VreoActionCallbacks.html +0 -18
- package/docs/interfaces/react.VreoProviderProps.html +0 -6
- package/docs/modules/Player.html +0 -1
- package/docs/modules/custom.html +0 -1
- package/docs/modules/fivePlugins.html +0 -1
- package/docs/modules/react.html +0 -1
- package/docs/modules.html +0 -1
- package/docs/types/Player.AppSize.html +0 -1
- package/docs/types/Player.AudioLikeEvent.html +0 -6
- package/docs/types/Player.CameraMovementData.html +0 -2
- package/docs/types/Player.CustomData.html +0 -2
- package/docs/types/Player.InfoPanelData.html +0 -7
- package/docs/types/Player.ModelVideoData.html +0 -9
- package/docs/types/Player.PanoEffectData.html +0 -4
- package/docs/types/Player.PanoTagData.html +0 -6
- package/docs/types/Player.PanoTextLabelData.html +0 -7
- package/docs/types/Player.PrompterData.html +0 -3
- package/docs/types/Player.QuadrangleVertexs.html +0 -2
- package/docs/types/Player.Quaternion.html +0 -6
- package/docs/types/Player.UpdateVRPanoramaData.html +0 -7
- package/docs/types/Player.Vertexs.html +0 -2
- package/docs/types/Player.VideoEffectData.html +0 -7
- package/docs/types/Player.VreoKeyframeEvent.html +0 -2
- package/docs/types/Player.VreoKeyframeMap.html +0 -6
- package/docs/types/Player.VreoSubscribe.html +0 -1
- package/docs/types/Player.WaveAppearance.html +0 -1
- package/docs/types/fivePlugins.CSS3DRenderPluginParameterType.html +0 -1
- package/docs/types/fivePlugins.MoveArgs.html +0 -1
- package/docs/types/fivePlugins.MoveOpts.html +0 -1
- package/docs/types/fivePlugins.RotateArgs.html +0 -1
- package/docs/types/fivePlugins.RotateOpts.html +0 -1
- package/docs/variables/fivePlugins.CSS3DRenderPlugin.html +0 -3
- package/docs/variables/fivePlugins.CameraMovementPlugin.html +0 -2
- package/docs/variables/fivePlugins.ModelTVVideoPlugin.html +0 -1
- package/docs/variables/react.VreoProvider.html +0 -9
package/lib/Player/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
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 _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
6
5
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
6
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
8
|
var _location$search$matc, _location$search$matc2;
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
function
|
|
9
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
10
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
11
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
12
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
13
|
// 下面这一行不能删
|
|
12
14
|
import * as React from 'react';
|
|
13
|
-
import * as ReactDOM from 'react-dom';
|
|
14
15
|
import { createRoot } from 'react-dom/client';
|
|
15
16
|
import { Subscribe } from '@realsee/five';
|
|
16
17
|
import { App } from "./App.js";
|
|
@@ -48,14 +49,6 @@ var audioCacheLength = Number((_location$search$matc = (_location$search$matc2 =
|
|
|
48
49
|
* ```
|
|
49
50
|
*/
|
|
50
51
|
export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
51
|
-
_inherits(Player, _Subscribe);
|
|
52
|
-
var _super = _createSuper(Player);
|
|
53
|
-
/** Five 渲染引擎实例 */
|
|
54
|
-
|
|
55
|
-
/** 内部控制器 */
|
|
56
|
-
|
|
57
|
-
/** 播放器配置(只读) */
|
|
58
|
-
|
|
59
52
|
/**
|
|
60
53
|
* 创建 Vreo 播放器实例
|
|
61
54
|
*
|
|
@@ -66,7 +59,12 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
66
59
|
var _this;
|
|
67
60
|
var configs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
68
61
|
_classCallCheck(this, Player);
|
|
69
|
-
_this =
|
|
62
|
+
_this = _callSuper(this, Player);
|
|
63
|
+
/** Five 渲染引擎实例 */
|
|
64
|
+
/** 内部控制器 */
|
|
65
|
+
_defineProperty(_this, "disposers", []);
|
|
66
|
+
_defineProperty(_this, "loadGeneration", 0);
|
|
67
|
+
_defineProperty(_this, "disposed", false);
|
|
70
68
|
_this.$five = five;
|
|
71
69
|
generateBlankAudio(audioCacheLength);
|
|
72
70
|
if (!configs.container) {
|
|
@@ -97,8 +95,8 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
97
95
|
container: configs.container,
|
|
98
96
|
configs: _this.configs
|
|
99
97
|
});
|
|
100
|
-
|
|
101
|
-
root.render(
|
|
98
|
+
_this.root = createRoot(configs.container);
|
|
99
|
+
_this.root.render(/*#__PURE__*/React.createElement(ControllerContext.Provider, {
|
|
102
100
|
value: _this.controller
|
|
103
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) {
|
|
104
102
|
return /*#__PURE__*/React.createElement(CustomCmpt, {
|
|
@@ -114,25 +112,28 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
114
112
|
return _this.off(name, callback);
|
|
115
113
|
}
|
|
116
114
|
},
|
|
117
|
-
five: five
|
|
115
|
+
five: five,
|
|
116
|
+
getMediaManager: function getMediaManager() {
|
|
117
|
+
return _this.getMediaManager();
|
|
118
|
+
}
|
|
118
119
|
});
|
|
119
120
|
})));
|
|
120
121
|
|
|
121
122
|
// 监听播放情况:抛出触发时机
|
|
122
|
-
reaction(function () {
|
|
123
|
+
_this.disposers.push(reaction(function () {
|
|
123
124
|
return _this.controller.ended;
|
|
124
125
|
}, function (ended) {
|
|
125
126
|
if (ended) {
|
|
126
127
|
_this.emit('paused', true);
|
|
127
128
|
}
|
|
128
|
-
});
|
|
129
|
-
reaction(function () {
|
|
129
|
+
}));
|
|
130
|
+
_this.disposers.push(reaction(function () {
|
|
130
131
|
return _this.controller.playing;
|
|
131
132
|
}, function (playing) {
|
|
132
133
|
if (!_this.controller.ended) {
|
|
133
134
|
_this.emit(playing ? 'playing' : 'paused');
|
|
134
135
|
}
|
|
135
|
-
});
|
|
136
|
+
}));
|
|
136
137
|
return _this;
|
|
137
138
|
}
|
|
138
139
|
|
|
@@ -159,116 +160,179 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
159
160
|
* await player.load(vreoUnit, 0, false, true)
|
|
160
161
|
* ```
|
|
161
162
|
*/
|
|
162
|
-
|
|
163
|
+
_inherits(Player, _Subscribe);
|
|
164
|
+
return _createClass(Player, [{
|
|
165
|
+
key: "getMediaManager",
|
|
166
|
+
value: function getMediaManager() {
|
|
167
|
+
var _this$controller$play;
|
|
168
|
+
return (_this$controller$play = this.controller.playback.capture()) === null || _this$controller$play === void 0 ? void 0 : _this$controller$play.mediaManager;
|
|
169
|
+
}
|
|
170
|
+
/** 播放器配置(只读) */
|
|
171
|
+
}, {
|
|
163
172
|
key: "load",
|
|
164
|
-
value: function () {
|
|
165
|
-
var _load = _asyncToGenerator(
|
|
166
|
-
var
|
|
167
|
-
_this$configs$imageOp,
|
|
168
|
-
_this$controller$vide,
|
|
169
|
-
_this$controller$vide2,
|
|
170
|
-
_this2 = this;
|
|
173
|
+
value: (function () {
|
|
174
|
+
var _load = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(vreoUnit) {
|
|
175
|
+
var _this2 = this;
|
|
171
176
|
var currentTime,
|
|
172
177
|
preload,
|
|
173
178
|
force,
|
|
179
|
+
userAction,
|
|
180
|
+
generation,
|
|
181
|
+
run,
|
|
182
|
+
valid,
|
|
183
|
+
_this$controller$vide,
|
|
184
|
+
_this$configs$imageOp,
|
|
185
|
+
_this$controller$vide2,
|
|
186
|
+
_this$controller$vide3,
|
|
174
187
|
panoIndexMap,
|
|
175
188
|
panoIndexes,
|
|
176
189
|
i,
|
|
177
|
-
_args = arguments
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
190
|
+
_args = arguments,
|
|
191
|
+
_t;
|
|
192
|
+
return _regenerator().w(function (_context) {
|
|
193
|
+
while (1) switch (_context.p = _context.n) {
|
|
194
|
+
case 0:
|
|
195
|
+
currentTime = _args.length > 1 && _args[1] !== undefined ? _args[1] : 0;
|
|
196
|
+
preload = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
|
|
197
|
+
force = _args.length > 3 && _args[3] !== undefined ? _args[3] : false;
|
|
198
|
+
userAction = _args.length > 4 && _args[4] !== undefined ? _args[4] : false;
|
|
199
|
+
generation = ++this.loadGeneration;
|
|
200
|
+
this.controller.playback.cancel();
|
|
201
|
+
if (!(this.disposed || !this.controller.playback.begin(userAction))) {
|
|
202
|
+
_context.n = 1;
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
return _context.a(2, false);
|
|
206
|
+
case 1:
|
|
207
|
+
run = this.controller.playback.capture();
|
|
208
|
+
valid = function valid() {
|
|
209
|
+
return run.valid();
|
|
210
|
+
};
|
|
211
|
+
_context.p = 2;
|
|
212
|
+
this.controller.clear();
|
|
213
|
+
this.controller.setLoading(true);
|
|
214
|
+
if (force) {
|
|
215
|
+
vreoUnit = JSON.parse(JSON.stringify(vreoUnit));
|
|
216
|
+
}
|
|
217
|
+
// if (!this.controller.visible) {
|
|
218
|
+
// this.controller.setVisible(true)
|
|
219
|
+
// // 延迟 500ms 规避跟 DOM 动画冲突
|
|
220
|
+
// await new Promise((resolve) => {
|
|
221
|
+
// setTimeout(() => resolve(true), 500)
|
|
222
|
+
// })
|
|
223
|
+
// }
|
|
197
224
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
225
|
+
if (this.controller.stopInterval) {
|
|
226
|
+
this.controller.stopInterval();
|
|
227
|
+
this.controller.stopInterval = undefined;
|
|
228
|
+
}
|
|
229
|
+
this.controller.vreoUnit = vreoUnit;
|
|
230
|
+
(_this$controller$vide = this.controller.videoAgentScene) === null || _this$controller$vide === void 0 || (_this$controller$vide = _this$controller$vide.videoAgentMesh.mediaOperations) === null || _this$controller$vide === void 0 || _this$controller$vide.pause();
|
|
204
231
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
232
|
+
// 预载逻辑
|
|
233
|
+
// 是否降低图片分辨率
|
|
234
|
+
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) {
|
|
235
|
+
this.$five.imageOptions.size = this.configs.imageOptions.size;
|
|
236
|
+
}
|
|
210
237
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
238
|
+
// 预载数据中的点位
|
|
239
|
+
if (!(preload || preload === undefined && this.configs.autoPreload)) {
|
|
240
|
+
_context.n = 6;
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
panoIndexMap = vreoUnit.keyframes.filter(function (vreoKeyframe) {
|
|
244
|
+
if (vreoKeyframe.type !== VreoKeyframeEnum.CameraMovement) {
|
|
245
|
+
return false;
|
|
215
246
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
var data = vreoKeyframe.data;
|
|
221
|
-
if (data.panoIndex === undefined) {
|
|
222
|
-
return false;
|
|
223
|
-
}
|
|
224
|
-
return true;
|
|
225
|
-
}).reduce(function (accu, curr) {
|
|
226
|
-
var panoIndex = curr.data.panoIndex;
|
|
227
|
-
if (!accu[panoIndex]) {
|
|
228
|
-
accu[panoIndex] = true;
|
|
229
|
-
}
|
|
230
|
-
return accu;
|
|
231
|
-
}, {});
|
|
232
|
-
panoIndexes = Object.keys(panoIndexMap);
|
|
233
|
-
i = 0;
|
|
234
|
-
case 14:
|
|
235
|
-
if (!(i < panoIndexes.length)) {
|
|
236
|
-
_context.next = 20;
|
|
237
|
-
break;
|
|
247
|
+
var data = vreoKeyframe.data;
|
|
248
|
+
if (data.panoIndex === undefined) {
|
|
249
|
+
return false;
|
|
238
250
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
break;
|
|
245
|
-
case 20:
|
|
246
|
-
// 新数据载入就绪
|
|
247
|
-
this.emit('loaded', vreoUnit);
|
|
248
|
-
this.controller.emit('loaded', vreoUnit);
|
|
249
|
-
if ((_this$controller$vide = this.controller.videoAgentScene) !== null && _this$controller$vide !== void 0 && _this$controller$vide.videoAgentMesh.mediaInstance) {
|
|
250
|
-
this.controller.videoAgentScene.videoAgentMesh.mediaInstance.currentTime = currentTime / 1000;
|
|
251
|
+
return true;
|
|
252
|
+
}).reduce(function (accu, curr) {
|
|
253
|
+
var panoIndex = curr.data.panoIndex;
|
|
254
|
+
if (!accu[panoIndex]) {
|
|
255
|
+
accu[panoIndex] = true;
|
|
251
256
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
257
|
+
return accu;
|
|
258
|
+
}, {});
|
|
259
|
+
panoIndexes = Object.keys(panoIndexMap);
|
|
260
|
+
i = 0;
|
|
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;
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
return _context.a(2, false);
|
|
309
|
+
case 11:
|
|
310
|
+
this.controller.setEnded(false);
|
|
311
|
+
this.play(undefined, userAction);
|
|
312
|
+
this.controller.run(function (type, keyframe) {
|
|
313
|
+
return _this2.emit(type, keyframe, _this2.controller.currentTime);
|
|
314
|
+
});
|
|
315
|
+
this.controller.setLoading(false);
|
|
316
|
+
return _context.a(2, true);
|
|
317
|
+
case 12:
|
|
318
|
+
_context.p = 12;
|
|
319
|
+
_t = _context.v;
|
|
320
|
+
if (valid()) {
|
|
321
|
+
_context.n = 13;
|
|
322
|
+
break;
|
|
323
|
+
}
|
|
324
|
+
return _context.a(2, false);
|
|
325
|
+
case 13:
|
|
326
|
+
this.controller.playback.cancel();
|
|
327
|
+
throw _t;
|
|
328
|
+
case 14:
|
|
329
|
+
_context.p = 14;
|
|
330
|
+
if (generation === this.loadGeneration) this.controller.setLoading(false);
|
|
331
|
+
return _context.f(14);
|
|
332
|
+
case 15:
|
|
333
|
+
return _context.a(2);
|
|
270
334
|
}
|
|
271
|
-
}, _callee, this);
|
|
335
|
+
}, _callee, this, [[2, 12, 14, 15]]);
|
|
272
336
|
}));
|
|
273
337
|
function load(_x) {
|
|
274
338
|
return _load.apply(this, arguments);
|
|
@@ -279,6 +343,7 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
279
343
|
* 获取播放器是否处于暂停状态
|
|
280
344
|
* @returns 是否暂停中
|
|
281
345
|
*/
|
|
346
|
+
)
|
|
282
347
|
}, {
|
|
283
348
|
key: "paused",
|
|
284
349
|
get: function get() {
|
|
@@ -303,17 +368,19 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
303
368
|
}, {
|
|
304
369
|
key: "play",
|
|
305
370
|
value: function play(currentTime) {
|
|
306
|
-
var _this$controller$vreo;
|
|
371
|
+
var _this$controller$vide4, _this$controller$vreo;
|
|
372
|
+
var userAction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
373
|
+
if (this.disposed || !this.controller.playback.begin(userAction)) return false;
|
|
307
374
|
if (this.controller.playing) return true;
|
|
308
|
-
if (currentTime && this.controller.
|
|
309
|
-
this.controller.
|
|
375
|
+
if (currentTime && (_this$controller$vide4 = this.controller.videoAgentScene) !== null && _this$controller$vide4 !== void 0 && _this$controller$vide4.videoAgentMesh.mediaOperations) {
|
|
376
|
+
this.controller.videoAgentScene.videoAgentMesh.mediaOperations.currentTime = currentTime / 1000;
|
|
310
377
|
}
|
|
311
378
|
Object.assign(window, {
|
|
312
379
|
$vreoController: this.controller
|
|
313
380
|
});
|
|
314
381
|
this.controller.setEnded(false);
|
|
315
382
|
this.controller.setPlaying(true);
|
|
316
|
-
(_this$controller$vreo = this.controller.vreoUnit) === null || _this$controller$vreo === void 0
|
|
383
|
+
(_this$controller$vreo = this.controller.vreoUnit) === null || _this$controller$vreo === void 0 || _this$controller$vreo.keyframes.forEach(function (keyframe) {
|
|
317
384
|
if (keyframe.type === VreoKeyframeEnum.BgMusic) {
|
|
318
385
|
keyframe.parsed = false;
|
|
319
386
|
}
|
|
@@ -344,7 +411,9 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
344
411
|
}, {
|
|
345
412
|
key: "pause",
|
|
346
413
|
value: function pause() {
|
|
347
|
-
this.
|
|
414
|
+
++this.loadGeneration;
|
|
415
|
+
this.controller.playback.cancel();
|
|
416
|
+
this.controller.setLoading(false);
|
|
348
417
|
}
|
|
349
418
|
|
|
350
419
|
/**
|
|
@@ -383,13 +452,16 @@ export var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
383
452
|
}, {
|
|
384
453
|
key: "dispose",
|
|
385
454
|
value: function dispose() {
|
|
455
|
+
if (this.disposed) return;
|
|
456
|
+
this.disposed = true;
|
|
457
|
+
++this.loadGeneration;
|
|
458
|
+
this.disposers.forEach(function (dispose) {
|
|
459
|
+
return dispose();
|
|
460
|
+
});
|
|
386
461
|
this.controller.dispose();
|
|
387
|
-
|
|
388
|
-
ReactDOM.unmountComponentAtNode(this.configs.container);
|
|
389
|
-
}
|
|
462
|
+
this.root.unmount();
|
|
390
463
|
}
|
|
391
464
|
}]);
|
|
392
|
-
return Player;
|
|
393
465
|
}(Subscribe);
|
|
394
466
|
|
|
395
467
|
// 导出自定义组件
|
|
@@ -6,8 +6,7 @@ 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 () {
|
|
10
|
-
var _controller$drawerCon;
|
|
9
|
+
var height = function (_controller$drawerCon) {
|
|
11
10
|
var height = (_controller$drawerCon = controller.drawerConfig) === null || _controller$drawerCon === void 0 ? void 0 : _controller$drawerCon.height;
|
|
12
11
|
if (!height) {
|
|
13
12
|
return 'max-content';
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import type { PlaybackRun } from '../../PlaybackLifecycle';
|
|
2
|
+
import type { MediaOperations } from '../../playback-types';
|
|
1
3
|
import * as THREE from 'three';
|
|
2
4
|
import AudioLike from '../../../shared-utils/AudioLike';
|
|
3
5
|
/**
|
|
4
6
|
* 视频经纪人贴片的配置选项
|
|
5
7
|
*/
|
|
6
8
|
export interface VideoAgentMeshOptions {
|
|
9
|
+
getPlayback?: () => PlaybackRun | undefined;
|
|
7
10
|
/**
|
|
8
11
|
* 自定义视频实例。
|
|
9
12
|
*/
|
|
@@ -58,6 +61,13 @@ export declare class VideoAgentMesh extends THREE.Mesh {
|
|
|
58
61
|
/** 是否暂停状态 */
|
|
59
62
|
paused: boolean;
|
|
60
63
|
/** 音频实例 */
|
|
64
|
+
private outputs;
|
|
65
|
+
private operations;
|
|
66
|
+
private ownsVideo;
|
|
67
|
+
private ownsAudio;
|
|
68
|
+
private generation;
|
|
69
|
+
private removeStart?;
|
|
70
|
+
private objectURL?;
|
|
61
71
|
audioInstance: HTMLAudioElement;
|
|
62
72
|
/** AudioLike 实例 */
|
|
63
73
|
audioLikeInstance: AudioLike;
|
|
@@ -125,7 +135,9 @@ export declare class VideoAgentMesh extends THREE.Mesh {
|
|
|
125
135
|
* await mesh.play()
|
|
126
136
|
* ```
|
|
127
137
|
*/
|
|
128
|
-
play(videoUrl?: string, currentTime?: number, duration?: number): Promise<
|
|
138
|
+
play(videoUrl?: string, currentTime?: number, duration?: number): Promise<boolean>;
|
|
139
|
+
get mediaOperations(): MediaOperations | AudioLike | undefined;
|
|
140
|
+
stop(): void;
|
|
129
141
|
/**
|
|
130
142
|
* 获取当前播放时间(毫秒)
|
|
131
143
|
*
|