@realsee/vreo 0.2.0-alpha.9 → 1.0.0-alpha.2
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 +30 -0
- package/README.md +16 -5
- package/docs/assets/highlight.css +1 -1
- package/docs/assets/main.js +2 -2
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +28 -2
- package/docs/classes/Player.AudioLike.html +52 -0
- package/docs/classes/Player.Controller.html +13 -13
- package/docs/classes/Player.Player-1.html +11 -11
- package/docs/classes/Player.VideoAgentMesh.html +53 -53
- package/docs/classes/Player.VideoAgentScene.html +1 -1
- package/docs/demo/assets/AppReact.d0ee843a.js +1 -0
- package/docs/demo/assets/default.63925584.js +3984 -0
- package/docs/demo/assets/default.f3f3ca8c.css +1 -0
- package/docs/demo/assets/dynamic.76506c2c.js +1 -0
- package/docs/demo/assets/examples.3d8323db.js +25 -0
- package/docs/demo/assets/examples.dac4a6fe.css +1 -0
- package/docs/demo/assets/index.7e31122c.js +1 -0
- package/docs/demo/assets/index.9331038f.css +1 -0
- package/docs/demo/assets/main.79b11b9d.js +1 -0
- package/docs/demo/assets/react.2ee8565f.css +1 -0
- package/docs/demo/assets/react.c1c07c14.js +25 -0
- package/docs/demo/assets/znRoyv06SZQeqA7m.0057e8ae.js +1 -0
- package/docs/demo/examples.html +17 -0
- package/docs/demo/index-react-dynamic.html +20 -0
- package/docs/demo/index-react.html +20 -0
- package/docs/demo/index.html +19 -0
- package/docs/enums/Player.InfoPanelStyleEnum.html +1 -1
- package/docs/enums/Player.InfoPanelTypeEnum.html +2 -2
- package/docs/enums/Player.PanoEffectEnum.html +2 -2
- package/docs/enums/Player.PanoTagEnum.html +2 -2
- package/docs/enums/Player.PanoTagStyleEnum.html +7 -0
- 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/index.html +13 -6
- package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -1
- package/docs/interfaces/Player.PlayerConfigs.html +4 -3
- package/docs/interfaces/Player.Vertex.html +2 -2
- package/docs/interfaces/Player.VideoAgentMeshOptions.html +8 -1
- package/docs/interfaces/Player.VreoKeyframe.html +2 -2
- package/docs/interfaces/Player.VreoUnit.html +2 -2
- package/docs/interfaces/Player.VreoVideo.html +2 -2
- package/docs/interfaces/fivePlugins.CSS3DRenderPluginExportType.html +4 -0
- package/docs/interfaces/fivePlugins.CameraMovementOptsCallback.html +1 -1
- package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +2 -2
- package/docs/interfaces/fivePlugins.CameraMovementPluginParameterType.html +1 -1
- 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 +3 -0
- package/docs/interfaces/react.VreoActionCallbacks.html +15 -7
- package/docs/interfaces/react.VreoProviderProps.html +1 -1
- package/docs/modules/Player.html +21 -15
- package/docs/modules/custom.html +1 -1
- package/docs/modules/fivePlugins.html +5 -2
- package/docs/modules/react.html +1 -1
- package/docs/modules.html +1 -1
- package/lib/PlayController/index.js +4 -5
- package/lib/Player/App.js +9 -7
- package/lib/Player/Controller.d.ts +29 -8
- package/lib/Player/Controller.js +193 -27
- package/lib/Player/custom/SpatialScenePanel/index.js +5 -4
- package/lib/Player/hooks.js +2 -2
- package/lib/Player/index.d.ts +5 -3
- package/lib/Player/index.js +97 -53
- package/lib/Player/modules/Drawer/index.js +1 -1
- package/lib/Player/modules/PopUp/index.js +1 -1
- 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 +16 -2
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +132 -59
- package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +3 -6
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +31 -36
- package/lib/Player/modules/VideoAgent/index.js +53 -12
- package/lib/Player/modules/Wave/index.d.ts +5 -0
- package/lib/Player/modules/Wave/index.js +51 -0
- package/lib/Player/modules/keyframes/BgMusic/index.js +1 -1
- package/lib/Player/modules/keyframes/CameraMovement/index.js +1 -1
- package/lib/Player/modules/keyframes/InfoPanel/index.js +22 -10
- package/lib/Player/modules/keyframes/ModelVideo/index.js +46 -9
- package/lib/Player/modules/keyframes/PanoEffect/index.js +1 -1
- package/lib/Player/modules/keyframes/PanoEffect/lineAnime.js +1 -1
- package/lib/Player/modules/keyframes/PanoTag/index.d.ts +1 -2
- package/lib/Player/modules/keyframes/PanoTag/index.js +79 -119
- package/lib/Player/modules/keyframes/PanoTextLabel/index.d.ts +3 -0
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +96 -44
- package/lib/Player/modules/keyframes/Prompter/index.js +10 -23
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +10 -6
- package/lib/Player/modules/keyframes/VideoEffect/index.js +1 -1
- package/lib/Player/typings.d.ts +12 -1
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.d.ts +2 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/centerPoint.js +12 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.d.ts +7 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/createResizeObserver.js +32 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.d.ts +3 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/evenNumber.js +11 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/index.d.ts +56 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +275 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.d.ts +7 -0
- package/lib/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.js +18 -0
- package/lib/fivePlugins/CameraMovementPlugin/index.js +13 -12
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +1 -1
- package/lib/react/index.d.ts +8 -4
- package/lib/react/index.js +3 -3
- package/lib/shared-utils/AduioLike.d.ts +37 -0
- package/lib/shared-utils/AduioLike.js +166 -0
- package/lib/shared-utils/addResizeListener.d.ts +4 -0
- package/lib/shared-utils/addResizeListener.js +51 -0
- package/lib/shared-utils/animationFrame/BetterTween.js +7 -3
- package/lib/shared-utils/animationFrame/tween.js +1 -1
- package/lib/shared-utils/createTransMatrix.d.ts +1 -0
- package/lib/shared-utils/createTransMatrix.js +43 -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 +37 -2
- package/lib/typings/VreoUnit.js +13 -1
- package/package.json +10 -10
- package/resources/PlayController/index.ts +0 -13
- package/resources/Player/App.tsx +5 -4
- package/resources/Player/Controller.ts +277 -146
- package/resources/Player/custom/SpatialScenePanel/index.tsx +5 -5
- package/resources/Player/hooks.ts +3 -5
- package/resources/Player/index.tsx +189 -141
- package/resources/Player/modules/ResizeObserver/index.tsx +23 -0
- package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +87 -31
- package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +27 -24
- package/resources/Player/modules/VideoAgent/index.tsx +28 -12
- package/resources/Player/modules/Wave/index.tsx +18 -0
- package/resources/Player/modules/keyframes/InfoPanel/index.tsx +26 -11
- package/resources/Player/modules/keyframes/ModelVideo/index.tsx +36 -3
- package/resources/Player/modules/keyframes/PanoTag/index.tsx +53 -97
- package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +86 -34
- package/resources/Player/modules/keyframes/Prompter/index.tsx +6 -16
- package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +6 -2
- package/resources/Player/typings.ts +15 -1
- package/resources/fivePlugins/CSS3DRenderPlugin/centerPoint.ts +5 -0
- package/resources/fivePlugins/CSS3DRenderPlugin/createResizeObserver.ts +17 -0
- package/resources/fivePlugins/CSS3DRenderPlugin/evenNumber.ts +4 -0
- package/resources/fivePlugins/CSS3DRenderPlugin/index.ts +254 -0
- package/resources/fivePlugins/CSS3DRenderPlugin/transformPositionToVector3.ts +5 -0
- package/resources/fivePlugins/CameraMovementPlugin/index.ts +19 -12
- package/resources/react/index.tsx +7 -3
- package/resources/shared-utils/AduioLike.ts +109 -0
- package/resources/shared-utils/addResizeListener.ts +46 -0
- package/resources/shared-utils/createTransMatrix.ts +12 -0
- package/resources/shared-utils/getFileExpandedName.ts +6 -0
- package/resources/shared-utils/getMediaInfo.ts +52 -0
- package/resources/shared-utils/setElementDataset.ts +18 -0
- package/resources/typings/VreoUnit.ts +41 -3
- package/stylesheets/custom/SpatialScenePanel.css +2 -1
- package/stylesheets/default.css +348 -84
package/lib/Player/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
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");
|
|
@@ -37,9 +35,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
37
35
|
|
|
38
36
|
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); } }
|
|
39
37
|
|
|
40
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
38
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
41
39
|
|
|
42
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
40
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
43
41
|
|
|
44
42
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
45
43
|
|
|
@@ -66,21 +64,37 @@ var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
66
64
|
_classCallCheck(this, Player);
|
|
67
65
|
|
|
68
66
|
_this = _super.call(this);
|
|
69
|
-
_this
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var containter = document.querySelector('#vreo-app') || document.createElement('div');
|
|
74
|
-
ReactDOM.unmountComponentAtNode(containter);
|
|
75
|
-
containter.setAttribute('id', 'vreo-app');
|
|
76
|
-
configs.containter = containter;
|
|
77
|
-
document.body.append(containter);
|
|
67
|
+
_this.$five = five;
|
|
68
|
+
|
|
69
|
+
if (!configs.container) {
|
|
70
|
+
configs.container = configs.containter;
|
|
78
71
|
}
|
|
79
72
|
|
|
73
|
+
if (!configs.container) {
|
|
74
|
+
var _five$getElement;
|
|
75
|
+
|
|
76
|
+
var container = document.getElementById('vreo-app') || document.createElement('div');
|
|
77
|
+
ReactDOM.unmountComponentAtNode(container);
|
|
78
|
+
container.setAttribute('id', 'vreo-app');
|
|
79
|
+
configs.container = container;
|
|
80
|
+
var fiveCanvasDomParent = (_five$getElement = five.getElement()) === null || _five$getElement === void 0 ? void 0 : _five$getElement.parentNode;
|
|
81
|
+
|
|
82
|
+
if (fiveCanvasDomParent) {
|
|
83
|
+
fiveCanvasDomParent.append(container);
|
|
84
|
+
} else {
|
|
85
|
+
document.body.append(container);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (!configs.container.classList.contains('vreo-app')) configs.container.classList.add('vreo-app');
|
|
80
90
|
_this.configs = Object.freeze(Object.assign({
|
|
81
91
|
keyframeMap: {}
|
|
82
92
|
}, configs));
|
|
83
|
-
_this.controller
|
|
93
|
+
_this.controller = new _Controller.Controller({
|
|
94
|
+
five: five,
|
|
95
|
+
container: configs.container,
|
|
96
|
+
configs: _this.configs
|
|
97
|
+
});
|
|
84
98
|
ReactDOM.render( /*#__PURE__*/React.createElement(_Controller.ControllerContext.Provider, {
|
|
85
99
|
value: _this.controller
|
|
86
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) {
|
|
@@ -99,12 +113,21 @@ var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
99
113
|
},
|
|
100
114
|
five: five
|
|
101
115
|
});
|
|
102
|
-
})), configs.
|
|
116
|
+
})), configs.container); // 监听播放情况:抛出触发时机
|
|
103
117
|
|
|
118
|
+
(0, _mobx.reaction)(function () {
|
|
119
|
+
return _this.controller.ended;
|
|
120
|
+
}, function (ended) {
|
|
121
|
+
if (ended) {
|
|
122
|
+
_this.emit('paused', true);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
104
125
|
(0, _mobx.reaction)(function () {
|
|
105
126
|
return _this.controller.playing;
|
|
106
127
|
}, function (playing) {
|
|
107
|
-
_this.
|
|
128
|
+
if (!_this.controller.ended) {
|
|
129
|
+
_this.emit(playing ? 'playing' : 'paused');
|
|
130
|
+
}
|
|
108
131
|
});
|
|
109
132
|
return _this;
|
|
110
133
|
}
|
|
@@ -113,48 +136,54 @@ var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
113
136
|
key: "load",
|
|
114
137
|
value: function () {
|
|
115
138
|
var _load = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(vreoUnit) {
|
|
116
|
-
var _this$controller$
|
|
139
|
+
var _this$controller$medi,
|
|
117
140
|
_this$configs$imageOp,
|
|
141
|
+
_this$controller$vide,
|
|
142
|
+
_this$controller$vide2,
|
|
118
143
|
_this2 = this;
|
|
119
144
|
|
|
120
145
|
var currentTime,
|
|
121
146
|
preload,
|
|
147
|
+
force,
|
|
122
148
|
panoIndexMap,
|
|
123
|
-
|
|
149
|
+
panoIndexes,
|
|
124
150
|
i,
|
|
125
|
-
_this$controller$vide2,
|
|
126
|
-
_this$controller$vide3,
|
|
127
151
|
_args = arguments;
|
|
128
|
-
|
|
129
152
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
130
153
|
while (1) {
|
|
131
154
|
switch (_context.prev = _context.next) {
|
|
132
155
|
case 0:
|
|
133
156
|
currentTime = _args.length > 1 && _args[1] !== undefined ? _args[1] : 0;
|
|
134
157
|
preload = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
|
|
158
|
+
force = _args.length > 3 && _args[3] !== undefined ? _args[3] : false;
|
|
159
|
+
this.controller.setLoading(true);
|
|
160
|
+
|
|
161
|
+
if (force) {
|
|
162
|
+
vreoUnit = JSON.parse(JSON.stringify(vreoUnit));
|
|
163
|
+
}
|
|
135
164
|
|
|
136
165
|
if (this.controller.visible) {
|
|
137
|
-
_context.next =
|
|
166
|
+
_context.next = 9;
|
|
138
167
|
break;
|
|
139
168
|
}
|
|
140
169
|
|
|
141
170
|
this.controller.setVisible(true); // 延迟 500ms 规避跟 DOM 动画冲突
|
|
142
171
|
|
|
143
|
-
_context.next =
|
|
172
|
+
_context.next = 9;
|
|
144
173
|
return new Promise(function (resolve) {
|
|
145
174
|
setTimeout(function () {
|
|
146
175
|
return resolve(true);
|
|
147
176
|
}, 500);
|
|
148
177
|
});
|
|
149
178
|
|
|
150
|
-
case
|
|
179
|
+
case 9:
|
|
151
180
|
if (this.controller.stopInterval) {
|
|
152
181
|
this.controller.stopInterval();
|
|
153
182
|
this.controller.stopInterval = undefined;
|
|
154
183
|
}
|
|
155
184
|
|
|
156
185
|
this.controller.vreoUnit = vreoUnit;
|
|
157
|
-
(_this$controller$
|
|
186
|
+
(_this$controller$medi = this.controller.mediaInstance) === null || _this$controller$medi === void 0 ? void 0 : _this$controller$medi.pause(); // 预载逻辑
|
|
158
187
|
// 是否降低图片分辨率
|
|
159
188
|
|
|
160
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) {
|
|
@@ -163,7 +192,7 @@ var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
163
192
|
|
|
164
193
|
|
|
165
194
|
if (!(preload || preload === undefined && this.configs.autoPreload)) {
|
|
166
|
-
_context.next =
|
|
195
|
+
_context.next = 23;
|
|
167
196
|
break;
|
|
168
197
|
}
|
|
169
198
|
|
|
@@ -188,49 +217,46 @@ var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
188
217
|
|
|
189
218
|
return accu;
|
|
190
219
|
}, {});
|
|
191
|
-
|
|
220
|
+
panoIndexes = Object.keys(panoIndexMap);
|
|
192
221
|
i = 0;
|
|
193
222
|
|
|
194
|
-
case
|
|
195
|
-
if (!(i <
|
|
196
|
-
_context.next =
|
|
223
|
+
case 17:
|
|
224
|
+
if (!(i < panoIndexes.length)) {
|
|
225
|
+
_context.next = 23;
|
|
197
226
|
break;
|
|
198
227
|
}
|
|
199
228
|
|
|
200
|
-
_context.next =
|
|
201
|
-
return this.$five.preloadPano(Number(
|
|
229
|
+
_context.next = 20;
|
|
230
|
+
return this.$five.preloadPano(Number(panoIndexes[i]));
|
|
202
231
|
|
|
203
|
-
case
|
|
232
|
+
case 20:
|
|
204
233
|
i++;
|
|
205
|
-
_context.next =
|
|
234
|
+
_context.next = 17;
|
|
206
235
|
break;
|
|
207
236
|
|
|
208
|
-
case
|
|
237
|
+
case 23:
|
|
209
238
|
// 新数据载入就绪
|
|
210
239
|
this.emit('loaded', vreoUnit);
|
|
240
|
+
this.controller.emit('loaded', vreoUnit);
|
|
211
241
|
|
|
212
|
-
if (
|
|
213
|
-
|
|
214
|
-
break;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if ((_this$controller$vide2 = this.controller.videoAgentScene) !== null && _this$controller$vide2 !== void 0 && _this$controller$vide2.videoAgentMesh.videoInstance) {
|
|
218
|
-
this.controller.videoAgentScene.videoAgentMesh.videoInstance.currentTime = currentTime / 1000;
|
|
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;
|
|
219
244
|
}
|
|
220
245
|
|
|
221
|
-
|
|
222
|
-
|
|
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);
|
|
223
249
|
|
|
224
|
-
case
|
|
250
|
+
case 29:
|
|
251
|
+
this.controller.setEnded(false);
|
|
225
252
|
this.play();
|
|
226
|
-
|
|
227
|
-
case 26:
|
|
228
253
|
this.controller.run(function (type, keyframe) {
|
|
229
254
|
return _this2.emit(type, keyframe);
|
|
230
255
|
});
|
|
256
|
+
this.controller.setLoading(false);
|
|
231
257
|
return _context.abrupt("return", true);
|
|
232
258
|
|
|
233
|
-
case
|
|
259
|
+
case 34:
|
|
234
260
|
case "end":
|
|
235
261
|
return _context.stop();
|
|
236
262
|
}
|
|
@@ -251,11 +277,24 @@ var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
251
277
|
}
|
|
252
278
|
}, {
|
|
253
279
|
key: "play",
|
|
254
|
-
value: function play() {
|
|
280
|
+
value: function play(currentTime) {
|
|
255
281
|
if (this.controller.playing) return true;
|
|
282
|
+
|
|
283
|
+
if (currentTime && this.controller.mediaInstance) {
|
|
284
|
+
this.controller.mediaInstance.currentTime = currentTime / 1000;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
Object.assign(window, {
|
|
288
|
+
$vreoController: this.controller
|
|
289
|
+
});
|
|
256
290
|
this.controller.setPlaying(true);
|
|
257
291
|
return true;
|
|
258
292
|
}
|
|
293
|
+
}, {
|
|
294
|
+
key: "setAppearance",
|
|
295
|
+
value: function setAppearance(appearance) {
|
|
296
|
+
this.controller.setAppearance(appearance);
|
|
297
|
+
}
|
|
259
298
|
}, {
|
|
260
299
|
key: "pause",
|
|
261
300
|
value: function pause() {
|
|
@@ -271,14 +310,19 @@ var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
271
310
|
value: function hide() {
|
|
272
311
|
this.controller.setVisible(false);
|
|
273
312
|
}
|
|
313
|
+
}, {
|
|
314
|
+
key: "getCurrentTime",
|
|
315
|
+
value: function getCurrentTime() {
|
|
316
|
+
return this.controller.currentTime;
|
|
317
|
+
}
|
|
274
318
|
}, {
|
|
275
319
|
key: "dispose",
|
|
276
320
|
value: function dispose() {
|
|
277
321
|
this.pause();
|
|
278
322
|
this.controller.dispose();
|
|
279
323
|
|
|
280
|
-
if (this.configs.
|
|
281
|
-
ReactDOM.unmountComponentAtNode(this.configs.
|
|
324
|
+
if (this.configs.container) {
|
|
325
|
+
ReactDOM.unmountComponentAtNode(this.configs.container);
|
|
282
326
|
}
|
|
283
327
|
}
|
|
284
328
|
}]);
|
|
@@ -287,4 +331,4 @@ var Player = /*#__PURE__*/function (_Subscribe) {
|
|
|
287
331
|
}(_five.Subscribe);
|
|
288
332
|
|
|
289
333
|
exports.Player = Player;
|
|
290
|
-
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");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
@@ -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
|
+
}
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
+
import AudioLike from '../../../shared-utils/AduioLike';
|
|
2
3
|
export interface VideoAgentMeshOptions {
|
|
4
|
+
/**
|
|
5
|
+
* 自定义视频实例。
|
|
6
|
+
*/
|
|
3
7
|
videoInstance?: HTMLVideoElement;
|
|
8
|
+
/**
|
|
9
|
+
* 自定义音频实例。
|
|
10
|
+
*/
|
|
4
11
|
audioInstance?: HTMLAudioElement;
|
|
12
|
+
/**
|
|
13
|
+
* 是否开启音频预载能力。**仅对`.mp3`有效**。
|
|
14
|
+
*
|
|
15
|
+
* @description 开启预载能力后会通过 `Fetch/XHR` 方式将音频文件下载转成二进制 [`Blob`](https://developer.mozilla.org/zh-CN/docs/Web/API/Blob) 提供给多媒体实例。这样的好处是 **能够保障音视频播放过程中不卡顿**。 但在部分 iOS 系统中会存在兼容问题——播 25s 之后会静音(`muted` 为 `false`,但是没有声音)。
|
|
16
|
+
*/
|
|
17
|
+
preload?: boolean;
|
|
5
18
|
}
|
|
6
19
|
/**
|
|
7
20
|
* 视频经纪人MESH
|
|
@@ -12,8 +25,9 @@ export declare class VideoAgentMesh extends THREE.Mesh {
|
|
|
12
25
|
freeze: boolean;
|
|
13
26
|
paused: boolean;
|
|
14
27
|
audioInstance: HTMLAudioElement;
|
|
28
|
+
audioLikeInstance: AudioLike;
|
|
15
29
|
$removeEventListener: () => void;
|
|
16
|
-
get
|
|
30
|
+
get mediaInstance(): HTMLAudioElement | HTMLVideoElement | AudioLike;
|
|
17
31
|
/**
|
|
18
32
|
*
|
|
19
33
|
* @param width
|
|
@@ -24,7 +38,7 @@ export declare class VideoAgentMesh extends THREE.Mesh {
|
|
|
24
38
|
*/
|
|
25
39
|
constructor(width: number, height: number, widthSegments: number, heightSegments: number, options?: VideoAgentMeshOptions);
|
|
26
40
|
private update;
|
|
27
|
-
play(videoUrl?: string): Promise<unknown>;
|
|
41
|
+
play(videoUrl?: string, currentTime?: number, duration?: number): Promise<unknown>;
|
|
28
42
|
/**
|
|
29
43
|
* 转成毫秒,保障精准度
|
|
30
44
|
*/
|