@realsee/vreo 1.0.0-alpha.1 → 1.0.0-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/docs/assets/search.js +1 -1
- package/docs/classes/Player.AudioLike.html +6 -6
- package/docs/classes/Player.Controller.html +12 -12
- package/docs/classes/Player.Player-1.html +11 -11
- package/docs/classes/Player.VideoAgentMesh.html +12 -12
- package/docs/classes/Player.VideoAgentScene.html +1 -1
- package/docs/demo/assets/{AppReact.d0ee843a.js → AppReact.39bef668.js} +1 -1
- package/docs/demo/assets/{default.63925584.js → default.9bbb3329.js} +1 -1
- package/docs/demo/assets/{dynamic.76506c2c.js → dynamic.5e9275ce.js} +1 -1
- package/docs/demo/assets/{examples.3d8323db.js → examples.2ac45f33.js} +1 -1
- package/docs/demo/assets/{index.7e31122c.js → index.6699bd11.js} +1 -1
- package/docs/demo/assets/{main.79b11b9d.js → main.a0741cbc.js} +1 -1
- package/docs/demo/assets/{react.c1c07c14.js → react.a3f20ea9.js} +1 -1
- package/docs/demo/examples.html +2 -2
- package/docs/demo/index-react-dynamic.html +4 -4
- package/docs/demo/index-react.html +4 -4
- package/docs/demo/index.html +3 -3
- package/docs/enums/Player.InfoPanelStyleEnum.html +1 -1
- package/docs/enums/Player.InfoPanelTypeEnum.html +1 -1
- package/docs/enums/Player.PanoEffectEnum.html +1 -1
- package/docs/enums/Player.PanoTagEnum.html +1 -1
- package/docs/enums/Player.PanoTagStyleEnum.html +2 -2
- package/docs/enums/Player.VreoKeyframeEnum.html +12 -12
- package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -1
- package/docs/enums/fivePlugins.Rotation.html +1 -1
- package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -1
- package/docs/interfaces/Player.PlayerConfigs.html +4 -3
- package/docs/interfaces/Player.Vertex.html +1 -1
- package/docs/interfaces/Player.VideoAgentMeshOptions.html +3 -3
- package/docs/interfaces/Player.VreoKeyframe.html +1 -1
- package/docs/interfaces/Player.VreoUnit.html +1 -1
- package/docs/interfaces/Player.VreoVideo.html +1 -1
- package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +2 -2
- package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +1 -1
- package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +2 -2
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginData.html +1 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginExportType.html +1 -1
- package/docs/interfaces/fivePlugins.ModelTVVideoPluginParameterType.html +1 -1
- package/docs/interfaces/fivePlugins.Vector3Position.html +1 -1
- package/docs/interfaces/react.VreoActionCallbacks.html +6 -6
- package/docs/interfaces/react.VreoProviderProps.html +1 -1
- package/docs/modules/Player.html +16 -16
- package/docs/modules/custom.html +1 -1
- package/docs/modules/fivePlugins.html +3 -3
- package/docs/modules/react.html +1 -1
- package/lib/PlayController/index.js +1 -2
- package/lib/Player/App.js +8 -6
- package/lib/Player/Controller.d.ts +27 -8
- package/lib/Player/Controller.js +172 -23
- package/lib/Player/custom/SpatialScenePanel/index.js +2 -1
- package/lib/Player/hooks.js +2 -2
- package/lib/Player/index.d.ts +2 -1
- package/lib/Player/index.js +42 -29
- package/lib/Player/modules/ResizeObserver/index.d.ts +2 -0
- package/lib/Player/modules/ResizeObserver/index.js +37 -0
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +1 -1
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +44 -43
- package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +3 -7
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +25 -34
- package/lib/Player/modules/VideoAgent/index.js +52 -11
- package/lib/Player/modules/Wave/index.d.ts +5 -0
- package/lib/Player/modules/Wave/index.js +51 -0
- package/lib/Player/modules/keyframes/InfoPanel/index.js +20 -8
- package/lib/Player/modules/keyframes/PanoTag/index.d.ts +1 -2
- package/lib/Player/modules/keyframes/PanoTag/index.js +78 -131
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +0 -1
- package/lib/Player/modules/keyframes/Prompter/index.js +5 -4
- package/lib/Player/typings.d.ts +9 -2
- package/lib/fivePlugins/CameraMovementPlugin/index.js +2 -5
- package/lib/react/index.d.ts +2 -2
- package/lib/shared-utils/AduioLike.js +8 -7
- package/lib/shared-utils/addResizeListener.d.ts +4 -0
- package/lib/shared-utils/addResizeListener.js +51 -0
- package/lib/shared-utils/getFileExpandedName.d.ts +1 -0
- package/lib/shared-utils/getFileExpandedName.js +13 -0
- package/lib/shared-utils/getMediaInfo.d.ts +9 -0
- package/lib/shared-utils/getMediaInfo.js +75 -0
- package/lib/shared-utils/setElementDataset.d.ts +1 -0
- package/lib/shared-utils/setElementDataset.js +24 -0
- package/lib/typings/VreoUnit.d.ts +4 -0
- package/package.json +1 -1
- package/resources/Player/Controller.ts +1 -1
- package/resources/typings/VreoUnit.ts +1 -1
package/lib/Player/Controller.js
CHANGED
|
@@ -15,10 +15,32 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
15
15
|
|
|
16
16
|
var _animationFrame = require("../shared-utils/animationFrame");
|
|
17
17
|
|
|
18
|
+
var _setElementDataset = _interopRequireDefault(require("../shared-utils/setElementDataset"));
|
|
19
|
+
|
|
20
|
+
var _getMediaInfo = require("../shared-utils/getMediaInfo");
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
|
+
|
|
18
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
25
|
|
|
20
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
27
|
|
|
28
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
29
|
+
|
|
30
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
31
|
+
|
|
32
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
33
|
+
|
|
34
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
35
|
+
|
|
36
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
37
|
+
|
|
38
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
39
|
+
|
|
40
|
+
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; }
|
|
41
|
+
|
|
42
|
+
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; }
|
|
43
|
+
|
|
22
44
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
23
45
|
|
|
24
46
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -49,9 +71,13 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
49
71
|
|
|
50
72
|
var _super = _createSuper(Controller);
|
|
51
73
|
|
|
52
|
-
function Controller() {
|
|
74
|
+
function Controller(_ref) {
|
|
53
75
|
var _this;
|
|
54
76
|
|
|
77
|
+
var five = _ref.five,
|
|
78
|
+
container = _ref.container,
|
|
79
|
+
configs = _ref.configs;
|
|
80
|
+
|
|
55
81
|
_classCallCheck(this, Controller);
|
|
56
82
|
|
|
57
83
|
_this = _super.call(this);
|
|
@@ -60,24 +86,121 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
60
86
|
|
|
61
87
|
_defineProperty(_assertThisInitialized(_this), "ended", false);
|
|
62
88
|
|
|
89
|
+
_defineProperty(_assertThisInitialized(_this), "loading", false);
|
|
90
|
+
|
|
91
|
+
_defineProperty(_assertThisInitialized(_this), "waveAppearance", null);
|
|
92
|
+
|
|
93
|
+
_defineProperty(_assertThisInitialized(_this), "appearance", {
|
|
94
|
+
waveStyle: 'solid'
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
_defineProperty(_assertThisInitialized(_this), "avatar", {});
|
|
98
|
+
|
|
63
99
|
_defineProperty(_assertThisInitialized(_this), "visible", false);
|
|
64
100
|
|
|
65
101
|
_defineProperty(_assertThisInitialized(_this), "popUp", null);
|
|
66
102
|
|
|
67
103
|
_defineProperty(_assertThisInitialized(_this), "drawerConfig", null);
|
|
68
104
|
|
|
105
|
+
_this.configs = configs;
|
|
106
|
+
_this.container = container;
|
|
107
|
+
_this.five = five;
|
|
108
|
+
_this.appSize = configs.appSize;
|
|
109
|
+
_this.appearance = _objectSpread(_objectSpread({}, _this.appearance), configs.appearance);
|
|
69
110
|
(0, _mobx.makeObservable)(_assertThisInitialized(_this), {
|
|
70
111
|
visible: _mobx.observable,
|
|
71
112
|
setVisible: _mobx.action,
|
|
72
113
|
playing: _mobx.observable,
|
|
73
114
|
setPlaying: _mobx.action,
|
|
115
|
+
loading: _mobx.observable,
|
|
116
|
+
setLoading: _mobx.action,
|
|
74
117
|
popUp: _mobx.observable.ref,
|
|
75
118
|
openPopUp: _mobx.action,
|
|
76
119
|
drawerConfig: _mobx.observable.ref,
|
|
77
120
|
openDrawer: _mobx.action,
|
|
78
121
|
ended: _mobx.observable,
|
|
79
|
-
|
|
80
|
-
|
|
122
|
+
waveAppearance: _mobx.observable,
|
|
123
|
+
avatar: _mobx.observable,
|
|
124
|
+
containerSize: _mobx.observable,
|
|
125
|
+
setContainerSize: _mobx.action,
|
|
126
|
+
appearance: _mobx.observable,
|
|
127
|
+
setAppearance: _mobx.action,
|
|
128
|
+
configs: _mobx.observable.ref,
|
|
129
|
+
setEnded: _mobx.action,
|
|
130
|
+
setAvatar: _mobx.action
|
|
131
|
+
});
|
|
132
|
+
(0, _mobx.reaction)(function () {
|
|
133
|
+
return [_this.appearance.waveStyle, _this.loading];
|
|
134
|
+
}, function (_ref2) {
|
|
135
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
136
|
+
waveStyle = _ref3[0],
|
|
137
|
+
loading = _ref3[1];
|
|
138
|
+
|
|
139
|
+
if (loading === null) {
|
|
140
|
+
_this.waveAppearance = null;
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (waveStyle === 'wave') {
|
|
145
|
+
switch (loading) {
|
|
146
|
+
case true:
|
|
147
|
+
_this.waveAppearance = 'double';
|
|
148
|
+
break;
|
|
149
|
+
|
|
150
|
+
case false:
|
|
151
|
+
_this.waveAppearance = 'solid';
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
} else if (waveStyle === 'solid') {
|
|
155
|
+
switch (loading) {
|
|
156
|
+
case true:
|
|
157
|
+
_this.waveAppearance = 'swap';
|
|
158
|
+
break;
|
|
159
|
+
|
|
160
|
+
case false:
|
|
161
|
+
_this.waveAppearance = 'expand';
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}, {
|
|
166
|
+
fireImmediately: true
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
if (!_this.appSize) {
|
|
170
|
+
(0, _mobx.reaction)(function () {
|
|
171
|
+
return _this.containerSize;
|
|
172
|
+
}, function (containerSize) {
|
|
173
|
+
if (!containerSize) return;
|
|
174
|
+
var width = containerSize.width;
|
|
175
|
+
var height = containerSize.height;
|
|
176
|
+
|
|
177
|
+
var size = function () {
|
|
178
|
+
if (width <= 500) return 'S';
|
|
179
|
+
if (width <= 1024) return 'M';
|
|
180
|
+
if (width <= 2048) return 'L';
|
|
181
|
+
return 'XL';
|
|
182
|
+
}();
|
|
183
|
+
|
|
184
|
+
var orientation = function () {
|
|
185
|
+
if (height > width) return 'portrait';
|
|
186
|
+
return 'landscape';
|
|
187
|
+
}();
|
|
188
|
+
|
|
189
|
+
(0, _setElementDataset["default"])(_this.container, {
|
|
190
|
+
size: size
|
|
191
|
+
});
|
|
192
|
+
(0, _setElementDataset["default"])(_this.container, {
|
|
193
|
+
orientation: orientation
|
|
194
|
+
});
|
|
195
|
+
}, {
|
|
196
|
+
fireImmediately: true
|
|
197
|
+
});
|
|
198
|
+
} else {
|
|
199
|
+
(0, _setElementDataset["default"])(_this.container, {
|
|
200
|
+
size: _this.appSize
|
|
201
|
+
});
|
|
202
|
+
} // 监听播放情况:抛出触发时机
|
|
203
|
+
|
|
81
204
|
|
|
82
205
|
(0, _mobx.reaction)(function () {
|
|
83
206
|
return _this.ended;
|
|
@@ -97,11 +220,14 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
97
220
|
}
|
|
98
221
|
|
|
99
222
|
_createClass(Controller, [{
|
|
100
|
-
key: "
|
|
223
|
+
key: "agentType",
|
|
101
224
|
get: function get() {
|
|
102
|
-
var _this$videoAgentScene, _this$
|
|
225
|
+
var _this$videoAgentScene, _this$avatar;
|
|
103
226
|
|
|
104
|
-
|
|
227
|
+
var type = (0, _getMediaInfo.getMediaType)((_this$videoAgentScene = this.videoAgentScene) === null || _this$videoAgentScene === void 0 ? void 0 : _this$videoAgentScene.videoAgentMesh.videoUrl);
|
|
228
|
+
if ((_this$avatar = this.avatar) !== null && _this$avatar !== void 0 && _this$avatar.force) return 'avatar';
|
|
229
|
+
if (type === 'video') return 'video';
|
|
230
|
+
return 'none';
|
|
105
231
|
}
|
|
106
232
|
}, {
|
|
107
233
|
key: "openPopUp",
|
|
@@ -113,6 +239,24 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
113
239
|
|
|
114
240
|
this.popUp = popUp;
|
|
115
241
|
}
|
|
242
|
+
}, {
|
|
243
|
+
key: "setLoading",
|
|
244
|
+
value: function setLoading(loading) {
|
|
245
|
+
this.loading = loading;
|
|
246
|
+
}
|
|
247
|
+
}, {
|
|
248
|
+
key: "setAvatar",
|
|
249
|
+
value: function setAvatar(avatar) {
|
|
250
|
+
this.avatar = avatar;
|
|
251
|
+
}
|
|
252
|
+
}, {
|
|
253
|
+
key: "setContainerSize",
|
|
254
|
+
value: function setContainerSize(width, height) {
|
|
255
|
+
this.containerSize = {
|
|
256
|
+
width: width,
|
|
257
|
+
height: height
|
|
258
|
+
};
|
|
259
|
+
}
|
|
116
260
|
}, {
|
|
117
261
|
key: "setVisible",
|
|
118
262
|
value: function setVisible(v) {
|
|
@@ -128,6 +272,11 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
128
272
|
value: function setEnded(ended) {
|
|
129
273
|
this.ended = ended;
|
|
130
274
|
}
|
|
275
|
+
}, {
|
|
276
|
+
key: "setAppearance",
|
|
277
|
+
value: function setAppearance(appearance) {
|
|
278
|
+
this.appearance = _objectSpread(_objectSpread({}, this.appearance), appearance);
|
|
279
|
+
}
|
|
131
280
|
}, {
|
|
132
281
|
key: "openDrawer",
|
|
133
282
|
value: function openDrawer(drawerConfig) {
|
|
@@ -151,9 +300,9 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
151
300
|
}, {
|
|
152
301
|
key: "currentTime",
|
|
153
302
|
get: function get() {
|
|
154
|
-
var _this$
|
|
303
|
+
var _this$videoAgentScene2;
|
|
155
304
|
|
|
156
|
-
return ((_this$
|
|
305
|
+
return ((_this$videoAgentScene2 = this.videoAgentScene) === null || _this$videoAgentScene2 === void 0 ? void 0 : _this$videoAgentScene2.videoAgentMesh.currentTime) || 0;
|
|
157
306
|
}
|
|
158
307
|
}, {
|
|
159
308
|
key: "currentKeyframes",
|
|
@@ -170,11 +319,11 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
170
319
|
});
|
|
171
320
|
}
|
|
172
321
|
}, {
|
|
173
|
-
key: "
|
|
322
|
+
key: "mediaInstance",
|
|
174
323
|
get: function get() {
|
|
175
|
-
var _this$
|
|
324
|
+
var _this$videoAgentScene3;
|
|
176
325
|
|
|
177
|
-
return (_this$
|
|
326
|
+
return (_this$videoAgentScene3 = this.videoAgentScene) === null || _this$videoAgentScene3 === void 0 ? void 0 : _this$videoAgentScene3.videoAgentMesh.mediaInstance;
|
|
178
327
|
}
|
|
179
328
|
/**
|
|
180
329
|
* 逐帧任务
|
|
@@ -183,31 +332,31 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
183
332
|
}, {
|
|
184
333
|
key: "requestAnimationFrameLoop",
|
|
185
334
|
value: function requestAnimationFrameLoop(callback) {
|
|
186
|
-
var _this$
|
|
187
|
-
_this$
|
|
335
|
+
var _this$mediaInstance,
|
|
336
|
+
_this$mediaInstance4,
|
|
188
337
|
_this3 = this;
|
|
189
338
|
|
|
190
|
-
if ((_this$
|
|
339
|
+
if ((_this$mediaInstance = this.mediaInstance) !== null && _this$mediaInstance !== void 0 && _this$mediaInstance.ended) {
|
|
191
340
|
this.setEnded(true);
|
|
192
341
|
this.setPlaying(false);
|
|
193
|
-
this.
|
|
342
|
+
this.mediaInstance.pause();
|
|
194
343
|
return;
|
|
195
344
|
}
|
|
196
345
|
|
|
197
346
|
if (!this.playing) {
|
|
198
|
-
var _this$
|
|
347
|
+
var _this$mediaInstance2;
|
|
199
348
|
|
|
200
|
-
if (!((_this$
|
|
201
|
-
var _this$
|
|
349
|
+
if (!((_this$mediaInstance2 = this.mediaInstance) !== null && _this$mediaInstance2 !== void 0 && _this$mediaInstance2.paused)) {
|
|
350
|
+
var _this$mediaInstance3;
|
|
202
351
|
|
|
203
|
-
(_this$
|
|
352
|
+
(_this$mediaInstance3 = this.mediaInstance) === null || _this$mediaInstance3 === void 0 ? void 0 : _this$mediaInstance3.pause();
|
|
204
353
|
}
|
|
205
354
|
|
|
206
355
|
return;
|
|
207
356
|
}
|
|
208
357
|
|
|
209
|
-
if ((_this$
|
|
210
|
-
this.
|
|
358
|
+
if ((_this$mediaInstance4 = this.mediaInstance) !== null && _this$mediaInstance4 !== void 0 && _this$mediaInstance4.paused && this.playing) {
|
|
359
|
+
this.mediaInstance.play();
|
|
211
360
|
}
|
|
212
361
|
|
|
213
362
|
var currentKeyframes = this.currentKeyframes;
|
|
@@ -249,8 +398,8 @@ var Controller = /*#__PURE__*/function (_Subscribe) {
|
|
|
249
398
|
|
|
250
399
|
this.vreoUnit = undefined;
|
|
251
400
|
|
|
252
|
-
if (this.
|
|
253
|
-
this.
|
|
401
|
+
if (this.mediaInstance) {
|
|
402
|
+
this.mediaInstance.currentTime = 0;
|
|
254
403
|
}
|
|
255
404
|
|
|
256
405
|
if (this.stopInterval) {
|
|
@@ -244,7 +244,8 @@ var Panel = /*#__PURE__*/React.forwardRef(function (props, myRef) {
|
|
|
244
244
|
className: "SpatialScenePanel-item index_".concat(index)
|
|
245
245
|
}, /*#__PURE__*/React.createElement("img", {
|
|
246
246
|
className: "SpatialScenePanel-icon",
|
|
247
|
-
src: state.icon
|
|
247
|
+
src: state.icon,
|
|
248
|
+
alt: "".concat(state.text)
|
|
248
249
|
}), /*#__PURE__*/React.createElement("div", {
|
|
249
250
|
className: "SpatialScenePanel-text"
|
|
250
251
|
}, state.text), /*#__PURE__*/React.createElement("div", {
|
package/lib/Player/hooks.js
CHANGED
|
@@ -26,11 +26,11 @@ function useController() {
|
|
|
26
26
|
function useFiveInstance() {
|
|
27
27
|
var controller = useController();
|
|
28
28
|
|
|
29
|
-
if (!controller
|
|
29
|
+
if (!controller.five) {
|
|
30
30
|
throw new Error('没有找到 "five" 实例');
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
return controller
|
|
33
|
+
return controller.five;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function useFiveProject2d() {
|
package/lib/Player/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Five, Subscribe } from '@realsee/five';
|
|
2
2
|
import { VreoKeyframeEvent, VreoUnit } from '../typings/VreoUnit';
|
|
3
|
-
import { PlayerConfigs } from './typings';
|
|
3
|
+
import { Appearance, PlayerConfigs } from './typings';
|
|
4
4
|
export declare class Player extends Subscribe<VreoKeyframeEvent> {
|
|
5
5
|
$five: Five;
|
|
6
6
|
private controller;
|
|
@@ -9,6 +9,7 @@ export declare class Player extends Subscribe<VreoKeyframeEvent> {
|
|
|
9
9
|
load(vreoUnit: VreoUnit, currentTime?: number, preload?: boolean, force?: boolean): Promise<boolean>;
|
|
10
10
|
get paused(): boolean;
|
|
11
11
|
play(currentTime?: number): boolean;
|
|
12
|
+
setAppearance(appearance: Appearance): void;
|
|
12
13
|
pause(): void;
|
|
13
14
|
show(): void;
|
|
14
15
|
hide(): void;
|
package/lib/Player/index.js
CHANGED
|
@@ -7,8 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.Player = void 0;
|
|
9
9
|
|
|
10
|
-
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
10
|
var ReactDOM = _interopRequireWildcard(require("react-dom"));
|
|
13
11
|
|
|
14
12
|
var _five = require("@realsee/five");
|
|
@@ -66,8 +64,11 @@ var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
66
64
|
_classCallCheck(this, Player);
|
|
67
65
|
|
|
68
66
|
_this = _super.call(this);
|
|
69
|
-
_this
|
|
70
|
-
|
|
67
|
+
_this.$five = five;
|
|
68
|
+
|
|
69
|
+
if (!configs.container) {
|
|
70
|
+
configs.container = configs.containter;
|
|
71
|
+
}
|
|
71
72
|
|
|
72
73
|
if (!configs.container) {
|
|
73
74
|
var _five$getElement;
|
|
@@ -82,14 +83,18 @@ var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
82
83
|
fiveCanvasDomParent.append(container);
|
|
83
84
|
} else {
|
|
84
85
|
document.body.append(container);
|
|
85
|
-
}
|
|
86
|
-
|
|
86
|
+
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
if (!configs.container.classList.contains('vreo-app')) configs.container.classList.add('vreo-app');
|
|
89
90
|
_this.configs = Object.freeze(Object.assign({
|
|
90
91
|
keyframeMap: {}
|
|
91
92
|
}, configs));
|
|
92
|
-
_this.controller
|
|
93
|
+
_this.controller = new _Controller.Controller({
|
|
94
|
+
five: five,
|
|
95
|
+
container: configs.container,
|
|
96
|
+
configs: _this.configs
|
|
97
|
+
});
|
|
93
98
|
ReactDOM.render( /*#__PURE__*/React.createElement(_Controller.ControllerContext.Provider, {
|
|
94
99
|
value: _this.controller
|
|
95
100
|
}, /*#__PURE__*/React.createElement(_App.App, null), /*#__PURE__*/React.createElement(_Drawer.Drawer, null), /*#__PURE__*/React.createElement(_PopUp.PopUp, null), _this.configs.customKeyframes && _this.configs.customKeyframes.map(function (CustomCmpt, key) {
|
|
@@ -131,10 +136,10 @@ var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
131
136
|
key: "load",
|
|
132
137
|
value: function () {
|
|
133
138
|
var _load = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(vreoUnit) {
|
|
134
|
-
var _this$controller$
|
|
139
|
+
var _this$controller$medi,
|
|
135
140
|
_this$configs$imageOp,
|
|
141
|
+
_this$controller$vide,
|
|
136
142
|
_this$controller$vide2,
|
|
137
|
-
_this$controller$vide3,
|
|
138
143
|
_this2 = this;
|
|
139
144
|
|
|
140
145
|
var currentTime,
|
|
@@ -151,33 +156,34 @@ var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
151
156
|
currentTime = _args.length > 1 && _args[1] !== undefined ? _args[1] : 0;
|
|
152
157
|
preload = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
|
|
153
158
|
force = _args.length > 3 && _args[3] !== undefined ? _args[3] : false;
|
|
159
|
+
this.controller.setLoading(true);
|
|
154
160
|
|
|
155
161
|
if (force) {
|
|
156
162
|
vreoUnit = JSON.parse(JSON.stringify(vreoUnit));
|
|
157
163
|
}
|
|
158
164
|
|
|
159
165
|
if (this.controller.visible) {
|
|
160
|
-
_context.next =
|
|
166
|
+
_context.next = 9;
|
|
161
167
|
break;
|
|
162
168
|
}
|
|
163
169
|
|
|
164
170
|
this.controller.setVisible(true); // 延迟 500ms 规避跟 DOM 动画冲突
|
|
165
171
|
|
|
166
|
-
_context.next =
|
|
172
|
+
_context.next = 9;
|
|
167
173
|
return new Promise(function (resolve) {
|
|
168
174
|
setTimeout(function () {
|
|
169
175
|
return resolve(true);
|
|
170
176
|
}, 500);
|
|
171
177
|
});
|
|
172
178
|
|
|
173
|
-
case
|
|
179
|
+
case 9:
|
|
174
180
|
if (this.controller.stopInterval) {
|
|
175
181
|
this.controller.stopInterval();
|
|
176
182
|
this.controller.stopInterval = undefined;
|
|
177
183
|
}
|
|
178
184
|
|
|
179
185
|
this.controller.vreoUnit = vreoUnit;
|
|
180
|
-
(_this$controller$
|
|
186
|
+
(_this$controller$medi = this.controller.mediaInstance) === null || _this$controller$medi === void 0 ? void 0 : _this$controller$medi.pause(); // 预载逻辑
|
|
181
187
|
// 是否降低图片分辨率
|
|
182
188
|
|
|
183
189
|
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) {
|
|
@@ -186,7 +192,7 @@ var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
186
192
|
|
|
187
193
|
|
|
188
194
|
if (!(preload || preload === undefined && this.configs.autoPreload)) {
|
|
189
|
-
_context.next =
|
|
195
|
+
_context.next = 23;
|
|
190
196
|
break;
|
|
191
197
|
}
|
|
192
198
|
|
|
@@ -214,41 +220,43 @@ var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
214
220
|
panoIndexes = Object.keys(panoIndexMap);
|
|
215
221
|
i = 0;
|
|
216
222
|
|
|
217
|
-
case
|
|
223
|
+
case 17:
|
|
218
224
|
if (!(i < panoIndexes.length)) {
|
|
219
|
-
_context.next =
|
|
225
|
+
_context.next = 23;
|
|
220
226
|
break;
|
|
221
227
|
}
|
|
222
228
|
|
|
223
|
-
_context.next =
|
|
229
|
+
_context.next = 20;
|
|
224
230
|
return this.$five.preloadPano(Number(panoIndexes[i]));
|
|
225
231
|
|
|
226
|
-
case
|
|
232
|
+
case 20:
|
|
227
233
|
i++;
|
|
228
|
-
_context.next =
|
|
234
|
+
_context.next = 17;
|
|
229
235
|
break;
|
|
230
236
|
|
|
231
|
-
case
|
|
237
|
+
case 23:
|
|
232
238
|
// 新数据载入就绪
|
|
233
239
|
this.emit('loaded', vreoUnit);
|
|
234
240
|
this.controller.emit('loaded', vreoUnit);
|
|
235
241
|
|
|
236
|
-
if ((_this$controller$
|
|
237
|
-
this.controller.videoAgentScene.videoAgentMesh.
|
|
242
|
+
if ((_this$controller$vide = this.controller.videoAgentScene) !== null && _this$controller$vide !== void 0 && _this$controller$vide.videoAgentMesh.mediaInstance) {
|
|
243
|
+
this.controller.videoAgentScene.videoAgentMesh.mediaInstance.currentTime = currentTime / 1000;
|
|
238
244
|
}
|
|
239
245
|
|
|
240
|
-
|
|
241
|
-
|
|
246
|
+
this.controller.setAvatar(vreoUnit.video.avatar);
|
|
247
|
+
_context.next = 29;
|
|
248
|
+
return (_this$controller$vide2 = this.controller.videoAgentScene) === null || _this$controller$vide2 === void 0 ? void 0 : _this$controller$vide2.videoAgentMesh.play(vreoUnit.video.url, currentTime / 1000, vreoUnit.video.duration);
|
|
242
249
|
|
|
243
|
-
case
|
|
250
|
+
case 29:
|
|
244
251
|
this.controller.setEnded(false);
|
|
245
252
|
this.play();
|
|
246
253
|
this.controller.run(function (type, keyframe) {
|
|
247
254
|
return _this2.emit(type, keyframe);
|
|
248
255
|
});
|
|
256
|
+
this.controller.setLoading(false);
|
|
249
257
|
return _context.abrupt("return", true);
|
|
250
258
|
|
|
251
|
-
case
|
|
259
|
+
case 34:
|
|
252
260
|
case "end":
|
|
253
261
|
return _context.stop();
|
|
254
262
|
}
|
|
@@ -272,8 +280,8 @@ var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
272
280
|
value: function play(currentTime) {
|
|
273
281
|
if (this.controller.playing) return true;
|
|
274
282
|
|
|
275
|
-
if (currentTime && this.controller.
|
|
276
|
-
this.controller.
|
|
283
|
+
if (currentTime && this.controller.mediaInstance) {
|
|
284
|
+
this.controller.mediaInstance.currentTime = currentTime / 1000;
|
|
277
285
|
}
|
|
278
286
|
|
|
279
287
|
Object.assign(window, {
|
|
@@ -282,6 +290,11 @@ var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
282
290
|
this.controller.setPlaying(true);
|
|
283
291
|
return true;
|
|
284
292
|
}
|
|
293
|
+
}, {
|
|
294
|
+
key: "setAppearance",
|
|
295
|
+
value: function setAppearance(appearance) {
|
|
296
|
+
this.controller.setAppearance(appearance);
|
|
297
|
+
}
|
|
285
298
|
}, {
|
|
286
299
|
key: "pause",
|
|
287
300
|
value: function pause() {
|
|
@@ -318,4 +331,4 @@ var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
318
331
|
}(_five.Subscribe);
|
|
319
332
|
|
|
320
333
|
exports.Player = Player;
|
|
321
|
-
console.log("\n\n\u250F\u2501\u2501\u2501\u2513\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u250F\u2513\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\u2503\u250F\u2501\u2513\u2503\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2503\u2503\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\u2503\u2517\u2501\u251B\u2503\u250F\u2501\u2501\u2513\u250F\u2501\u2501\u2513\u2501\u2503\u2503\u2501\u250F\u2501\u2501\u2513\u250F\u2501\u2501\u2513\u250F\u2501\u2501\u2513\n\u2503\u250F\u2513\u250F\u251B\u2503\u250F\u2513\u2503\u2517\u2501\u2513\u2503\u2501\u2503\u2503\u2501\u2503\u2501\u2501\u252B\u2503\u250F\u2513\u2503\u2503\u250F\u2513\u2503\n\u2503\u2503\u2503\u2517\u2513\u2503\u2503\u2501\u252B\u2503\u2517\u251B\u2517\u2513\u2503\u2517\u2513\u2523\u2501\u2501\u2503\u2503\u2503\u2501\u252B\u2503\u2503\u2501\u252B\n\u2517\u251B\u2517\u2501\u251B\u2517\u2501\u2501\u251B\u2517\u2501\u2501\u2501\u251B\u2517\u2501\u251B\u2517\u2501\u2501\u251B\u2517\u2501\u2501\u251B\u2517\u2501\u2501\u251B\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
|
|
334
|
+
console.log("\n\n\u250F\u2501\u2501\u2501\u2513\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u250F\u2513\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\u2503\u250F\u2501\u2513\u2503\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2503\u2503\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\u2503\u2517\u2501\u251B\u2503\u250F\u2501\u2501\u2513\u250F\u2501\u2501\u2513\u2501\u2503\u2503\u2501\u250F\u2501\u2501\u2513\u250F\u2501\u2501\u2513\u250F\u2501\u2501\u2513\n\u2503\u250F\u2513\u250F\u251B\u2503\u250F\u2513\u2503\u2517\u2501\u2513\u2503\u2501\u2503\u2503\u2501\u2503\u2501\u2501\u252B\u2503\u250F\u2513\u2503\u2503\u250F\u2513\u2503\n\u2503\u2503\u2503\u2517\u2513\u2503\u2503\u2501\u252B\u2503\u2517\u251B\u2517\u2513\u2503\u2517\u2513\u2523\u2501\u2501\u2503\u2503\u2503\u2501\u252B\u2503\u2503\u2501\u252B\n\u2517\u251B\u2517\u2501\u251B\u2517\u2501\u2501\u251B\u2517\u2501\u2501\u2501\u251B\u2517\u2501\u251B\u2517\u2501\u2501\u251B\u2517\u2501\u2501\u251B\u2517\u2501\u2501\u251B\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n\n");
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ResizeObserver = ResizeObserver;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _addResizeListener = require("../../../shared-utils/addResizeListener");
|
|
11
|
+
|
|
12
|
+
var _hooks = require("../../hooks");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
+
|
|
16
|
+
function ResizeObserver() {
|
|
17
|
+
var ref = _react["default"].useRef(null);
|
|
18
|
+
|
|
19
|
+
var controller = (0, _hooks.useController)();
|
|
20
|
+
|
|
21
|
+
_react["default"].useEffect(function () {
|
|
22
|
+
if (!ref.current) return;
|
|
23
|
+
var resizeElement = controller.container.parentElement;
|
|
24
|
+
if ((0, _addResizeListener.hasResizeListener)(resizeElement)) return;
|
|
25
|
+
var dispose = (0, _addResizeListener.addResizeListener)(resizeElement, function (width, height) {
|
|
26
|
+
controller.setContainerSize(width, height);
|
|
27
|
+
});
|
|
28
|
+
return function () {
|
|
29
|
+
dispose();
|
|
30
|
+
};
|
|
31
|
+
}, []);
|
|
32
|
+
|
|
33
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
34
|
+
className: "resizeObserver-element",
|
|
35
|
+
ref: ref
|
|
36
|
+
});
|
|
37
|
+
}
|
|
@@ -27,7 +27,7 @@ export declare class VideoAgentMesh extends THREE.Mesh {
|
|
|
27
27
|
audioInstance: HTMLAudioElement;
|
|
28
28
|
audioLikeInstance: AudioLike;
|
|
29
29
|
$removeEventListener: () => void;
|
|
30
|
-
get
|
|
30
|
+
get mediaInstance(): HTMLAudioElement | HTMLVideoElement | AudioLike;
|
|
31
31
|
/**
|
|
32
32
|
*
|
|
33
33
|
* @param width
|