@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
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
## 2.6.4
|
|
4
|
+
|
|
5
|
+
- feat: 讲解支持应用侧 PlaybackManager,一段讲解共享播放任务,保留内部音轨混音。
|
|
6
|
+
- fix: 暂停、抢占和销毁同步停止成员媒体,取消延迟加载与关键帧,避免旧任务复播。
|
|
7
|
+
- chore: dnalogel peer/dev 依赖统一为正式版 3.81.10。
|
|
8
|
+
|
|
2
9
|
# 2.0.0
|
|
3
10
|
- fix: 重新实现了运镜功能,修复了运镜掉帧的问题
|
|
4
11
|
- break-change:修复了模型态切换全景态时的目标点位为0时,有可能不会真正移动到目标位置的问题。该问题的修复会导致之前的一些基于此bug制作的导览出现问题,需要重新制作。
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
-
|
|
3
|
-
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); }
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
3
|
var BLANK_AUDIO = '' + 'data:audio/mpeg;base64,' + '//uQxAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAADAAAGhgBVVVVVVVVVVVVVVVVVVVVVVVV' + 'VVVVVVVVVVVVVVVVVVVWqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr///////////' + '////////////////////////////////8AAAA5TEFNRTMuOThyAc0AAAAAAAAAABSAJAiqQgAAg' + 'AAABobxtI73AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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 -15,14 +14,19 @@ export function createHTMLAudioElement() {
|
|
|
15
14
|
audio.src = BLANK_AUDIO;
|
|
16
15
|
|
|
17
16
|
// 触发一次播放
|
|
18
|
-
Promise.resolve(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/
|
|
19
|
-
return
|
|
20
|
-
while (1)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
Promise.resolve( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
18
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
19
|
+
while (1) {
|
|
20
|
+
switch (_context.prev = _context.next) {
|
|
21
|
+
case 0:
|
|
22
|
+
_context.next = 2;
|
|
23
|
+
return audio.play();
|
|
24
|
+
case 2:
|
|
25
|
+
return _context.abrupt("return", _context.sent);
|
|
26
|
+
case 3:
|
|
27
|
+
case "end":
|
|
28
|
+
return _context.stop();
|
|
29
|
+
}
|
|
26
30
|
}
|
|
27
31
|
}, _callee);
|
|
28
32
|
})));
|
|
@@ -1,25 +1,27 @@
|
|
|
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
|
-
function
|
|
10
|
-
function
|
|
11
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
|
+
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); }; }
|
|
11
|
+
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; } }
|
|
12
12
|
import { Subscribe } from '@realsee/five';
|
|
13
13
|
import { requestAnimationFrameInterval } from "../shared-utils/animationFrame/index.js";
|
|
14
14
|
import { createHTMLAudioElement } from "./createHTMLAudioElement.js";
|
|
15
15
|
var closures = {};
|
|
16
16
|
export var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
17
|
+
_inherits(PlayController, _Subscribe);
|
|
18
|
+
var _super = _createSuper(PlayController);
|
|
17
19
|
function PlayController() {
|
|
18
20
|
var _this;
|
|
19
21
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
20
22
|
_classCallCheck(this, PlayController);
|
|
21
|
-
_this =
|
|
22
|
-
_defineProperty(_this, "config", {});
|
|
23
|
+
_this = _super.call(this);
|
|
24
|
+
_defineProperty(_assertThisInitialized(_this), "config", {});
|
|
23
25
|
if (!config.audio) {
|
|
24
26
|
config.audio = createHTMLAudioElement();
|
|
25
27
|
}
|
|
@@ -63,8 +65,7 @@ export var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
63
65
|
/**
|
|
64
66
|
* 载入数据
|
|
65
67
|
*/
|
|
66
|
-
|
|
67
|
-
return _createClass(PlayController, [{
|
|
68
|
+
_createClass(PlayController, [{
|
|
68
69
|
key: "paused",
|
|
69
70
|
get: function get() {
|
|
70
71
|
return this.audioInstance.paused;
|
|
@@ -103,35 +104,40 @@ export var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
103
104
|
}
|
|
104
105
|
}, {
|
|
105
106
|
key: "load",
|
|
106
|
-
value:
|
|
107
|
-
var _load = _asyncToGenerator(/*#__PURE__*/
|
|
107
|
+
value: function () {
|
|
108
|
+
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(vreoUnit) {
|
|
108
109
|
var _this3 = this;
|
|
109
|
-
return
|
|
110
|
-
while (1)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
110
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
111
|
+
while (1) {
|
|
112
|
+
switch (_context.prev = _context.next) {
|
|
113
|
+
case 0:
|
|
114
|
+
this.vreoUnit = vreoUnit;
|
|
115
|
+
_context.next = 3;
|
|
116
|
+
return this.pause();
|
|
117
|
+
case 3:
|
|
118
|
+
_context.next = 5;
|
|
119
|
+
return new Promise(function (resolve, reject) {
|
|
120
|
+
if (vreoUnit.video.url === _this3.audioInstance.src) {
|
|
121
|
+
return resolve(true);
|
|
122
|
+
}
|
|
123
|
+
_this3.audioInstance.src = vreoUnit.video.url;
|
|
124
|
+
var canplaythrough = function canplaythrough() {
|
|
125
|
+
resolve(true);
|
|
126
|
+
_this3.audioInstance.removeEventListener('canplaythrough', canplaythrough);
|
|
127
|
+
};
|
|
128
|
+
var error = function error(err) {
|
|
129
|
+
reject(err);
|
|
130
|
+
_this3.audioInstance.removeEventListener('error', error);
|
|
131
|
+
};
|
|
132
|
+
_this3.audioInstance.addEventListener('canplaythrough', canplaythrough);
|
|
133
|
+
_this3.audioInstance.addEventListener('error', error);
|
|
134
|
+
});
|
|
135
|
+
case 5:
|
|
136
|
+
return _context.abrupt("return", _context.sent);
|
|
137
|
+
case 6:
|
|
138
|
+
case "end":
|
|
139
|
+
return _context.stop();
|
|
140
|
+
}
|
|
135
141
|
}
|
|
136
142
|
}, _callee, this);
|
|
137
143
|
}));
|
|
@@ -143,17 +149,19 @@ export var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
143
149
|
/**
|
|
144
150
|
* 播放
|
|
145
151
|
*/
|
|
146
|
-
)
|
|
147
152
|
}, {
|
|
148
153
|
key: "play",
|
|
149
|
-
value:
|
|
150
|
-
var _play = _asyncToGenerator(/*#__PURE__*/
|
|
151
|
-
return
|
|
152
|
-
while (1)
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
value: function () {
|
|
155
|
+
var _play = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
156
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
157
|
+
while (1) {
|
|
158
|
+
switch (_context2.prev = _context2.next) {
|
|
159
|
+
case 0:
|
|
160
|
+
closures.playPromise = this.audioInstance.play();
|
|
161
|
+
case 1:
|
|
162
|
+
case "end":
|
|
163
|
+
return _context2.stop();
|
|
164
|
+
}
|
|
157
165
|
}
|
|
158
166
|
}, _callee2, this);
|
|
159
167
|
}));
|
|
@@ -165,24 +173,26 @@ export var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
165
173
|
/**
|
|
166
174
|
* 暂停
|
|
167
175
|
*/
|
|
168
|
-
)
|
|
169
176
|
}, {
|
|
170
177
|
key: "pause",
|
|
171
|
-
value:
|
|
172
|
-
var _pause = _asyncToGenerator(/*#__PURE__*/
|
|
173
|
-
return
|
|
174
|
-
while (1)
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
178
|
+
value: function () {
|
|
179
|
+
var _pause = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
180
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
181
|
+
while (1) {
|
|
182
|
+
switch (_context3.prev = _context3.next) {
|
|
183
|
+
case 0:
|
|
184
|
+
if (!closures.playPromise) {
|
|
185
|
+
_context3.next = 3;
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
_context3.next = 3;
|
|
189
|
+
return closures.playPromise;
|
|
190
|
+
case 3:
|
|
191
|
+
this.audioInstance.pause();
|
|
192
|
+
case 4:
|
|
193
|
+
case "end":
|
|
194
|
+
return _context3.stop();
|
|
195
|
+
}
|
|
186
196
|
}
|
|
187
197
|
}, _callee3, this);
|
|
188
198
|
}));
|
|
@@ -197,7 +207,6 @@ export var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
197
207
|
*
|
|
198
208
|
* @deprecated **慎重执行**
|
|
199
209
|
*/
|
|
200
|
-
)
|
|
201
210
|
}, {
|
|
202
211
|
key: "dispose",
|
|
203
212
|
value: function dispose() {
|
|
@@ -210,4 +219,5 @@ export var PlayController = /*#__PURE__*/function (_Subscribe) {
|
|
|
210
219
|
}
|
|
211
220
|
}
|
|
212
221
|
}]);
|
|
222
|
+
return PlayController;
|
|
213
223
|
}(Subscribe);
|
package/lib/Player/Controller.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
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
|
-
function ownKeys(
|
|
9
|
-
function _objectSpread(
|
|
10
|
-
function
|
|
11
|
-
function _isNativeReflectConstruct() {
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
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; } }
|
|
12
13
|
import { PlaybackLifecycle } from "./PlaybackLifecycle.js";
|
|
13
14
|
import { Subscribe } from '@realsee/five';
|
|
14
15
|
import { action, makeObservable, observable, reaction } from 'mobx';
|
|
@@ -42,49 +43,39 @@ import { getMediaType } from "../shared-utils/getMediaInfo.js";
|
|
|
42
43
|
* ```
|
|
43
44
|
*/
|
|
44
45
|
export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
46
|
+
_inherits(Controller, _Subscribe);
|
|
47
|
+
var _super = _createSuper(Controller);
|
|
45
48
|
function Controller(_ref) {
|
|
46
49
|
var _this;
|
|
47
50
|
var five = _ref.five,
|
|
48
51
|
container = _ref.container,
|
|
49
52
|
configs = _ref.configs;
|
|
50
53
|
_classCallCheck(this, Controller);
|
|
51
|
-
_this =
|
|
52
|
-
_defineProperty(_this, "playing", false);
|
|
53
|
-
_defineProperty(_this, "ended", false);
|
|
54
|
-
_defineProperty(_this, "loading", false);
|
|
55
|
-
|
|
56
|
-
_defineProperty(_this, "containerSize", {
|
|
54
|
+
_this = _super.call(this);
|
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "playing", false);
|
|
56
|
+
_defineProperty(_assertThisInitialized(_this), "ended", false);
|
|
57
|
+
_defineProperty(_assertThisInitialized(_this), "loading", false);
|
|
58
|
+
_defineProperty(_assertThisInitialized(_this), "containerSize", {
|
|
57
59
|
width: 0,
|
|
58
60
|
height: 0
|
|
59
61
|
});
|
|
60
|
-
_defineProperty(_this, "waveAppearance", null);
|
|
61
|
-
_defineProperty(_this, "appearance", {
|
|
62
|
+
_defineProperty(_assertThisInitialized(_this), "waveAppearance", null);
|
|
63
|
+
_defineProperty(_assertThisInitialized(_this), "appearance", {
|
|
62
64
|
waveStyle: 'wave'
|
|
63
65
|
});
|
|
64
|
-
_defineProperty(_this, "avatar", {});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
_defineProperty(_this, "
|
|
70
|
-
_defineProperty(_this, "
|
|
71
|
-
_defineProperty(_this, "popUp", null);
|
|
72
|
-
_defineProperty(_this, "drawerConfig", null);
|
|
73
|
-
/**
|
|
74
|
-
* 创建 Controller 实例
|
|
75
|
-
* @param params - 构造参数对象
|
|
76
|
-
* @param params.five - Five 渲染引擎实例
|
|
77
|
-
* @param params.container - DOM 容器元素
|
|
78
|
-
* @param params.configs - 播放器配置
|
|
79
|
-
*/
|
|
80
|
-
_defineProperty(_this, "resumeGeneration", 0);
|
|
81
|
-
_defineProperty(_this, "disposers", []);
|
|
66
|
+
_defineProperty(_assertThisInitialized(_this), "avatar", {});
|
|
67
|
+
_defineProperty(_assertThisInitialized(_this), "waitingForBgMusic", false);
|
|
68
|
+
_defineProperty(_assertThisInitialized(_this), "visible", false);
|
|
69
|
+
_defineProperty(_assertThisInitialized(_this), "popUp", null);
|
|
70
|
+
_defineProperty(_assertThisInitialized(_this), "drawerConfig", null);
|
|
71
|
+
_defineProperty(_assertThisInitialized(_this), "resumeGeneration", 0);
|
|
72
|
+
_defineProperty(_assertThisInitialized(_this), "disposers", []);
|
|
82
73
|
_this.playback = new PlaybackLifecycle(configs.mediaManager, function () {
|
|
83
74
|
var _this$videoAgentScene;
|
|
84
75
|
_this.resuming = undefined;
|
|
85
76
|
++_this.resumeGeneration;
|
|
86
77
|
_this.setPlaying(false);
|
|
87
|
-
(_this$videoAgentScene = _this.videoAgentScene) === null || _this$videoAgentScene === void 0
|
|
78
|
+
(_this$videoAgentScene = _this.videoAgentScene) === null || _this$videoAgentScene === void 0 ? void 0 : _this$videoAgentScene.videoAgentMesh.stop();
|
|
88
79
|
_this.setWaitingForBgMusic(false);
|
|
89
80
|
});
|
|
90
81
|
_this.configs = configs;
|
|
@@ -92,7 +83,7 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
92
83
|
_this.five = five;
|
|
93
84
|
_this.appSize = configs.appSize;
|
|
94
85
|
_this.appearance = _objectSpread(_objectSpread({}, _this.appearance), configs.appearance);
|
|
95
|
-
makeObservable(_this, {
|
|
86
|
+
makeObservable(_assertThisInitialized(_this), {
|
|
96
87
|
visible: observable,
|
|
97
88
|
setVisible: action,
|
|
98
89
|
playing: observable,
|
|
@@ -203,10 +194,16 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
203
194
|
* 获取播放器是否准备就绪
|
|
204
195
|
* @returns 是否有可用的视频代理场景
|
|
205
196
|
*/
|
|
206
|
-
|
|
207
|
-
return _createClass(Controller, [{
|
|
197
|
+
_createClass(Controller, [{
|
|
208
198
|
key: "agentType",
|
|
209
199
|
get:
|
|
200
|
+
// null 表示加载失败
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* 是否正在等待背景音乐加载
|
|
204
|
+
* 当此状态为 true 时,播放流程会暂停,等待音频加载完成
|
|
205
|
+
*/
|
|
206
|
+
|
|
210
207
|
/**
|
|
211
208
|
* 获取当前播放媒体的类型
|
|
212
209
|
* @returns 'video' | 'avatar' | 'none' - 媒体类型
|
|
@@ -336,6 +333,14 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
336
333
|
}
|
|
337
334
|
this.drawerConfig = drawerConfig;
|
|
338
335
|
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* 创建 Controller 实例
|
|
339
|
+
* @param params - 构造参数对象
|
|
340
|
+
* @param params.five - Five 渲染引擎实例
|
|
341
|
+
* @param params.container - DOM 容器元素
|
|
342
|
+
* @param params.configs - 播放器配置
|
|
343
|
+
*/
|
|
339
344
|
}, {
|
|
340
345
|
key: "ready",
|
|
341
346
|
get: function get() {
|
|
@@ -403,19 +408,19 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
403
408
|
if (this.waitingForBgMusic) {
|
|
404
409
|
var _this$mediaInstance;
|
|
405
410
|
if (!((_this$mediaInstance = this.mediaInstance) !== null && _this$mediaInstance !== void 0 && _this$mediaInstance.paused)) {
|
|
406
|
-
var _this$videoAgentScene5;
|
|
407
|
-
(_this$videoAgentScene5 = this.videoAgentScene) === null || _this$videoAgentScene5 === void 0
|
|
411
|
+
var _this$videoAgentScene5, _this$videoAgentScene6;
|
|
412
|
+
(_this$videoAgentScene5 = this.videoAgentScene) === null || _this$videoAgentScene5 === void 0 ? void 0 : (_this$videoAgentScene6 = _this$videoAgentScene5.videoAgentMesh.mediaOperations) === null || _this$videoAgentScene6 === void 0 ? void 0 : _this$videoAgentScene6.pause();
|
|
408
413
|
}
|
|
409
414
|
return;
|
|
410
415
|
}
|
|
411
416
|
if ((_this$mediaInstance2 = this.mediaInstance) !== null && _this$mediaInstance2 !== void 0 && _this$mediaInstance2.ended && this.mediaInstance.currentTime !== 0) {
|
|
412
|
-
var _this$vreoUnit, _this$
|
|
417
|
+
var _this$vreoUnit, _this$videoAgentScene7;
|
|
413
418
|
if (this.ended) return;
|
|
414
|
-
(_this$vreoUnit = this.vreoUnit) === null || _this$vreoUnit === void 0
|
|
419
|
+
(_this$vreoUnit = this.vreoUnit) === null || _this$vreoUnit === void 0 ? void 0 : _this$vreoUnit.keyframes.forEach(function (keyframe) {
|
|
415
420
|
return keyframe.parsed = false;
|
|
416
421
|
});
|
|
417
|
-
var media = (_this$
|
|
418
|
-
media === null || media === void 0
|
|
422
|
+
var media = (_this$videoAgentScene7 = this.videoAgentScene) === null || _this$videoAgentScene7 === void 0 ? void 0 : _this$videoAgentScene7.videoAgentMesh.mediaOperations;
|
|
423
|
+
media === null || media === void 0 ? void 0 : media.pause();
|
|
419
424
|
if (media) media.currentTime = 0;
|
|
420
425
|
this.playback.finish();
|
|
421
426
|
this.setEnded(true);
|
|
@@ -425,8 +430,8 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
425
430
|
if (!this.playing) {
|
|
426
431
|
var _this$mediaInstance3;
|
|
427
432
|
if (!((_this$mediaInstance3 = this.mediaInstance) !== null && _this$mediaInstance3 !== void 0 && _this$mediaInstance3.paused)) {
|
|
428
|
-
var _this$
|
|
429
|
-
(_this$
|
|
433
|
+
var _this$videoAgentScene8, _this$videoAgentScene9;
|
|
434
|
+
(_this$videoAgentScene8 = this.videoAgentScene) === null || _this$videoAgentScene8 === void 0 ? void 0 : (_this$videoAgentScene9 = _this$videoAgentScene8.videoAgentMesh.mediaOperations) === null || _this$videoAgentScene9 === void 0 ? void 0 : _this$videoAgentScene9.pause();
|
|
430
435
|
}
|
|
431
436
|
return;
|
|
432
437
|
}
|
|
@@ -449,14 +454,14 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
449
454
|
_this4 = this;
|
|
450
455
|
if (this.waitingForBgMusic) return;
|
|
451
456
|
if ((_this$mediaInstance4 = this.mediaInstance) !== null && _this$mediaInstance4 !== void 0 && _this$mediaInstance4.paused && this.playing && !this.resuming) {
|
|
452
|
-
var _this$
|
|
457
|
+
var _this$videoAgentScene10;
|
|
453
458
|
var attempt = ++this.resumeGeneration;
|
|
454
459
|
this.resuming = attempt;
|
|
455
460
|
var run = this.playback.capture();
|
|
456
461
|
var valid = function valid() {
|
|
457
462
|
return !!(run !== null && run !== void 0 && run.valid());
|
|
458
463
|
};
|
|
459
|
-
void ((_this$
|
|
464
|
+
void ((_this$videoAgentScene10 = this.videoAgentScene) === null || _this$videoAgentScene10 === void 0 ? void 0 : _this$videoAgentScene10.videoAgentMesh.play().catch(function (error) {
|
|
460
465
|
if (valid()) {
|
|
461
466
|
_this4.playback.cancel();
|
|
462
467
|
console.error(error);
|
|
@@ -493,7 +498,7 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
493
498
|
value: function clear() {
|
|
494
499
|
var _this$vreoUnit2, _this$stopInterval;
|
|
495
500
|
this.setPlaying(false);
|
|
496
|
-
(_this$vreoUnit2 = this.vreoUnit) === null || _this$vreoUnit2 === void 0
|
|
501
|
+
(_this$vreoUnit2 = this.vreoUnit) === null || _this$vreoUnit2 === void 0 ? void 0 : _this$vreoUnit2.keyframes.forEach(function (keyframe) {
|
|
497
502
|
return keyframe.parsed = false;
|
|
498
503
|
});
|
|
499
504
|
|
|
@@ -502,11 +507,11 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
502
507
|
*/
|
|
503
508
|
this.vreoUnit = undefined;
|
|
504
509
|
if (this.mediaInstance) {
|
|
505
|
-
var _this$
|
|
506
|
-
(_this$
|
|
507
|
-
if ((_this$
|
|
510
|
+
var _this$videoAgentScene11, _this$videoAgentScene12, _this$videoAgentScene13;
|
|
511
|
+
(_this$videoAgentScene11 = this.videoAgentScene) === null || _this$videoAgentScene11 === void 0 ? void 0 : (_this$videoAgentScene12 = _this$videoAgentScene11.videoAgentMesh.mediaOperations) === null || _this$videoAgentScene12 === void 0 ? void 0 : _this$videoAgentScene12.pause();
|
|
512
|
+
if ((_this$videoAgentScene13 = this.videoAgentScene) !== null && _this$videoAgentScene13 !== void 0 && _this$videoAgentScene13.videoAgentMesh.mediaOperations) this.videoAgentScene.videoAgentMesh.mediaOperations.currentTime = 0;
|
|
508
513
|
}
|
|
509
|
-
(_this$stopInterval = this.stopInterval) === null || _this$stopInterval === void 0
|
|
514
|
+
(_this$stopInterval = this.stopInterval) === null || _this$stopInterval === void 0 ? void 0 : _this$stopInterval.call(this);
|
|
510
515
|
this.stopInterval = undefined;
|
|
511
516
|
}
|
|
512
517
|
|
|
@@ -525,6 +530,7 @@ export var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
525
530
|
this.clear();
|
|
526
531
|
}
|
|
527
532
|
}]);
|
|
533
|
+
return Controller;
|
|
528
534
|
}(Subscribe);
|
|
529
535
|
var ControllerContext = /*#__PURE__*/React.createContext(null);
|
|
530
536
|
export { ControllerContext };
|
|
@@ -18,7 +18,7 @@ export var PlaybackLifecycle = /*#__PURE__*/function () {
|
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
_createClass(PlaybackLifecycle, [{
|
|
22
22
|
key: "active",
|
|
23
23
|
get: function get() {
|
|
24
24
|
var _this$run;
|
|
@@ -77,9 +77,9 @@ export var PlaybackLifecycle = /*#__PURE__*/function () {
|
|
|
77
77
|
errors.push(error);
|
|
78
78
|
}
|
|
79
79
|
for (var _i = 0, _arr = _toConsumableArray(this.members); _i < _arr.length; _i++) {
|
|
80
|
-
var
|
|
80
|
+
var stop = _arr[_i];
|
|
81
81
|
try {
|
|
82
|
-
|
|
82
|
+
stop();
|
|
83
83
|
} catch (error) {
|
|
84
84
|
errors.push(error);
|
|
85
85
|
}
|
|
@@ -91,7 +91,7 @@ export var PlaybackLifecycle = /*#__PURE__*/function () {
|
|
|
91
91
|
value: function cancel() {
|
|
92
92
|
var _this$controller2;
|
|
93
93
|
var generation = this.generation;
|
|
94
|
-
(_this$controller2 = this.controller) === null || _this$controller2 === void 0
|
|
94
|
+
(_this$controller2 = this.controller) === null || _this$controller2 === void 0 ? void 0 : _this$controller2.cancel();
|
|
95
95
|
if (generation === this.generation) this.stop();
|
|
96
96
|
}
|
|
97
97
|
}, {
|
|
@@ -100,7 +100,7 @@ export var PlaybackLifecycle = /*#__PURE__*/function () {
|
|
|
100
100
|
var _this$run2;
|
|
101
101
|
var session = (_this$run2 = this.run) === null || _this$run2 === void 0 ? void 0 : _this$run2.session;
|
|
102
102
|
this.stop();
|
|
103
|
-
session === null || session === void 0
|
|
103
|
+
session === null || session === void 0 ? void 0 : session.finish();
|
|
104
104
|
}
|
|
105
105
|
}, {
|
|
106
106
|
key: "dispose",
|
|
@@ -109,9 +109,10 @@ export var PlaybackLifecycle = /*#__PURE__*/function () {
|
|
|
109
109
|
if (this.disposed) return;
|
|
110
110
|
this.disposed = true;
|
|
111
111
|
var generation = this.generation;
|
|
112
|
-
(_this$controller3 = this.controller) === null || _this$controller3 === void 0
|
|
112
|
+
(_this$controller3 = this.controller) === null || _this$controller3 === void 0 ? void 0 : _this$controller3.dispose();
|
|
113
113
|
if (generation === this.generation) this.stop();
|
|
114
114
|
this.members.clear();
|
|
115
115
|
}
|
|
116
116
|
}]);
|
|
117
|
+
return PlaybackLifecycle;
|
|
117
118
|
}();
|