@realsee/vreo 2.6.4-alpha.4 → 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
|
@@ -18,9 +18,9 @@ function InfoPanelVideo(_ref2) {
|
|
|
18
18
|
var videoWrapperRef = React.useRef(null);
|
|
19
19
|
var controller = useController();
|
|
20
20
|
React.useEffect(function () {
|
|
21
|
-
var _controller$configs;
|
|
21
|
+
var _controller$configs, _controller$configs$v;
|
|
22
22
|
// if (!isIOSorWX) return
|
|
23
|
-
var video = ((_controller$configs = controller.configs) === null || _controller$configs === void 0
|
|
23
|
+
var video = ((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : (_controller$configs$v = _controller$configs.videos) === null || _controller$configs$v === void 0 ? void 0 : _controller$configs$v.videoPanel) || document.createElement('video');
|
|
24
24
|
var run = controller.playback.capture();
|
|
25
25
|
var valid = function valid() {
|
|
26
26
|
return !!(run !== null && run !== void 0 && run.valid());
|
|
@@ -34,7 +34,7 @@ function InfoPanelVideo(_ref2) {
|
|
|
34
34
|
disposed = true;
|
|
35
35
|
output.muted = true;
|
|
36
36
|
output.pause();
|
|
37
|
-
video.removeEventListener('canplaythrough',
|
|
37
|
+
video.removeEventListener('canplaythrough', canplaythrough);
|
|
38
38
|
};
|
|
39
39
|
if (!videoWrapperRef.current) return;
|
|
40
40
|
var remove = controller.playback.add(stop);
|
|
@@ -42,8 +42,8 @@ function InfoPanelVideo(_ref2) {
|
|
|
42
42
|
if (!videoWrapperRef.current.contains(video)) {
|
|
43
43
|
videoWrapperRef.current.appendChild(video);
|
|
44
44
|
}
|
|
45
|
-
var
|
|
46
|
-
video.removeEventListener('canplaythrough',
|
|
45
|
+
var canplaythrough = function canplaythrough() {
|
|
46
|
+
video.removeEventListener('canplaythrough', canplaythrough);
|
|
47
47
|
if (disposed || !valid()) return;
|
|
48
48
|
output.muted = false;
|
|
49
49
|
void output.play().catch(function (error) {
|
|
@@ -54,7 +54,7 @@ function InfoPanelVideo(_ref2) {
|
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
};
|
|
57
|
-
video.addEventListener('canplaythrough',
|
|
57
|
+
video.addEventListener('canplaythrough', canplaythrough);
|
|
58
58
|
output.load();
|
|
59
59
|
// output.play()
|
|
60
60
|
|
|
@@ -107,14 +107,14 @@ export function InfoPanel() {
|
|
|
107
107
|
do {
|
|
108
108
|
if (style === InfoPanelStyleEnum.PopUp) {
|
|
109
109
|
if (infoPanelData.type === InfoPanelTypeEnum.Image) {
|
|
110
|
-
controller.openPopUp(/*#__PURE__*/React.createElement(InfoPanelImg, {
|
|
110
|
+
controller.openPopUp( /*#__PURE__*/React.createElement(InfoPanelImg, {
|
|
111
111
|
url: infoPanelData.url
|
|
112
112
|
}, /*#__PURE__*/React.createElement(Title, {
|
|
113
113
|
title: title,
|
|
114
114
|
subTitle: subTitle
|
|
115
115
|
})));
|
|
116
116
|
} else if (infoPanelData.type === InfoPanelTypeEnum.Video) {
|
|
117
|
-
controller.openPopUp(/*#__PURE__*/React.createElement(InfoPanelVideo, {
|
|
117
|
+
controller.openPopUp( /*#__PURE__*/React.createElement(InfoPanelVideo, {
|
|
118
118
|
url: infoPanelData.url
|
|
119
119
|
}, /*#__PURE__*/React.createElement(Title, {
|
|
120
120
|
title: title,
|
|
@@ -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
|
import * as React from 'react';
|
|
5
4
|
import * as THREE from 'three';
|
|
6
5
|
import { useController, useFiveInstance } from "../../../hooks.js";
|
|
@@ -18,92 +17,95 @@ export function ModelVideo() {
|
|
|
18
17
|
var _ref$current;
|
|
19
18
|
++generation;
|
|
20
19
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
21
|
-
(_ref$current = ref.current) === null || _ref$current === void 0
|
|
20
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.dispose();
|
|
22
21
|
ref.current = undefined;
|
|
23
22
|
};
|
|
24
23
|
var remove = controller.playback.add(stop);
|
|
25
24
|
var callback = /*#__PURE__*/function () {
|
|
26
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
27
|
-
var current, run, valid, plugin, start, end, _ref2, videoSrc, videoPosterSrc, vertexs, matrixWorld, position, points, _controller$configs,
|
|
28
|
-
return
|
|
29
|
-
while (1)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return _context.a(2);
|
|
42
|
-
case 1:
|
|
43
|
-
plugin = ref.current = ModelTVVideoPlugin(five, {
|
|
44
|
-
mediaManager: run === null || run === void 0 ? void 0 : run.mediaManager
|
|
45
|
-
});
|
|
46
|
-
start = keyframe.start, end = keyframe.end;
|
|
47
|
-
_ref2 = keyframe.data, videoSrc = _ref2.videoSrc, videoPosterSrc = _ref2.videoPosterSrc, vertexs = _ref2.vertexs, matrixWorld = _ref2.matrixWorld;
|
|
48
|
-
position = function () {
|
|
49
|
-
if (vertexs.length < 4) {
|
|
50
|
-
throw new Error('ModelVideo: 顶点数据集合不够,无法组成矩形 ....');
|
|
51
|
-
}
|
|
52
|
-
if (vertexs.length === 4) {
|
|
53
|
-
return vertexs;
|
|
25
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(keyframe) {
|
|
26
|
+
var current, run, valid, plugin, start, end, _ref2, videoSrc, videoPosterSrc, vertexs, matrixWorld, position, points, _controller$configs, _controller$configs$v;
|
|
27
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
28
|
+
while (1) {
|
|
29
|
+
switch (_context.prev = _context.next) {
|
|
30
|
+
case 0:
|
|
31
|
+
stop();
|
|
32
|
+
current = generation;
|
|
33
|
+
run = controller.playback.capture();
|
|
34
|
+
valid = function valid() {
|
|
35
|
+
return !!(run !== null && run !== void 0 && run.valid());
|
|
36
|
+
};
|
|
37
|
+
if (valid()) {
|
|
38
|
+
_context.next = 6;
|
|
39
|
+
break;
|
|
54
40
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
41
|
+
return _context.abrupt("return");
|
|
42
|
+
case 6:
|
|
43
|
+
plugin = ref.current = ModelTVVideoPlugin(five, {
|
|
44
|
+
mediaManager: run === null || run === void 0 ? void 0 : run.mediaManager
|
|
58
45
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
46
|
+
start = keyframe.start, end = keyframe.end;
|
|
47
|
+
_ref2 = keyframe.data, videoSrc = _ref2.videoSrc, videoPosterSrc = _ref2.videoPosterSrc, vertexs = _ref2.vertexs, matrixWorld = _ref2.matrixWorld;
|
|
48
|
+
position = function () {
|
|
49
|
+
if (vertexs.length < 4) {
|
|
50
|
+
throw new Error('ModelVideo: 顶点数据集合不够,无法组成矩形 ....');
|
|
51
|
+
}
|
|
52
|
+
if (vertexs.length === 4) {
|
|
53
|
+
return vertexs;
|
|
54
|
+
}
|
|
55
|
+
var box = new THREE.Box3();
|
|
56
|
+
vertexs.forEach(function (v) {
|
|
57
|
+
return box.expandByPoint(new THREE.Vector3(v.x, v.y, v.z));
|
|
58
|
+
});
|
|
59
|
+
return [new THREE.Vector3(box.min.x, box.max.y, box.max.z), new THREE.Vector3(box.min.x, box.min.y, box.max.z), new THREE.Vector3(box.max.x, box.min.y, box.max.z), new THREE.Vector3(box.max.x, box.max.y, box.max.z)];
|
|
60
|
+
}();
|
|
61
|
+
points = function () {
|
|
62
|
+
if (matrixWorld) {
|
|
63
|
+
var transMatrix = createTransMatrix(matrixWorld);
|
|
64
|
+
return [position.map(function (p) {
|
|
65
|
+
var res = transMatrix([p.x, p.y, p.z]);
|
|
66
|
+
return {
|
|
67
|
+
x: res[0],
|
|
68
|
+
y: res[1],
|
|
69
|
+
z: res[2]
|
|
70
|
+
};
|
|
71
|
+
})];
|
|
72
|
+
}
|
|
73
|
+
return [position];
|
|
74
|
+
}();
|
|
75
|
+
plugin.disable();
|
|
76
|
+
_context.prev = 12;
|
|
77
|
+
_context.next = 15;
|
|
78
|
+
return plugin.load({
|
|
79
|
+
video_src: videoSrc,
|
|
80
|
+
video_poster_src: videoPosterSrc,
|
|
81
|
+
points: points
|
|
82
|
+
}, (_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : (_controller$configs$v = _controller$configs.videos) === null || _controller$configs$v === void 0 ? void 0 : _controller$configs$v.modelTVVideo);
|
|
83
|
+
case 15:
|
|
84
|
+
_context.next = 21;
|
|
97
85
|
break;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
86
|
+
case 17:
|
|
87
|
+
_context.prev = 17;
|
|
88
|
+
_context.t0 = _context["catch"](12);
|
|
89
|
+
if (current === generation && valid()) {
|
|
90
|
+
controller.playback.cancel();
|
|
91
|
+
console.error(_context.t0);
|
|
92
|
+
}
|
|
93
|
+
return _context.abrupt("return");
|
|
94
|
+
case 21:
|
|
95
|
+
if (!(current !== generation || !valid())) {
|
|
96
|
+
_context.next = 23;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
return _context.abrupt("return");
|
|
100
|
+
case 23:
|
|
101
|
+
plugin.enable();
|
|
102
|
+
timeoutRef.current = setTimeout(stop, end - start);
|
|
103
|
+
case 25:
|
|
104
|
+
case "end":
|
|
105
|
+
return _context.stop();
|
|
106
|
+
}
|
|
105
107
|
}
|
|
106
|
-
}, _callee, null, [[
|
|
108
|
+
}, _callee, null, [[12, 17]]);
|
|
107
109
|
}));
|
|
108
110
|
return function callback(_x) {
|
|
109
111
|
return _ref.apply(this, arguments);
|
|
@@ -114,7 +116,7 @@ export function ModelVideo() {
|
|
|
114
116
|
var _ref$current2;
|
|
115
117
|
stop();
|
|
116
118
|
remove();
|
|
117
|
-
(_ref$current2 = ref.current) === null || _ref$current2 === void 0
|
|
119
|
+
(_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.dispose();
|
|
118
120
|
ref.current = undefined;
|
|
119
121
|
controller.off(VreoKeyframeEnum.ModelVideo, callback);
|
|
120
122
|
if (timeoutRef.current) {
|
|
@@ -88,7 +88,7 @@ export function PanoTag() {
|
|
|
88
88
|
tag.state.unfolded = false;
|
|
89
89
|
panoTagPlugin.current.updateRenderAllTags();
|
|
90
90
|
}
|
|
91
|
-
(_tag$hooks = tag.hooks) === null || _tag$hooks === void 0
|
|
91
|
+
(_tag$hooks = tag.hooks) === null || _tag$hooks === void 0 ? void 0 : _tag$hooks.on('folded', function () {
|
|
92
92
|
setTimeout(function () {
|
|
93
93
|
if (tag.state) {
|
|
94
94
|
tag.state.visible = false;
|
|
@@ -90,11 +90,11 @@ export function PanoTextLabel() {
|
|
|
90
90
|
// 将获取的mesh进行旋转操作,根据欧拉角去进行mesh的变换
|
|
91
91
|
if (data.quaternion) {
|
|
92
92
|
var quaternion = new Quaternion(data.quaternion.x, data.quaternion.y, data.quaternion.z, data.quaternion.w);
|
|
93
|
-
css3DObject === null || css3DObject === void 0
|
|
93
|
+
css3DObject === null || css3DObject === void 0 ? void 0 : css3DObject.quaternion.copy(quaternion);
|
|
94
94
|
}
|
|
95
95
|
if (container !== null && container !== void 0 && container.container) {
|
|
96
96
|
var root = createRoot(container.container);
|
|
97
|
-
root.render(/*#__PURE__*/React.createElement("div", {
|
|
97
|
+
root.render( /*#__PURE__*/React.createElement("div", {
|
|
98
98
|
className: "PanoTextLabel PanoTextLabel--notHidden"
|
|
99
99
|
}, /*#__PURE__*/React.createElement("div", {
|
|
100
100
|
className: "PanoTextLabel-wrapper"
|
|
@@ -107,7 +107,7 @@ export function PanoTextLabel() {
|
|
|
107
107
|
}
|
|
108
108
|
timeoutRef.current = setTimeout(function () {
|
|
109
109
|
var _ref$current;
|
|
110
|
-
(_ref$current = ref.current) === null || _ref$current === void 0
|
|
110
|
+
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.disposeAll();
|
|
111
111
|
}, end - start);
|
|
112
112
|
};
|
|
113
113
|
controller.on(VreoKeyframeEnum.PanoTextLabel, callback);
|
|
@@ -38,8 +38,8 @@ export function UpdateVRPanorama() {
|
|
|
38
38
|
}, []);
|
|
39
39
|
React.useEffect(function () {
|
|
40
40
|
var callback = function callback(keyframe) {
|
|
41
|
-
var _five$work, _five$work2;
|
|
42
|
-
if (!deafultWorkRef.current && (_five$work = five.work) !== null && _five$work !== void 0 && (_five$work = _five$work.raw) !== null && _five$work !== void 0 && _five$work.works) {
|
|
41
|
+
var _five$work, _five$work$raw, _five$work2, _five$work2$raw, _five$work2$raw$works;
|
|
42
|
+
if (!deafultWorkRef.current && (_five$work = five.work) !== null && _five$work !== void 0 && (_five$work$raw = _five$work.raw) !== null && _five$work$raw !== void 0 && _five$work$raw.works) {
|
|
43
43
|
deafultWorkRef.current = five.work.raw.works;
|
|
44
44
|
}
|
|
45
45
|
var data = keyframe.data;
|
|
@@ -50,7 +50,7 @@ export function UpdateVRPanorama() {
|
|
|
50
50
|
five.load(updateWorkRef.current);
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
var lastRawWork = (_five$work2 = five.work) === null || _five$work2 === void 0
|
|
53
|
+
var lastRawWork = (_five$work2 = five.work) === null || _five$work2 === void 0 ? void 0 : (_five$work2$raw = _five$work2.raw) === null || _five$work2$raw === void 0 ? void 0 : (_five$work2$raw$works = _five$work2$raw.works) === null || _five$work2$raw$works === void 0 ? void 0 : _five$work2$raw$works[0];
|
|
54
54
|
if (!lastRawWork) {
|
|
55
55
|
console.warn('UpdateVRPanorama: 没有可用的 work 数据');
|
|
56
56
|
return;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
|
|
4
|
-
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); }
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
4
|
import classNames from 'classnames';
|
|
6
5
|
import * as React from 'react';
|
|
7
6
|
// import { Preloader } from '../../../../shared-utils/Preloader'
|
|
@@ -24,73 +23,76 @@ export function VideoEffect() {
|
|
|
24
23
|
var generation = 0;
|
|
25
24
|
var removeCanPlay;
|
|
26
25
|
var callback = /*#__PURE__*/function () {
|
|
27
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
26
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(keyframe) {
|
|
28
27
|
var _removeCanPlay;
|
|
29
28
|
var start, end, _ref2, videoSrc, fov, direction, panoIndex, vector, _ref3, _ref4, longitude, latitude, currentGeneration, run, active, valid, video, media, play;
|
|
30
|
-
return
|
|
31
|
-
while (1)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (!direction) {
|
|
40
|
-
return [0, 0];
|
|
41
|
-
}
|
|
42
|
-
var longitude = -Math.atan2(direction.x, -direction.z);
|
|
43
|
-
longitude = (longitude % PI_2 + PI_2) % PI_2;
|
|
44
|
-
var latitude = -Math.asin(direction.y / 1);
|
|
45
|
-
return [longitude, latitude];
|
|
46
|
-
}(), _ref4 = _slicedToArray(_ref3, 2), longitude = _ref4[0], latitude = _ref4[1];
|
|
47
|
-
destroy();
|
|
48
|
-
currentGeneration = generation;
|
|
49
|
-
five.setState({
|
|
50
|
-
fov: fov,
|
|
51
|
-
panoIndex: panoIndex,
|
|
52
|
-
longitude: longitude,
|
|
53
|
-
latitude: latitude
|
|
54
|
-
}, true);
|
|
55
|
-
(_removeCanPlay = removeCanPlay) === null || _removeCanPlay === void 0 || _removeCanPlay();
|
|
56
|
-
run = controller.playback.capture();
|
|
57
|
-
active = function active() {
|
|
58
|
-
return !!(run !== null && run !== void 0 && run.valid());
|
|
59
|
-
};
|
|
60
|
-
valid = function valid() {
|
|
61
|
-
return currentGeneration === generation && active();
|
|
62
|
-
};
|
|
63
|
-
video = videoRef.current;
|
|
64
|
-
if (!(!video || !valid())) {
|
|
65
|
-
_context.n = 1;
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
return _context.a(2);
|
|
69
|
-
case 1:
|
|
70
|
-
media = output = run.bind(video);
|
|
71
|
-
media.muted = true;
|
|
72
|
-
media.src = videoSrc;
|
|
73
|
-
play = function play() {
|
|
74
|
-
var _removeCanPlay2;
|
|
75
|
-
(_removeCanPlay2 = removeCanPlay) === null || _removeCanPlay2 === void 0 || _removeCanPlay2();
|
|
76
|
-
if (!valid()) return;
|
|
77
|
-
media.muted = false;
|
|
78
|
-
void media.play().catch(function (error) {
|
|
79
|
-
if (valid()) {
|
|
80
|
-
controller.playback.cancel();
|
|
81
|
-
console.error(error);
|
|
29
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
30
|
+
while (1) {
|
|
31
|
+
switch (_context.prev = _context.next) {
|
|
32
|
+
case 0:
|
|
33
|
+
start = keyframe.start, end = keyframe.end;
|
|
34
|
+
_ref2 = keyframe.data, videoSrc = _ref2.videoSrc, fov = _ref2.fov, direction = _ref2.direction, panoIndex = _ref2.panoIndex, vector = _ref2.vector;
|
|
35
|
+
_ref3 = function () {
|
|
36
|
+
if (vector) {
|
|
37
|
+
return [vector.longitude, vector.latitude];
|
|
82
38
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
39
|
+
if (!direction) {
|
|
40
|
+
return [0, 0];
|
|
41
|
+
}
|
|
42
|
+
var longitude = -Math.atan2(direction.x, -direction.z);
|
|
43
|
+
longitude = (longitude % PI_2 + PI_2) % PI_2;
|
|
44
|
+
var latitude = -Math.asin(direction.y / 1);
|
|
45
|
+
return [longitude, latitude];
|
|
46
|
+
}(), _ref4 = _slicedToArray(_ref3, 2), longitude = _ref4[0], latitude = _ref4[1];
|
|
47
|
+
destroy();
|
|
48
|
+
currentGeneration = generation;
|
|
49
|
+
five.setState({
|
|
50
|
+
fov: fov,
|
|
51
|
+
panoIndex: panoIndex,
|
|
52
|
+
longitude: longitude,
|
|
53
|
+
latitude: latitude
|
|
54
|
+
}, true);
|
|
55
|
+
(_removeCanPlay = removeCanPlay) === null || _removeCanPlay === void 0 ? void 0 : _removeCanPlay();
|
|
56
|
+
run = controller.playback.capture();
|
|
57
|
+
active = function active() {
|
|
58
|
+
return !!(run !== null && run !== void 0 && run.valid());
|
|
59
|
+
};
|
|
60
|
+
valid = function valid() {
|
|
61
|
+
return currentGeneration === generation && active();
|
|
62
|
+
};
|
|
63
|
+
video = videoRef.current;
|
|
64
|
+
if (!(!video || !valid())) {
|
|
65
|
+
_context.next = 13;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
return _context.abrupt("return");
|
|
69
|
+
case 13:
|
|
70
|
+
media = output = run.bind(video);
|
|
71
|
+
media.muted = true;
|
|
72
|
+
media.src = videoSrc;
|
|
73
|
+
play = function play() {
|
|
74
|
+
var _removeCanPlay2;
|
|
75
|
+
(_removeCanPlay2 = removeCanPlay) === null || _removeCanPlay2 === void 0 ? void 0 : _removeCanPlay2();
|
|
76
|
+
if (!valid()) return;
|
|
77
|
+
media.muted = false;
|
|
78
|
+
void media.play().catch(function (error) {
|
|
79
|
+
if (valid()) {
|
|
80
|
+
controller.playback.cancel();
|
|
81
|
+
console.error(error);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
removeCanPlay = function removeCanPlay() {
|
|
86
|
+
return video.removeEventListener('canplaythrough', play);
|
|
87
|
+
};
|
|
88
|
+
video.addEventListener('canplaythrough', play);
|
|
89
|
+
media.load();
|
|
90
|
+
setVisible(true);
|
|
91
|
+
timeoutRef.current = setTimeout(destroy, Math.max(0, end - start));
|
|
92
|
+
case 22:
|
|
93
|
+
case "end":
|
|
94
|
+
return _context.stop();
|
|
95
|
+
}
|
|
94
96
|
}
|
|
95
97
|
}, _callee);
|
|
96
98
|
}));
|
|
@@ -105,7 +107,7 @@ export function VideoEffect() {
|
|
|
105
107
|
if (timeoutRef.current) {
|
|
106
108
|
clearTimeout(timeoutRef.current);
|
|
107
109
|
}
|
|
108
|
-
(_removeCanPlay3 = removeCanPlay) === null || _removeCanPlay3 === void 0
|
|
110
|
+
(_removeCanPlay3 = removeCanPlay) === null || _removeCanPlay3 === void 0 ? void 0 : _removeCanPlay3();
|
|
109
111
|
if (output) {
|
|
110
112
|
output.muted = true;
|
|
111
113
|
output.pause();
|
|
@@ -125,9 +127,9 @@ export function VideoEffect() {
|
|
|
125
127
|
};
|
|
126
128
|
}, [controller]);
|
|
127
129
|
React.useEffect(function () {
|
|
128
|
-
var _controller$configs;
|
|
130
|
+
var _controller$configs, _controller$configs$v;
|
|
129
131
|
if (!ref.current) return;
|
|
130
|
-
var video = ((_controller$configs = controller.configs) === null || _controller$configs === void 0
|
|
132
|
+
var video = ((_controller$configs = controller.configs) === null || _controller$configs === void 0 ? void 0 : (_controller$configs$v = _controller$configs.videos) === null || _controller$configs$v === void 0 ? void 0 : _controller$configs$v.videoEffect) || document.createElement('video');
|
|
131
133
|
// <video playsInline key="VideoEffect-video" className="VideoEffect-video" src={blobSrc} />
|
|
132
134
|
video.setAttribute('playsinline', 'true');
|
|
133
135
|
video.setAttribute('webkit-playsinline', 'true');
|
|
@@ -28,7 +28,7 @@ export var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
|
|
|
28
28
|
});
|
|
29
29
|
var config = params[1];
|
|
30
30
|
if ((points === null || points === void 0 ? void 0 : points.length) < 4) return console.error('points must be equal or greater than than 4');
|
|
31
|
-
if (!(five !== null && five !== void 0 && (_five$model = five.model) !== null && _five$model !== void 0 && _five$model.loaded)) return console.error('five.model.loaded is: ', five === null || five === void 0
|
|
31
|
+
if (!(five !== null && five !== void 0 && (_five$model = five.model) !== null && _five$model !== void 0 && _five$model.loaded)) return console.error('five.model.loaded is: ', five === null || five === void 0 ? void 0 : (_five$model2 = five.model) === null || _five$model2 === void 0 ? void 0 : _five$model2.loaded);
|
|
32
32
|
var fiveElement = five.getElement();
|
|
33
33
|
if (!fiveElement) return console.error('five.getElement() is ' + fiveElement);
|
|
34
34
|
var disposers = [];
|
|
@@ -92,16 +92,16 @@ export var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
|
|
|
92
92
|
css3DRenderer.domElement.style.top = '0';
|
|
93
93
|
css3DRenderer.domElement.style.userSelect = 'none';
|
|
94
94
|
css3DRenderer.domElement.style.pointerEvents = 'none';
|
|
95
|
-
var
|
|
95
|
+
var renderEveryFrame = function renderEveryFrame() {
|
|
96
96
|
if (stopRenderFlag) return;
|
|
97
|
-
requestAnimationFrameId = requestAnimationFrame(
|
|
97
|
+
requestAnimationFrameId = requestAnimationFrame(renderEveryFrame);
|
|
98
98
|
css3DRenderer.render(scene, five.camera);
|
|
99
99
|
};
|
|
100
100
|
return function () {
|
|
101
101
|
var _resizeObserver, _resizeObserver$obser;
|
|
102
102
|
scene.add(css3DObject);
|
|
103
|
-
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0
|
|
104
|
-
|
|
103
|
+
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : (_resizeObserver$obser = _resizeObserver.observe) === null || _resizeObserver$obser === void 0 ? void 0 : _resizeObserver$obser.call(_resizeObserver);
|
|
104
|
+
renderEveryFrame();
|
|
105
105
|
if (mode === 'behind' && mesh) {
|
|
106
106
|
five.scene.add(mesh);
|
|
107
107
|
disposers.push(function () {
|
|
@@ -138,7 +138,7 @@ export var CSS3DRenderPlugin = function CSS3DRenderPlugin(five) {
|
|
|
138
138
|
if (mode === 'behind') state.behindMode = undefined;
|
|
139
139
|
if (!state.behindMode && !state.frontMode) {
|
|
140
140
|
var _resizeObserver2, _resizeObserver2$unob;
|
|
141
|
-
(_resizeObserver2 = resizeObserver) === null || _resizeObserver2 === void 0
|
|
141
|
+
(_resizeObserver2 = resizeObserver) === null || _resizeObserver2 === void 0 ? void 0 : (_resizeObserver2$unob = _resizeObserver2.unobserve) === null || _resizeObserver2$unob === void 0 ? void 0 : _resizeObserver2$unob.call(_resizeObserver2);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
return true;
|