@realsee/vreo 0.2.0-alpha.1 → 0.2.0-alpha.12
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/README.md +104 -17
- package/docs/assets/custom.css +4 -4
- package/docs/assets/search.js +1 -1
- package/docs/classes/Player.Controller.html +54 -0
- package/docs/classes/Player.Player-1.html +9 -9
- package/docs/classes/Player.VideoAgentMesh.html +142 -0
- package/docs/classes/Player.VideoAgentScene.html +1 -0
- package/docs/enums/Player.InfoPanelStyleEnum.html +1 -0
- package/docs/enums/Player.InfoPanelTypeEnum.html +1 -1
- package/docs/enums/Player.PanoEffectEnum.html +2 -2
- package/docs/enums/Player.PanoTagEnum.html +1 -1
- package/docs/enums/Player.PanoTagStyleEnum.html +7 -0
- package/docs/enums/Player.VreoKeyframeEnum.html +13 -13
- package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -1
- package/docs/enums/fivePlugins.Rotation.html +1 -1
- package/docs/index.html +53 -20
- package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -0
- package/docs/interfaces/Player.PlayerConfigs.html +3 -3
- package/docs/interfaces/Player.Vertex.html +1 -1
- package/docs/interfaces/Player.VideoAgentMeshOptions.html +1 -0
- 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.CameraMovementOptsCallback.html +1 -1
- package/docs/interfaces/fivePlugins.CameraMovementPluginExportType.html +3 -3
- 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/react.VreoActionCallbacks.html +15 -7
- package/docs/interfaces/react.VreoProviderProps.html +1 -0
- package/docs/modules/Player.html +17 -15
- package/docs/modules/custom.html +3 -0
- package/docs/modules/fivePlugins.html +2 -2
- package/docs/modules/react.html +1 -1
- package/docs/modules.html +1 -1
- package/lib/PlayController/createHTMLAudioElement.d.ts +1 -0
- package/lib/PlayController/createHTMLAudioElement.js +47 -0
- package/lib/PlayController/index.d.ts +38 -0
- package/lib/PlayController/index.js +300 -0
- package/lib/Player/App.js +4 -3
- package/lib/Player/Controller.d.ts +2 -0
- package/lib/Player/Controller.js +14 -0
- package/lib/Player/custom/SpatialScenePanel/index.d.ts +22 -0
- package/lib/Player/custom/SpatialScenePanel/index.js +279 -0
- package/lib/Player/index.d.ts +2 -2
- package/lib/Player/index.js +102 -12
- package/lib/Player/modules/PopUp/index.d.ts +2 -0
- package/lib/Player/modules/PopUp/index.js +43 -0
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.d.ts +2 -1
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +26 -20
- package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +4 -1
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +2 -1
- package/lib/Player/modules/VideoAgent/index.d.ts +2 -0
- package/lib/Player/modules/VideoAgent/index.js +1 -1
- package/lib/Player/modules/keyframes/CameraMovement/index.js +41 -5
- package/lib/Player/modules/keyframes/InfoPanel/index.js +84 -36
- package/lib/Player/modules/keyframes/ModelVideo/index.js +45 -8
- package/lib/Player/modules/keyframes/PanoTag/index.js +19 -6
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +4 -12
- package/lib/Player/modules/keyframes/Prompter/index.js +4 -18
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +30 -18
- package/lib/Player/typings.d.ts +15 -2
- package/lib/fivePlugins/CameraMovementPlugin/index.js +104 -90
- package/lib/fivePlugins/CameraMovementPlugin/typings.d.ts +1 -0
- package/lib/react/index.d.ts +12 -4
- package/lib/react/index.js +3 -3
- package/lib/shared-utils/createTransMatrix.d.ts +1 -0
- package/lib/shared-utils/createTransMatrix.js +43 -0
- package/lib/typings/VreoUnit.d.ts +32 -6
- package/lib/typings/VreoUnit.js +26 -6
- package/package.json +6 -6
- package/resources/PlayController/createHTMLAudioElement.ts +53 -0
- package/resources/PlayController/index.ts +167 -0
- package/resources/Player/App.tsx +3 -1
- package/resources/Player/Controller.ts +12 -0
- package/resources/Player/custom/SpatialScenePanel/index.tsx +264 -0
- package/resources/Player/index.tsx +59 -4
- package/resources/Player/modules/PopUp/index.tsx +26 -0
- package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +7 -6
- package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +2 -2
- package/resources/Player/modules/VideoAgent/index.tsx +3 -2
- package/resources/Player/modules/keyframes/CameraMovement/index.tsx +7 -3
- package/resources/Player/modules/keyframes/InfoPanel/index.tsx +90 -23
- package/resources/Player/modules/keyframes/ModelVideo/index.tsx +36 -3
- package/resources/Player/modules/keyframes/PanoTag/index.tsx +31 -12
- package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +2 -2
- package/resources/Player/modules/keyframes/Prompter/index.tsx +5 -15
- package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +25 -16
- package/resources/Player/typings.ts +17 -2
- package/resources/fivePlugins/CameraMovementPlugin/index.ts +59 -48
- package/resources/fivePlugins/CameraMovementPlugin/typings.ts +2 -1
- package/resources/react/index.tsx +14 -5
- package/resources/shared-utils/createTransMatrix.ts +12 -0
- package/resources/typings/VreoUnit.ts +42 -7
- package/stylesheets/custom/SpatialScenePanel.css +309 -0
- package/stylesheets/default.css +116 -10
|
@@ -9,11 +9,15 @@ exports.ModelVideo = ModelVideo;
|
|
|
9
9
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
12
|
+
var THREE = _interopRequireWildcard(require("three"));
|
|
13
|
+
|
|
14
|
+
var _hooks = require("../../../hooks");
|
|
15
|
+
|
|
12
16
|
var _ModelTVVideoPlugin = require("../../../../fivePlugins/ModelTVVideoPlugin");
|
|
13
17
|
|
|
14
|
-
var
|
|
18
|
+
var _createTransMatrix = require("../../../../shared-utils/createTransMatrix");
|
|
15
19
|
|
|
16
|
-
var
|
|
20
|
+
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
17
21
|
|
|
18
22
|
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
23
|
|
|
@@ -33,7 +37,7 @@ function ModelVideo() {
|
|
|
33
37
|
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(keyframe) {
|
|
34
38
|
var _controller$configs, _controller$configs$v;
|
|
35
39
|
|
|
36
|
-
var start, end, _ref2, videoSrc, videoPosterSrc, vertexs;
|
|
40
|
+
var start, end, _ref2, videoSrc, videoPosterSrc, vertexs, matrixWorld, position, points;
|
|
37
41
|
|
|
38
42
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
39
43
|
while (1) {
|
|
@@ -44,16 +48,49 @@ function ModelVideo() {
|
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
start = keyframe.start, end = keyframe.end;
|
|
47
|
-
_ref2 = keyframe.data, videoSrc = _ref2.videoSrc, videoPosterSrc = _ref2.videoPosterSrc, vertexs = _ref2.vertexs;
|
|
51
|
+
_ref2 = keyframe.data, videoSrc = _ref2.videoSrc, videoPosterSrc = _ref2.videoPosterSrc, vertexs = _ref2.vertexs, matrixWorld = _ref2.matrixWorld;
|
|
52
|
+
|
|
53
|
+
position = function () {
|
|
54
|
+
if (vertexs.length < 4) {
|
|
55
|
+
throw new Error('ModelVideo: 顶点数据集合不够,无法组成矩形 ....');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (vertexs.length === 4) {
|
|
59
|
+
return vertexs;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var box = new THREE.Box3();
|
|
63
|
+
vertexs.forEach(function (v) {
|
|
64
|
+
return box.expandByPoint(new THREE.Vector3(v.x, v.y, v.z));
|
|
65
|
+
});
|
|
66
|
+
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)];
|
|
67
|
+
}();
|
|
68
|
+
|
|
69
|
+
points = function () {
|
|
70
|
+
if (matrixWorld) {
|
|
71
|
+
var transMatrix = (0, _createTransMatrix.createTransMatrix)(matrixWorld);
|
|
72
|
+
return [position.map(function (p) {
|
|
73
|
+
var res = transMatrix([p.x, p.y, p.z]);
|
|
74
|
+
return {
|
|
75
|
+
x: res[0],
|
|
76
|
+
y: res[1],
|
|
77
|
+
z: res[2]
|
|
78
|
+
};
|
|
79
|
+
})];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return [position];
|
|
83
|
+
}();
|
|
84
|
+
|
|
48
85
|
ref.current.disable();
|
|
49
|
-
_context.next =
|
|
86
|
+
_context.next = 8;
|
|
50
87
|
return ref.current.load({
|
|
51
88
|
video_src: videoSrc,
|
|
52
89
|
video_poster_src: videoPosterSrc,
|
|
53
|
-
points:
|
|
90
|
+
points: points
|
|
54
91
|
}, (_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);
|
|
55
92
|
|
|
56
|
-
case
|
|
93
|
+
case 8:
|
|
57
94
|
ref.current.enable();
|
|
58
95
|
timeoutRef.current = setTimeout(function () {
|
|
59
96
|
var _ref$current;
|
|
@@ -61,7 +98,7 @@ function ModelVideo() {
|
|
|
61
98
|
return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.disable();
|
|
62
99
|
}, end - start);
|
|
63
100
|
|
|
64
|
-
case
|
|
101
|
+
case 10:
|
|
65
102
|
case "end":
|
|
66
103
|
return _context.stop();
|
|
67
104
|
}
|
|
@@ -75,7 +75,8 @@ function PanoTag() {
|
|
|
75
75
|
vertex: vertex,
|
|
76
76
|
text: panoTagData.text || _VreoUnit.PanoTagEnum.Text,
|
|
77
77
|
type: panoTagData.type,
|
|
78
|
-
imgUrl: panoTagData.imgUrl
|
|
78
|
+
imgUrl: panoTagData.imgUrl,
|
|
79
|
+
style: panoTagData.style || _VreoUnit.PanoTagStyleEnum.Growth
|
|
79
80
|
});
|
|
80
81
|
setPos({
|
|
81
82
|
left: left,
|
|
@@ -139,6 +140,23 @@ function PanoTag() {
|
|
|
139
140
|
return undefined;
|
|
140
141
|
}();
|
|
141
142
|
|
|
143
|
+
if ((state === null || state === void 0 ? void 0 : state.style) === _VreoUnit.PanoTagStyleEnum.Expand) {
|
|
144
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
145
|
+
className: (0, _classnames["default"])('PanoTag', {
|
|
146
|
+
'PanoTag--expand': true,
|
|
147
|
+
'PanoTag--notHidden': state
|
|
148
|
+
}),
|
|
149
|
+
style: {
|
|
150
|
+
left: ((pos === null || pos === void 0 ? void 0 : pos.left) || 0) + 'px',
|
|
151
|
+
top: ((pos === null || pos === void 0 ? void 0 : pos.top) || 0) + 'px'
|
|
152
|
+
}
|
|
153
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
154
|
+
className: 'PanoTag-box PanoTag-box--' + ((state === null || state === void 0 ? void 0 : state.type) || '')
|
|
155
|
+
}, boxContent), /*#__PURE__*/React.createElement("div", {
|
|
156
|
+
className: "PanoTag-guideline"
|
|
157
|
+
})));
|
|
158
|
+
}
|
|
159
|
+
|
|
142
160
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
143
161
|
className: (0, _classnames["default"])('PanoTag', {
|
|
144
162
|
'PanoTag--notHidden': state
|
|
@@ -158,11 +176,6 @@ function PanoTag() {
|
|
|
158
176
|
}), /*#__PURE__*/React.createElement("span", {
|
|
159
177
|
className: "PanoTag-straightline"
|
|
160
178
|
})), /*#__PURE__*/React.createElement("div", {
|
|
161
|
-
onClick: function onClick() {
|
|
162
|
-
if (state !== null && state !== void 0 && state.imgUrl) {// @TODO
|
|
163
|
-
// setDrawerVisible(true)
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
179
|
className: 'PanoTag-box PanoTag-box--' + ((state === null || state === void 0 ? void 0 : state.type) || '')
|
|
167
180
|
}, boxContent))));
|
|
168
181
|
}
|
|
@@ -63,12 +63,8 @@ function PanoTextLabel() {
|
|
|
63
63
|
var res = project2d(new _three.Vector3(x, y, z));
|
|
64
64
|
if (!res) return;
|
|
65
65
|
var left = res.x,
|
|
66
|
-
top = res.y;
|
|
67
|
-
|
|
68
|
-
$PanoTextLabel: {
|
|
69
|
-
setState: setState
|
|
70
|
-
}
|
|
71
|
-
});
|
|
66
|
+
top = res.y; // Object.assign(window, { $PanoTextLabel: { setState } })
|
|
67
|
+
|
|
72
68
|
setState({
|
|
73
69
|
left: left,
|
|
74
70
|
top: top,
|
|
@@ -80,12 +76,8 @@ function PanoTextLabel() {
|
|
|
80
76
|
}, end - start);
|
|
81
77
|
};
|
|
82
78
|
|
|
83
|
-
controller.on(_VreoUnit.VreoKeyframeEnum.PanoTextLabel, callback);
|
|
84
|
-
|
|
85
|
-
$panoTextLabel: {
|
|
86
|
-
setState: setState
|
|
87
|
-
}
|
|
88
|
-
});
|
|
79
|
+
controller.on(_VreoUnit.VreoKeyframeEnum.PanoTextLabel, callback); // Object.assign(window, { $panoTextLabel: { setState } })
|
|
80
|
+
|
|
89
81
|
return function () {
|
|
90
82
|
controller.off(_VreoUnit.VreoKeyframeEnum.PanoTextLabel, callback);
|
|
91
83
|
|
|
@@ -13,8 +13,6 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
13
|
|
|
14
14
|
var _hooks = require("../../../hooks");
|
|
15
15
|
|
|
16
|
-
var _reactTransitionGroup = require("react-transition-group");
|
|
17
|
-
|
|
18
16
|
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
19
17
|
|
|
20
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -69,9 +67,8 @@ function Prompter() {
|
|
|
69
67
|
|
|
70
68
|
ref.current = setTimeout(function () {
|
|
71
69
|
setHidden(true);
|
|
72
|
-
setTimeout(
|
|
73
|
-
|
|
74
|
-
}, 500);
|
|
70
|
+
setText(''); // setTimeout(() => setText(''), 500)
|
|
71
|
+
|
|
75
72
|
if (ref.current) clearTimeout(ref.current);
|
|
76
73
|
ref.current = null;
|
|
77
74
|
}, end - start);
|
|
@@ -87,20 +84,9 @@ function Prompter() {
|
|
|
87
84
|
'vreo-prompter--hidden': hidden,
|
|
88
85
|
'vreo-prompter--audio': controller.isAudio
|
|
89
86
|
})
|
|
90
|
-
},
|
|
91
|
-
/*#__PURE__*/
|
|
92
|
-
|
|
93
|
-
/* @warning "index.js:1 Warning: findDOMNode is deprecated in StrictMode." */
|
|
94
|
-
React.createElement(_reactTransitionGroup.TransitionGroup, {
|
|
87
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
95
88
|
className: "vreo-prompter-text"
|
|
96
|
-
}, /*#__PURE__*/React.createElement(_reactTransitionGroup.CSSTransition, {
|
|
97
|
-
key: text,
|
|
98
|
-
classNames: "vreo-prompter-text-transition",
|
|
99
|
-
timeout: 500,
|
|
100
|
-
addEndListener: function addEndListener(node, done) {
|
|
101
|
-
return node.addEventListener('transitionend', done, false);
|
|
102
|
-
}
|
|
103
89
|
}, /*#__PURE__*/React.createElement("div", {
|
|
104
90
|
className: "vreo-prompter-innerText"
|
|
105
|
-
}, text)))
|
|
91
|
+
}, text)));
|
|
106
92
|
}
|
|
@@ -22,42 +22,49 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
22
22
|
function UpdateVRPanorama() {
|
|
23
23
|
var controller = (0, _hooks.useController)();
|
|
24
24
|
var five = (0, _hooks.useFiveInstance)();
|
|
25
|
-
var
|
|
26
|
-
var
|
|
25
|
+
var deafultWorkRef = React.useRef(null);
|
|
26
|
+
var updateWorkRef = React.useRef(null); // 恢复默认 VR
|
|
27
|
+
|
|
27
28
|
var restoreCallback = React.useCallback(function () {
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
// 先清理掉 之前的 VR 数据备份
|
|
30
|
+
updateWorkRef.current = null;
|
|
31
|
+
|
|
32
|
+
if (deafultWorkRef.current) {
|
|
33
|
+
var work = (0, _five.parseWork)(deafultWorkRef.current);
|
|
30
34
|
five.load(work);
|
|
31
35
|
}
|
|
36
|
+
}, []); // 暂停时: 恢复默认 VR
|
|
32
37
|
|
|
33
|
-
workRef.current = null;
|
|
34
|
-
}, []);
|
|
35
38
|
var pausedCallback = React.useCallback(function () {
|
|
36
|
-
if (
|
|
37
|
-
var work = (0, _five.parseWork)(
|
|
39
|
+
if (deafultWorkRef.current) {
|
|
40
|
+
var work = (0, _five.parseWork)(deafultWorkRef.current);
|
|
41
|
+
Object.assign(window, {
|
|
42
|
+
$rawWork: work
|
|
43
|
+
});
|
|
38
44
|
five.load(work);
|
|
39
45
|
}
|
|
40
|
-
}, []);
|
|
46
|
+
}, []); // 播放时:如果暂停前有更新 VR 需要还原
|
|
47
|
+
|
|
41
48
|
var playingCallback = React.useCallback(function () {
|
|
42
|
-
if (!
|
|
49
|
+
if (!updateWorkRef.current) {
|
|
43
50
|
return;
|
|
44
51
|
}
|
|
45
52
|
|
|
46
|
-
five.load(
|
|
53
|
+
five.load(updateWorkRef.current);
|
|
47
54
|
}, []);
|
|
48
55
|
React.useEffect(function () {
|
|
49
56
|
var callback = function callback(keyframe) {
|
|
50
57
|
var _five$work;
|
|
51
58
|
|
|
52
|
-
if (!
|
|
53
|
-
|
|
59
|
+
if (!deafultWorkRef.current) {
|
|
60
|
+
deafultWorkRef.current = five.work.raw.works;
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
var data = keyframe.data; // 如果数据中有新 work 数据,则直接载入
|
|
57
64
|
|
|
58
65
|
if (data.work) {
|
|
59
|
-
|
|
60
|
-
five.load(
|
|
66
|
+
updateWorkRef.current = (0, _five.parseWork)(data.work);
|
|
67
|
+
five.load(updateWorkRef.current);
|
|
61
68
|
return;
|
|
62
69
|
}
|
|
63
70
|
|
|
@@ -72,8 +79,13 @@ function UpdateVRPanorama() {
|
|
|
72
79
|
delete data.dynamic_scene;
|
|
73
80
|
}
|
|
74
81
|
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
Object.assign(window, {
|
|
83
|
+
$work1: JSON.parse(lastRawWork),
|
|
84
|
+
$work2: data,
|
|
85
|
+
parseWork: _five.parseWork
|
|
86
|
+
});
|
|
87
|
+
updateWorkRef.current = (0, _five.parseWork)([lastRawWork, data]);
|
|
88
|
+
five.load(updateWorkRef.current);
|
|
77
89
|
};
|
|
78
90
|
|
|
79
91
|
controller.on(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback); // 离开 将之前的内容清空
|
|
@@ -93,6 +105,6 @@ function UpdateVRPanorama() {
|
|
|
93
105
|
controller.off('paused', pausedCallback);
|
|
94
106
|
controller.off('playing', playingCallback);
|
|
95
107
|
};
|
|
96
|
-
}, [
|
|
108
|
+
}, []);
|
|
97
109
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
98
110
|
}
|
package/lib/Player/typings.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { Subscribe, Five } from '@realsee/five';
|
|
3
|
+
import { VreoKeyframeConfigMap, VreoKeyframeEvent } from '../typings/VreoUnit';
|
|
4
|
+
import { VideoAgentMeshOptions } from './modules/VideoAgent/VideoAgentMesh';
|
|
3
5
|
export interface PlayerConfigs {
|
|
4
6
|
containter?: ReactDOM.Container;
|
|
5
7
|
keyframeMap: VreoKeyframeConfigMap;
|
|
@@ -12,8 +14,19 @@ export interface PlayerConfigs {
|
|
|
12
14
|
videoEffect?: HTMLVideoElement;
|
|
13
15
|
modelTVVideo?: HTMLVideoElement;
|
|
14
16
|
};
|
|
17
|
+
videoAgentMeshOptions?: VideoAgentMeshOptions;
|
|
15
18
|
/**
|
|
16
19
|
* 如果需要在 底部面板添加自定义内容,可以传递个 React 组件。
|
|
17
20
|
*/
|
|
18
21
|
customPanelChildren?: ReactNode;
|
|
22
|
+
customKeyframes?: React.FC<CustomVreoKeyframeProps>[];
|
|
23
|
+
imageOptions?: {
|
|
24
|
+
size: number;
|
|
25
|
+
};
|
|
26
|
+
autoPreload?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare type VreoSubscribe = Pick<Subscribe<VreoKeyframeEvent>, 'on' | 'once' | 'off'>;
|
|
29
|
+
export interface CustomVreoKeyframeProps {
|
|
30
|
+
subscribe: VreoSubscribe;
|
|
31
|
+
five: Five;
|
|
19
32
|
}
|
|
@@ -54,112 +54,125 @@ function progressNumber(from, to, pst) {
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
var CameraMovementPlugin = function CameraMovementPlugin(five) {
|
|
57
|
-
var move =
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
57
|
+
var move = function move(args, duration) {
|
|
58
|
+
var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
59
|
+
preload: true
|
|
60
|
+
};
|
|
61
|
+
return new Promise( /*#__PURE__*/function () {
|
|
62
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(resolve, reject) {
|
|
63
|
+
var panoIndex, movePanoOptions;
|
|
64
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
65
|
+
while (1) {
|
|
66
|
+
switch (_context.prev = _context.next) {
|
|
67
|
+
case 0:
|
|
68
|
+
if (opts.asyncStartCallback) {
|
|
69
|
+
opts.asyncStartCallback();
|
|
70
|
+
}
|
|
68
71
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
if (!(five.panoIndex === undefined)) {
|
|
73
|
+
_context.next = 3;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
72
76
|
|
|
73
|
-
|
|
74
|
-
_context.next = 5;
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
+
return _context.abrupt("return", reject(false));
|
|
77
78
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
79
|
+
case 3:
|
|
80
|
+
if (!(args.mode && args.mode !== five.currentMode)) {
|
|
81
|
+
_context.next = 6;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
_context.next = 6;
|
|
86
|
+
return new Promise(function (resolve) {
|
|
87
|
+
if (!args.mode) return;
|
|
88
|
+
five.once('modeChange', function (mode) {
|
|
89
|
+
five.once('initAnimationEnded', function () {
|
|
90
|
+
if (mode === args.mode) {
|
|
91
|
+
resolve(true);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
five.changeMode(args.mode, {
|
|
96
|
+
fov: args.fov || undefined,
|
|
97
|
+
latitude: args.latitude || undefined,
|
|
98
|
+
longitude: args.longitude || undefined,
|
|
99
|
+
panoIndex: args.panoIndex || undefined
|
|
86
100
|
});
|
|
87
101
|
});
|
|
88
|
-
five.changeMode(args.mode, {
|
|
89
|
-
fov: args.fov || undefined,
|
|
90
|
-
latitude: args.latitude || undefined,
|
|
91
|
-
longitude: args.longitude || undefined,
|
|
92
|
-
panoIndex: args.panoIndex || undefined
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
102
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
case 6:
|
|
104
|
+
if (!(args.mode === _five.Five.Mode.Floorplan)) {
|
|
105
|
+
_context.next = 8;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
101
108
|
|
|
102
|
-
|
|
109
|
+
return _context.abrupt("return", resolve(true));
|
|
103
110
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
111
|
+
case 8:
|
|
112
|
+
if (!(opts.preload && args.panoIndex !== undefined && args.panoIndex !== five.panoIndex)) {
|
|
113
|
+
_context.next = 11;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
109
116
|
|
|
110
|
-
|
|
111
|
-
|
|
117
|
+
_context.next = 11;
|
|
118
|
+
return five.preloadPano(args.panoIndex);
|
|
112
119
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
120
|
+
case 11:
|
|
121
|
+
if (opts.asyncEndCallback) {
|
|
122
|
+
opts.asyncEndCallback();
|
|
123
|
+
}
|
|
117
124
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
125
|
+
if (!(args.panoIndex === undefined && args.fov === undefined && args.latitude === undefined && args.longitude === undefined)) {
|
|
126
|
+
_context.next = 14;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
122
129
|
|
|
123
|
-
|
|
130
|
+
return _context.abrupt("return", resolve(true));
|
|
124
131
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
five.moveToPano(panoIndex, Object.assign({
|
|
132
|
-
duration: duration,
|
|
133
|
-
// 移动耗时
|
|
134
|
-
moveEndCallback: function moveEndCallback() {
|
|
135
|
-
return resolve(true);
|
|
136
|
-
},
|
|
137
|
-
// 移动结束
|
|
138
|
-
moveCancelCallback: function moveCancelCallback() {
|
|
139
|
-
return reject(false);
|
|
140
|
-
} // 移动开始
|
|
141
|
-
|
|
142
|
-
}, args));
|
|
143
|
-
} else {
|
|
144
|
-
reject(false);
|
|
132
|
+
case 14:
|
|
133
|
+
panoIndex = args.panoIndex !== undefined ? args.panoIndex : five.panoIndex;
|
|
134
|
+
|
|
135
|
+
if (!(panoIndex !== undefined)) {
|
|
136
|
+
_context.next = 21;
|
|
137
|
+
break;
|
|
145
138
|
}
|
|
146
|
-
});
|
|
147
139
|
|
|
148
|
-
|
|
149
|
-
|
|
140
|
+
movePanoOptions = Object.assign(args, {
|
|
141
|
+
duration: duration,
|
|
142
|
+
// 移动耗时
|
|
143
|
+
moveEndCallback: function moveEndCallback() {
|
|
144
|
+
return resolve(true);
|
|
145
|
+
},
|
|
146
|
+
// 移动结束
|
|
147
|
+
moveCancelCallback: function moveCancelCallback() {
|
|
148
|
+
resolve(true);
|
|
149
|
+
} // 移动开始
|
|
150
|
+
// effect: args.transEffect || 'fade',
|
|
150
151
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
});
|
|
153
|
+
_context.next = 19;
|
|
154
|
+
return five.moveToPano(panoIndex, movePanoOptions);
|
|
155
|
+
|
|
156
|
+
case 19:
|
|
157
|
+
_context.next = 22;
|
|
158
|
+
break;
|
|
159
|
+
|
|
160
|
+
case 21:
|
|
161
|
+
reject(false);
|
|
162
|
+
|
|
163
|
+
case 22:
|
|
164
|
+
case "end":
|
|
165
|
+
return _context.stop();
|
|
166
|
+
}
|
|
154
167
|
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}));
|
|
168
|
+
}, _callee);
|
|
169
|
+
}));
|
|
158
170
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
171
|
+
return function (_x, _x2) {
|
|
172
|
+
return _ref.apply(this, arguments);
|
|
173
|
+
};
|
|
174
|
+
}());
|
|
175
|
+
};
|
|
163
176
|
|
|
164
177
|
var getAnimeParams = function getAnimeParams(args) {
|
|
165
178
|
var currentFiveState = five.state; // latitude
|
|
@@ -239,8 +252,9 @@ var CameraMovementPlugin = function CameraMovementPlugin(five) {
|
|
|
239
252
|
// 移动结束
|
|
240
253
|
moveCancelCallback: function moveCancelCallback() {
|
|
241
254
|
return reject(false);
|
|
242
|
-
}
|
|
243
|
-
|
|
255
|
+
},
|
|
256
|
+
// 移动开始
|
|
257
|
+
effect: 'fade'
|
|
244
258
|
});
|
|
245
259
|
});
|
|
246
260
|
|
package/lib/react/index.d.ts
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { PlayerConfigs } from '../Player/typings';
|
|
2
3
|
import { VreoKeyframeEvent, VreoUnit } from '../typings/VreoUnit';
|
|
3
|
-
export
|
|
4
|
+
export interface VreoProviderProps {
|
|
5
|
+
configs?: Partial<PlayerConfigs>;
|
|
6
|
+
}
|
|
7
|
+
export declare const VreoProvider: React.FC<VreoProviderProps>;
|
|
4
8
|
/**
|
|
5
9
|
* VreoPlayer 命令集合。
|
|
6
10
|
*/
|
|
7
11
|
export interface VreoActionCallbacks {
|
|
8
12
|
/**
|
|
9
13
|
* 载入剧本数据。
|
|
14
|
+
* @param vreoUnit 剧本数据
|
|
15
|
+
* @param currentTime 开始时间戳
|
|
16
|
+
* @param preload 是否开启预载
|
|
17
|
+
* @param force 是否强制载入
|
|
10
18
|
*/
|
|
11
|
-
load: (vreoUnit: VreoUnit, currentTime?: number) => Promise<boolean>;
|
|
19
|
+
load: (vreoUnit: VreoUnit, currentTime?: number, preload?: boolean, force?: boolean) => Promise<boolean>;
|
|
12
20
|
/**
|
|
13
21
|
* 播放。
|
|
14
22
|
*/
|
|
15
|
-
play: () => void;
|
|
23
|
+
play: (currentTime?: number) => void;
|
|
16
24
|
/**
|
|
17
25
|
* 暂停。
|
|
18
26
|
*/
|
|
@@ -34,7 +42,7 @@ export declare function useVreoAction(): {
|
|
|
34
42
|
load: (vreoUnit: VreoUnit, currentTime?: number | undefined) => Promise<boolean>;
|
|
35
43
|
pause: () => void;
|
|
36
44
|
show: () => void;
|
|
37
|
-
play: () => boolean;
|
|
45
|
+
play: (currentTime?: number | undefined) => boolean;
|
|
38
46
|
hide: () => void;
|
|
39
47
|
dispose: () => void;
|
|
40
48
|
};
|
package/lib/react/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var VreoProvider = function VreoProvider(props) {
|
|
|
44
44
|
|
|
45
45
|
var playerRef = React.useRef(null);
|
|
46
46
|
React.useEffect(function () {
|
|
47
|
-
playerRef.current = new _Player.Player(five);
|
|
47
|
+
playerRef.current = new _Player.Player(five, props.configs || {});
|
|
48
48
|
setPlayer(playerRef.current);
|
|
49
49
|
return function () {
|
|
50
50
|
var _playerRef$current;
|
|
@@ -79,8 +79,8 @@ function useVreoAction() {
|
|
|
79
79
|
var load = React.useCallback(function (vreoUnit, currentTime) {
|
|
80
80
|
return player.load(vreoUnit, currentTime);
|
|
81
81
|
}, [player]);
|
|
82
|
-
var play = React.useCallback(function () {
|
|
83
|
-
return player.play();
|
|
82
|
+
var play = React.useCallback(function (currentTime) {
|
|
83
|
+
return player.play(currentTime || 0);
|
|
84
84
|
}, [player]);
|
|
85
85
|
var pause = React.useCallback(function () {
|
|
86
86
|
return player.pause();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createTransMatrix(arr1: number[]): (arr2: number[]) => number[];
|