@realsee/vreo 2.4.1 → 2.4.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 +11 -9
- package/lib/PlayController/index.js +61 -52
- package/lib/Player/App.js +1 -1
- package/lib/Player/Controller.d.ts +1 -1
- package/lib/Player/Controller.js +28 -23
- package/lib/Player/custom/SpatialScenePanel/index.js +10 -10
- package/lib/Player/index.js +94 -90
- package/lib/Player/modules/Drawer/index.js +1 -1
- package/lib/Player/modules/PopUp/index.js +1 -1
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +1 -1
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +145 -136
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +2 -2
- package/lib/Player/modules/VideoAgent/index.js +2 -2
- package/lib/Player/modules/Wave/index.js +1 -1
- package/lib/Player/modules/keyframes/BgMusic/index.js +41 -39
- package/lib/Player/modules/keyframes/CameraMovement/index.js +43 -41
- package/lib/Player/modules/keyframes/InfoPanel/index.js +6 -6
- package/lib/Player/modules/keyframes/ModelVideo/index.js +53 -51
- 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.js +2 -2
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +3 -3
- package/lib/Player/modules/keyframes/Prompter/index.js +1 -1
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +5 -5
- package/lib/Player/modules/keyframes/VideoEffect/index.js +44 -42
- package/lib/Player/typings.d.ts +1 -4
- package/lib/fivePlugins/CSS3DRenderPlugin/index.js +7 -7
- package/lib/fivePlugins/CameraMovementPlugin/index.js +171 -167
- package/lib/fivePlugins/CameraMovementPlugin/typings.js +6 -6
- package/lib/fivePlugins/ModelTVVideoPlugin/index.js +30 -28
- package/lib/react/index.d.ts +1 -1
- package/lib/react/index.js +2 -2
- package/lib/shared-utils/Audio.d.ts +8 -0
- package/lib/shared-utils/Audio.js +62 -46
- package/lib/shared-utils/AudioLike.js +13 -10
- package/lib/shared-utils/animationFrame/BetterTween.d.ts +4 -2
- package/lib/shared-utils/animationFrame/BetterTween.js +19 -15
- package/lib/shared-utils/animationFrame/tween.d.ts +4 -2
- package/lib/shared-utils/animationFrame/tween.js +12 -1
- package/lib/shared-utils/createTransMatrix.js +1 -1
- package/lib/typings/VreoUnit.js +26 -69
- package/package.json +20 -24
|
@@ -40,79 +40,81 @@ var CameraMovementPlugin = exports.CameraMovementPlugin = function CameraMovemen
|
|
|
40
40
|
var _opts$asyncEndCallbac;
|
|
41
41
|
var panoIndex, start, movePanoOptions;
|
|
42
42
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
43
|
-
while (1)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
opts.asyncStartCallback
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
43
|
+
while (1) {
|
|
44
|
+
switch (_context.prev = _context.next) {
|
|
45
|
+
case 0:
|
|
46
|
+
moving = true;
|
|
47
|
+
if (opts.asyncStartCallback) {
|
|
48
|
+
opts.asyncStartCallback();
|
|
49
|
+
}
|
|
50
|
+
if (!(five.panoIndex === undefined)) {
|
|
51
|
+
_context.next = 4;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
return _context.abrupt("return", reject(false));
|
|
55
|
+
case 4:
|
|
56
|
+
if (!(args.mode && args.mode !== five.currentMode)) {
|
|
57
|
+
_context.next = 8;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
_context.next = 7;
|
|
61
|
+
return five.changeMode(args.mode, args, duration);
|
|
62
|
+
case 7:
|
|
63
|
+
return _context.abrupt("return", resolve(true));
|
|
64
|
+
case 8:
|
|
65
|
+
if (!(args.mode === _five.Five.Mode.Floorplan)) {
|
|
66
|
+
_context.next = 10;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
return _context.abrupt("return", resolve(true));
|
|
70
|
+
case 10:
|
|
71
|
+
if (!(opts.preload && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
|
|
72
|
+
_context.next = 13;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
71
75
|
_context.next = 13;
|
|
76
|
+
return five.preloadPano(args.panoIndex);
|
|
77
|
+
case 13:
|
|
78
|
+
(_opts$asyncEndCallbac = opts.asyncEndCallback) === null || _opts$asyncEndCallbac === void 0 ? void 0 : _opts$asyncEndCallbac.call(opts);
|
|
79
|
+
if (!(args.panoIndex === undefined && args.fov === undefined && args.latitude === undefined && args.longitude === undefined)) {
|
|
80
|
+
_context.next = 16;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
return _context.abrupt("return", resolve(true));
|
|
84
|
+
case 16:
|
|
85
|
+
panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex;
|
|
86
|
+
if (!(panoIndex !== undefined)) {
|
|
87
|
+
_context.next = 26;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
start = performance.now();
|
|
91
|
+
_context.next = 21;
|
|
92
|
+
return five.ready();
|
|
93
|
+
case 21:
|
|
94
|
+
movePanoOptions = Object.assign({}, args, {
|
|
95
|
+
duration: duration - (performance.now() - start),
|
|
96
|
+
// 移动耗时
|
|
97
|
+
moveEndCallback: function moveEndCallback() {
|
|
98
|
+
return resolve(true);
|
|
99
|
+
},
|
|
100
|
+
// 移动结束
|
|
101
|
+
moveCancelCallback: function moveCancelCallback() {
|
|
102
|
+
resolve(true);
|
|
103
|
+
},
|
|
104
|
+
// 移动开始
|
|
105
|
+
effect: args.transEffect || 'fly'
|
|
106
|
+
});
|
|
107
|
+
_context.next = 24;
|
|
108
|
+
return five.moveToPano(panoIndex, movePanoOptions);
|
|
109
|
+
case 24:
|
|
110
|
+
_context.next = 27;
|
|
72
111
|
break;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
_context.next = 16;
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
return _context.abrupt("return", resolve(true));
|
|
83
|
-
case 16:
|
|
84
|
-
panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex;
|
|
85
|
-
if (!(panoIndex !== undefined)) {
|
|
86
|
-
_context.next = 26;
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
start = performance.now();
|
|
90
|
-
_context.next = 21;
|
|
91
|
-
return five.ready();
|
|
92
|
-
case 21:
|
|
93
|
-
movePanoOptions = Object.assign({}, args, {
|
|
94
|
-
duration: duration - (performance.now() - start),
|
|
95
|
-
// 移动耗时
|
|
96
|
-
moveEndCallback: function moveEndCallback() {
|
|
97
|
-
return resolve(true);
|
|
98
|
-
},
|
|
99
|
-
// 移动结束
|
|
100
|
-
moveCancelCallback: function moveCancelCallback() {
|
|
101
|
-
resolve(true);
|
|
102
|
-
},
|
|
103
|
-
// 移动开始
|
|
104
|
-
effect: args.transEffect || 'fly'
|
|
105
|
-
});
|
|
106
|
-
_context.next = 24;
|
|
107
|
-
return five.moveToPano(panoIndex, movePanoOptions);
|
|
108
|
-
case 24:
|
|
109
|
-
_context.next = 27;
|
|
110
|
-
break;
|
|
111
|
-
case 26:
|
|
112
|
-
reject(false);
|
|
113
|
-
case 27:
|
|
114
|
-
case "end":
|
|
115
|
-
return _context.stop();
|
|
112
|
+
case 26:
|
|
113
|
+
reject(false);
|
|
114
|
+
case 27:
|
|
115
|
+
case "end":
|
|
116
|
+
return _context.stop();
|
|
117
|
+
}
|
|
116
118
|
}
|
|
117
119
|
}, _callee);
|
|
118
120
|
}));
|
|
@@ -130,110 +132,112 @@ var CameraMovementPlugin = exports.CameraMovementPlugin = function CameraMovemen
|
|
|
130
132
|
timeEnd,
|
|
131
133
|
start,
|
|
132
134
|
animeDuration,
|
|
133
|
-
|
|
135
|
+
onFiveRenderFrame,
|
|
134
136
|
_args2 = arguments;
|
|
135
137
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
136
|
-
while (1)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
while (1) {
|
|
139
|
+
switch (_context2.prev = _context2.next) {
|
|
140
|
+
case 0:
|
|
141
|
+
opts = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
|
|
142
|
+
moving = false;
|
|
143
|
+
(_opts$asyncStartCallb = opts.asyncStartCallback) === null || _opts$asyncStartCallb === void 0 ? void 0 : _opts$asyncStartCallb.call(opts);
|
|
141
144
|
|
|
142
|
-
|
|
143
|
-
|
|
145
|
+
// 先切换模型再出旋转效果
|
|
146
|
+
if (!(args.mode && five.currentMode !== args.mode)) {
|
|
147
|
+
_context2.next = 6;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
144
150
|
_context2.next = 6;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
151
|
+
return five.changeMode(args.mode, args.mode === _five.Five.Mode.Panorama ? {
|
|
152
|
+
latitude: 0
|
|
153
|
+
} : undefined);
|
|
154
|
+
case 6:
|
|
155
|
+
if (!(args.mode === _five.Five.Mode.Panorama && five.currentMode === _five.Five.Mode.Panorama && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
|
|
156
|
+
_context2.next = 12;
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
if (!opts.preload) {
|
|
160
|
+
_context2.next = 10;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
157
163
|
_context2.next = 10;
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
// 移动开始
|
|
174
|
-
effect: 'fade'
|
|
164
|
+
return five.preloadPano(args.panoIndex);
|
|
165
|
+
case 10:
|
|
166
|
+
_context2.next = 12;
|
|
167
|
+
return new Promise(function (resolve, reject) {
|
|
168
|
+
five.moveToPano(args.panoIndex, {
|
|
169
|
+
moveEndCallback: function moveEndCallback() {
|
|
170
|
+
return resolve(true);
|
|
171
|
+
},
|
|
172
|
+
// 移动结束
|
|
173
|
+
moveCancelCallback: function moveCancelCallback() {
|
|
174
|
+
return reject(false);
|
|
175
|
+
},
|
|
176
|
+
// 移动开始
|
|
177
|
+
effect: 'fade'
|
|
178
|
+
});
|
|
175
179
|
});
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
(_opts$asyncEndCallbac2 = opts.asyncEndCallback) === null || _opts$asyncEndCallbac2 === void 0 || _opts$asyncEndCallbac2.call(opts);
|
|
180
|
+
case 12:
|
|
181
|
+
_context2.next = 14;
|
|
182
|
+
return five.ready();
|
|
183
|
+
case 14:
|
|
184
|
+
(_opts$asyncEndCallbac2 = opts.asyncEndCallback) === null || _opts$asyncEndCallbac2 === void 0 ? void 0 : _opts$asyncEndCallbac2.call(opts);
|
|
182
185
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
_onFiveRenderFrame = function onFiveRenderFrame() {
|
|
196
|
-
if (timeEnd || moving) {
|
|
197
|
-
five.off('renderFrame', _onFiveRenderFrame);
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
var targetState = {};
|
|
201
|
-
if (args.rotation !== _typings.Rotation.Loop) {
|
|
202
|
-
var progress = (performance.now() - start) / duration;
|
|
203
|
-
targetState = {
|
|
204
|
-
fov: progressNumber(from.fov, to.fov, progress),
|
|
205
|
-
latitude: progressNumber(from.latitude, to.latitude, progress),
|
|
206
|
-
longitude: progressLongitude(from.longitude, to.longitude, args.rotation, progress)
|
|
207
|
-
};
|
|
208
|
-
} else {
|
|
209
|
-
var _progress = (performance.now() - start) / animeDuration; // 可能大于1
|
|
210
|
-
var times = Math.floor(_progress);
|
|
211
|
-
var progress2 = _progress - times; // 一定小于1
|
|
212
|
-
var isNegative = times % 2 === 1; // 是否为反向旋转, 0: 正, 1: 反, 2: 正, 3: 反 以此类推
|
|
213
|
-
var resultProgress = isNegative ? 1 - progress2 : progress2;
|
|
214
|
-
targetState = {
|
|
215
|
-
fov: progressNumber(from.fov, to.fov, resultProgress),
|
|
216
|
-
latitude: progressNumber(from.latitude, to.latitude, resultProgress),
|
|
217
|
-
longitude: progressNumber(from.longitude, to.longitude, resultProgress)
|
|
218
|
-
};
|
|
186
|
+
// 计算to
|
|
187
|
+
from = five.getCurrentState();
|
|
188
|
+
to = function () {
|
|
189
|
+
return args;
|
|
190
|
+
}();
|
|
191
|
+
timeEnd = false; // 开始时间
|
|
192
|
+
start = performance.now();
|
|
193
|
+
animeDuration = duration;
|
|
194
|
+
if (args.rotation === _typings.Rotation.Loop) {
|
|
195
|
+
animeDuration = args.rotateSpeed ? Math.ceil(Math.abs(to.longitude - from.longitude) / args.rotateSpeed * 1000) : duration;
|
|
196
|
+
animeDuration = Math.min(duration, animeDuration);
|
|
219
197
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
198
|
+
onFiveRenderFrame = function onFiveRenderFrame() {
|
|
199
|
+
if (timeEnd || moving) {
|
|
200
|
+
five.off('renderFrame', onFiveRenderFrame);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
var targetState = {};
|
|
204
|
+
if (args.rotation !== _typings.Rotation.Loop) {
|
|
205
|
+
var progress = (performance.now() - start) / duration;
|
|
206
|
+
targetState = {
|
|
207
|
+
fov: progressNumber(from.fov, to.fov, progress),
|
|
208
|
+
latitude: progressNumber(from.latitude, to.latitude, progress),
|
|
209
|
+
longitude: progressLongitude(from.longitude, to.longitude, args.rotation, progress)
|
|
210
|
+
};
|
|
211
|
+
} else {
|
|
212
|
+
var _progress = (performance.now() - start) / animeDuration; // 可能大于1
|
|
213
|
+
var times = Math.floor(_progress);
|
|
214
|
+
var progress2 = _progress - times; // 一定小于1
|
|
215
|
+
var isNegative = times % 2 === 1; // 是否为反向旋转, 0: 正, 1: 反, 2: 正, 3: 反 以此类推
|
|
216
|
+
var resultProgress = isNegative ? 1 - progress2 : progress2;
|
|
217
|
+
targetState = {
|
|
218
|
+
fov: progressNumber(from.fov, to.fov, resultProgress),
|
|
219
|
+
latitude: progressNumber(from.latitude, to.latitude, resultProgress),
|
|
220
|
+
longitude: progressNumber(from.longitude, to.longitude, resultProgress)
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
five.setState(targetState, true);
|
|
224
|
+
};
|
|
225
|
+
five.on('renderFrame', onFiveRenderFrame);
|
|
226
|
+
_context2.next = 25;
|
|
227
|
+
return new Promise(function (resolve) {
|
|
228
|
+
setTimeout(function () {
|
|
229
|
+
timeEnd = true;
|
|
230
|
+
five.off('renderFrame', onFiveRenderFrame);
|
|
231
|
+
// 总时间到了之后强制结束,同时也是 Loop 模式的结束方式
|
|
232
|
+
resolve(true);
|
|
233
|
+
}, duration);
|
|
234
|
+
});
|
|
235
|
+
case 25:
|
|
236
|
+
return _context2.abrupt("return", _context2.sent);
|
|
237
|
+
case 26:
|
|
238
|
+
case "end":
|
|
239
|
+
return _context2.stop();
|
|
240
|
+
}
|
|
237
241
|
}
|
|
238
242
|
}, _callee2);
|
|
239
243
|
}));
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Rotation = exports.CameraMovementEffect = void 0;
|
|
7
7
|
/* eslint-disable prettier/prettier */
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
9
|
-
var CameraMovementEffect
|
|
9
|
+
var CameraMovementEffect;
|
|
10
|
+
(function (CameraMovementEffect) {
|
|
10
11
|
CameraMovementEffect["Move"] = "Move";
|
|
11
12
|
CameraMovementEffect["Rotate"] = "Rotate";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
})(CameraMovementEffect || (exports.CameraMovementEffect = CameraMovementEffect = {}));
|
|
14
|
+
var Rotation;
|
|
15
|
+
(function (Rotation) {
|
|
15
16
|
Rotation["Clockwise"] = "Clockwise";
|
|
16
17
|
Rotation["Anticlockwise"] = "Anticlockwise";
|
|
17
18
|
Rotation["Loop"] = "Loop";
|
|
18
|
-
|
|
19
|
-
}({});
|
|
19
|
+
})(Rotation || (exports.Rotation = Rotation = {}));
|
|
@@ -10,7 +10,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
12
|
var THREE = _interopRequireWildcard(require("three"));
|
|
13
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) { "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); } return f; })(e, t); }
|
|
14
14
|
var ModelTVVideoPlugin = exports.ModelTVVideoPlugin = function ModelTVVideoPlugin(five, _ref) {
|
|
15
15
|
var videoElement = _ref.videoElement;
|
|
16
16
|
var state = {
|
|
@@ -40,17 +40,17 @@ var ModelTVVideoPlugin = exports.ModelTVVideoPlugin = function ModelTVVideoPlugi
|
|
|
40
40
|
});
|
|
41
41
|
var play = function play() {
|
|
42
42
|
if (!state.videoTexture) return;
|
|
43
|
-
var
|
|
43
|
+
var timeupdate = function timeupdate() {
|
|
44
44
|
var _state$videoTexture;
|
|
45
45
|
if (!state.videoTexture) return;
|
|
46
|
-
(_state$videoTexture = state.videoTexture) === null || _state$videoTexture === void 0
|
|
46
|
+
(_state$videoTexture = state.videoTexture) === null || _state$videoTexture === void 0 ? void 0 : _state$videoTexture.image.removeEventListener('timeupdate', timeupdate);
|
|
47
47
|
state.videoTextureEnabled = true;
|
|
48
48
|
state.videoMeshes.forEach(function (mesh) {
|
|
49
49
|
if (mesh.material.map !== state.videoTexture) mesh.material.map = state.videoTexture;
|
|
50
50
|
});
|
|
51
51
|
five.needsRender = true;
|
|
52
52
|
};
|
|
53
|
-
state.videoTexture.image.addEventListener('timeupdate',
|
|
53
|
+
state.videoTexture.image.addEventListener('timeupdate', timeupdate);
|
|
54
54
|
if (state.videoTexture && state.videoMeshes.length) {
|
|
55
55
|
state.videoTexture.image.play();
|
|
56
56
|
}
|
|
@@ -161,31 +161,33 @@ var ModelTVVideoPlugin = exports.ModelTVVideoPlugin = function ModelTVVideoPlugi
|
|
|
161
161
|
var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(data, videoElement) {
|
|
162
162
|
var video_src, video_poster_src, points;
|
|
163
163
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
164
|
-
while (1)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
164
|
+
while (1) {
|
|
165
|
+
switch (_context.prev = _context.next) {
|
|
166
|
+
case 0:
|
|
167
|
+
video_src = data.video_src, video_poster_src = data.video_poster_src, points = data.points;
|
|
168
|
+
state.videoSource = video_src;
|
|
169
|
+
state.rectPoints = points.map(function (items) {
|
|
170
|
+
return items.map(function (_ref3) {
|
|
171
|
+
var x = _ref3.x,
|
|
172
|
+
y = _ref3.y,
|
|
173
|
+
z = _ref3.z;
|
|
174
|
+
return new THREE.Vector3(x, y, z);
|
|
175
|
+
});
|
|
174
176
|
});
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
177
|
+
state.imageTexture = getImageTexture(video_poster_src);
|
|
178
|
+
if (videoElement) {
|
|
179
|
+
state.videoElement = videoElement;
|
|
180
|
+
}
|
|
181
|
+
_context.next = 7;
|
|
182
|
+
return getVideoTexture(state.videoSource, state.videoElement);
|
|
183
|
+
case 7:
|
|
184
|
+
state.videoTexture = _context.sent;
|
|
185
|
+
state.enabled = !!data.enable;
|
|
186
|
+
if (state.enabled) enable();
|
|
187
|
+
case 10:
|
|
188
|
+
case "end":
|
|
189
|
+
return _context.stop();
|
|
190
|
+
}
|
|
189
191
|
}
|
|
190
192
|
}, _callee);
|
|
191
193
|
}));
|
package/lib/react/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface VreoProviderProps {
|
|
|
5
5
|
configs?: Partial<PlayerConfigs>;
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
}
|
|
8
|
-
export declare const VreoProvider:
|
|
8
|
+
export declare const VreoProvider: React.FC<VreoProviderProps>;
|
|
9
9
|
/**
|
|
10
10
|
* VreoPlayer 命令集合。
|
|
11
11
|
*/
|
package/lib/react/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
13
13
|
var _react = require("@realsee/five/react");
|
|
14
14
|
var React = _interopRequireWildcard(require("react"));
|
|
15
15
|
var _Player = require("../Player");
|
|
16
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
16
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) { "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); } return f; })(e, t); }
|
|
17
17
|
var VreoContext = /*#__PURE__*/React.createContext(null);
|
|
18
18
|
var VreoProvider = exports.VreoProvider = function VreoProvider(props) {
|
|
19
19
|
var five = (0, _react.unsafe__useFiveInstance)();
|
|
@@ -27,7 +27,7 @@ var VreoProvider = exports.VreoProvider = function VreoProvider(props) {
|
|
|
27
27
|
setPlayer(playerRef.current);
|
|
28
28
|
return function () {
|
|
29
29
|
var _playerRef$current;
|
|
30
|
-
(_playerRef$current = playerRef.current) === null || _playerRef$current === void 0
|
|
30
|
+
(_playerRef$current = playerRef.current) === null || _playerRef$current === void 0 ? void 0 : _playerRef$current.dispose();
|
|
31
31
|
};
|
|
32
32
|
}, []);
|
|
33
33
|
if (!player) return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
@@ -4,7 +4,15 @@ export declare function waitForBlankAudioGenerated(checkInterval?: number, timeo
|
|
|
4
4
|
export declare function generateBlankAudio(length: number): void;
|
|
5
5
|
declare class IAudio extends Audio {
|
|
6
6
|
preload: "auto";
|
|
7
|
+
/**
|
|
8
|
+
* 获取音频源 URL
|
|
9
|
+
* @returns {string} 当前音频源 URL
|
|
10
|
+
*/
|
|
7
11
|
get src(): string;
|
|
12
|
+
/**
|
|
13
|
+
* 设置音频源 URL
|
|
14
|
+
* @param paramsSrc - 音频源 URL
|
|
15
|
+
*/
|
|
8
16
|
set src(paramsSrc: string);
|
|
9
17
|
realSrc: string;
|
|
10
18
|
inited: boolean;
|