@realsee/vreo 0.1.6 → 0.2.0-alpha.11
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 +103 -16
- 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 +11 -11
- 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.VreoKeyframeEnum.html +14 -12
- package/docs/enums/fivePlugins.CameraMovementEffect.html +1 -1
- package/docs/enums/fivePlugins.Rotation.html +1 -1
- package/docs/index.html +52 -19
- package/docs/interfaces/Player.CustomVreoKeyframeProps.html +1 -0
- package/docs/interfaces/Player.PlayerConfigs.html +4 -2
- 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 +8 -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 +1 -1
- package/lib/Player/index.js +98 -11
- package/lib/Player/modules/Drawer/index.js +1 -1
- 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 +1 -0
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +6 -2
- package/lib/Player/modules/VideoAgent/VideoAgentScene.d.ts +4 -1
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +21 -6
- package/lib/Player/modules/VideoAgent/index.d.ts +2 -0
- package/lib/Player/modules/VideoAgent/index.js +1 -1
- package/lib/Player/modules/keyframes/BgMusic/index.d.ts +2 -0
- package/lib/Player/modules/keyframes/BgMusic/index.js +76 -0
- package/lib/Player/modules/keyframes/CameraMovement/index.js +41 -5
- package/lib/Player/modules/keyframes/InfoPanel/index.js +105 -23
- package/lib/Player/modules/keyframes/ModelVideo/index.js +47 -10
- 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 +71 -12
- package/lib/Player/typings.d.ts +19 -1
- package/lib/fivePlugins/CameraMovementPlugin/index.js +104 -90
- package/lib/fivePlugins/CameraMovementPlugin/typings.d.ts +1 -0
- package/lib/react/index.d.ts +10 -2
- package/lib/react/index.js +1 -1
- package/lib/shared-utils/createTransMatrix.d.ts +1 -0
- package/lib/shared-utils/createTransMatrix.js +43 -0
- package/lib/typings/VreoUnit.d.ts +47 -7
- package/lib/typings/VreoUnit.js +15 -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 +6 -1
- package/resources/Player/Controller.ts +12 -0
- package/resources/Player/custom/SpatialScenePanel/index.tsx +264 -0
- package/resources/Player/index.tsx +56 -2
- package/resources/Player/modules/Drawer/index.tsx +1 -1
- package/resources/Player/modules/PopUp/index.tsx +26 -0
- package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +5 -4
- package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +11 -2
- package/resources/Player/modules/VideoAgent/index.tsx +3 -2
- package/resources/Player/modules/keyframes/BgMusic/index.tsx +66 -0
- package/resources/Player/modules/keyframes/CameraMovement/index.tsx +7 -3
- package/resources/Player/modules/keyframes/InfoPanel/index.tsx +109 -11
- package/resources/Player/modules/keyframes/ModelVideo/index.tsx +38 -5
- 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 +75 -12
- package/resources/Player/typings.ts +21 -1
- package/resources/fivePlugins/CameraMovementPlugin/index.ts +59 -48
- package/resources/fivePlugins/CameraMovementPlugin/typings.ts +2 -1
- package/resources/react/index.tsx +12 -3
- package/resources/shared-utils/createTransMatrix.ts +12 -0
- package/resources/typings/VreoUnit.ts +56 -7
- package/stylesheets/custom/SpatialScenePanel.css +309 -0
- package/stylesheets/default.css +127 -9
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.BgMusic = BgMusic;
|
|
9
|
+
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _VreoUnit = require("../../../../typings/VreoUnit");
|
|
13
|
+
|
|
14
|
+
var _hooks = require("../../../hooks");
|
|
15
|
+
|
|
16
|
+
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); }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
+
|
|
20
|
+
function BgMusic() {
|
|
21
|
+
var controller = (0, _hooks.useController)();
|
|
22
|
+
var timeoutIdRef = React.useRef(null);
|
|
23
|
+
var cleanTimeout = React.useCallback(function () {
|
|
24
|
+
if (timeoutIdRef.current) {
|
|
25
|
+
clearTimeout(timeoutIdRef.current);
|
|
26
|
+
timeoutIdRef.current = null;
|
|
27
|
+
}
|
|
28
|
+
}, []);
|
|
29
|
+
React.useEffect(function () {
|
|
30
|
+
var audio = new Audio();
|
|
31
|
+
audio.setAttribute('id', 'vreo-singleton-bgmusic');
|
|
32
|
+
audio.style.display = 'none';
|
|
33
|
+
audio.setAttribute('playsinline', 'true');
|
|
34
|
+
audio.loop = true;
|
|
35
|
+
document.body.append(audio);
|
|
36
|
+
|
|
37
|
+
var callback = function callback(keyframe) {
|
|
38
|
+
var start = keyframe.start,
|
|
39
|
+
end = keyframe.end;
|
|
40
|
+
var _ref = keyframe.data,
|
|
41
|
+
url = _ref.url;
|
|
42
|
+
audio.src = url;
|
|
43
|
+
|
|
44
|
+
var playCallback = function playCallback() {
|
|
45
|
+
audio.play();
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
audio.addEventListener('canplaythrough', playCallback);
|
|
49
|
+
cleanTimeout();
|
|
50
|
+
|
|
51
|
+
var cleanAudio = function cleanAudio() {
|
|
52
|
+
audio.pause();
|
|
53
|
+
audio.currentTime = 0;
|
|
54
|
+
audio.src = '';
|
|
55
|
+
cleanTimeout();
|
|
56
|
+
audio.removeEventListener('canplaythrough', playCallback);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
var duration = end - start || 5000;
|
|
60
|
+
timeoutIdRef.current = setTimeout(function () {
|
|
61
|
+
cleanAudio();
|
|
62
|
+
}, duration);
|
|
63
|
+
controller.once('paused', function () {
|
|
64
|
+
cleanAudio();
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
controller.on(_VreoUnit.VreoKeyframeEnum.BgMusic, callback);
|
|
69
|
+
return function () {
|
|
70
|
+
controller.off(_VreoUnit.VreoKeyframeEnum.BgMusic, callback);
|
|
71
|
+
document.body.removeChild(audio);
|
|
72
|
+
cleanTimeout();
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
76
|
+
}
|
|
@@ -45,13 +45,49 @@ function CameraMovement() {
|
|
|
45
45
|
cameraMovementData = data;
|
|
46
46
|
effect = cameraMovementData.effect;
|
|
47
47
|
|
|
48
|
-
if (effect === _typings.CameraMovementEffect.Rotate) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
ref.current.move(data, end - start);
|
|
48
|
+
if (!(effect === _typings.CameraMovementEffect.Rotate)) {
|
|
49
|
+
_context.next = 9;
|
|
50
|
+
break;
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
|
|
53
|
+
_context.next = 7;
|
|
54
|
+
return ref.current.rotate(data, end - start);
|
|
55
|
+
|
|
56
|
+
case 7:
|
|
57
|
+
_context.next = 21;
|
|
58
|
+
break;
|
|
59
|
+
|
|
60
|
+
case 9:
|
|
61
|
+
if (!(effect === _typings.CameraMovementEffect.Move)) {
|
|
62
|
+
_context.next = 14;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
_context.next = 12;
|
|
67
|
+
return ref.current.move(data, end - start);
|
|
68
|
+
|
|
69
|
+
case 12:
|
|
70
|
+
_context.next = 21;
|
|
71
|
+
break;
|
|
72
|
+
|
|
73
|
+
case 14:
|
|
74
|
+
if (!(cameraMovementData.panoIndex !== undefined && cameraMovementData.panoIndex !== five.panoIndex)) {
|
|
75
|
+
_context.next = 19;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
_context.next = 17;
|
|
80
|
+
return ref.current.move(data, end - start);
|
|
81
|
+
|
|
82
|
+
case 17:
|
|
83
|
+
_context.next = 21;
|
|
84
|
+
break;
|
|
85
|
+
|
|
86
|
+
case 19:
|
|
87
|
+
_context.next = 21;
|
|
88
|
+
return ref.current.rotate(data, end - start);
|
|
89
|
+
|
|
90
|
+
case 21:
|
|
55
91
|
case "end":
|
|
56
92
|
return _context.stop();
|
|
57
93
|
}
|
|
@@ -18,27 +18,47 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
18
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
19
|
|
|
20
20
|
function InfoPanelImg(_ref) {
|
|
21
|
-
var url = _ref.url
|
|
21
|
+
var url = _ref.url,
|
|
22
|
+
children = _ref.children;
|
|
22
23
|
return /*#__PURE__*/React.createElement("div", {
|
|
23
24
|
className: "vreo-infoPanel vreo-infoPanel--img"
|
|
24
|
-
}, /*#__PURE__*/React.createElement("
|
|
25
|
+
}, children, /*#__PURE__*/React.createElement("div", {
|
|
25
26
|
className: "vreo-infoPanelImg",
|
|
26
|
-
|
|
27
|
+
style: {
|
|
28
|
+
backgroundImage: "url(".concat(url, ")")
|
|
29
|
+
}
|
|
27
30
|
}));
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
function InfoPanelVideo(_ref2) {
|
|
31
|
-
var url = _ref2.url
|
|
34
|
+
var url = _ref2.url,
|
|
35
|
+
children = _ref2.children;
|
|
32
36
|
return /*#__PURE__*/React.createElement("div", {
|
|
33
37
|
className: "vreo-infoPanel vreo-infoPanel--video"
|
|
38
|
+
}, children, /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
className: "vreo-infoPanelWrapper"
|
|
34
40
|
}, /*#__PURE__*/React.createElement("video", {
|
|
35
41
|
playsInline: true,
|
|
36
42
|
autoPlay: true,
|
|
37
43
|
className: "vreo-infoPanelVideo",
|
|
38
44
|
src: url
|
|
39
|
-
}));
|
|
45
|
+
})));
|
|
40
46
|
}
|
|
41
47
|
|
|
48
|
+
var Title = function Title(props) {
|
|
49
|
+
if (!props.title && !props.subTitle) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: "vreo-infoPanel-title"
|
|
55
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
56
|
+
className: "vreo-infoPanel-t1"
|
|
57
|
+
}, props.title), /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: "vreo-infoPanel-t2"
|
|
59
|
+
}, props.subTitle));
|
|
60
|
+
};
|
|
61
|
+
|
|
42
62
|
function InfoPanel() {
|
|
43
63
|
var timeoutRef = React.useRef();
|
|
44
64
|
var controller = (0, _hooks.useController)();
|
|
@@ -54,29 +74,91 @@ function InfoPanel() {
|
|
|
54
74
|
end = keyframe.end,
|
|
55
75
|
data = keyframe.data;
|
|
56
76
|
var infoPanelData = data;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
77
|
+
var title = infoPanelData.title,
|
|
78
|
+
subTitle = infoPanelData.subTitle,
|
|
79
|
+
style = infoPanelData.style;
|
|
80
|
+
|
|
81
|
+
do {
|
|
82
|
+
if (style === _VreoUnit.InfoPanelStyleEnum.PopUp) {
|
|
83
|
+
if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
|
|
84
|
+
controller.openPopUp( /*#__PURE__*/React.createElement(InfoPanelImg, {
|
|
85
|
+
url: infoPanelData.url
|
|
86
|
+
}, /*#__PURE__*/React.createElement(Title, {
|
|
87
|
+
title: title,
|
|
88
|
+
subTitle: subTitle
|
|
89
|
+
})));
|
|
90
|
+
} else if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Video) {
|
|
91
|
+
controller.openPopUp( /*#__PURE__*/React.createElement(InfoPanelVideo, {
|
|
92
|
+
url: infoPanelData.url
|
|
93
|
+
}, /*#__PURE__*/React.createElement(Title, {
|
|
94
|
+
title: title,
|
|
95
|
+
subTitle: subTitle
|
|
96
|
+
})));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Image) {
|
|
103
|
+
controller.openDrawer({
|
|
104
|
+
content: /*#__PURE__*/React.createElement(InfoPanelImg, {
|
|
105
|
+
url: infoPanelData.url
|
|
106
|
+
}, /*#__PURE__*/React.createElement(Title, {
|
|
107
|
+
title: title,
|
|
108
|
+
subTitle: subTitle
|
|
109
|
+
})),
|
|
110
|
+
height: '60vh'
|
|
111
|
+
});
|
|
112
|
+
} else if (infoPanelData.type === _VreoUnit.InfoPanelTypeEnum.Video) {
|
|
113
|
+
controller.openDrawer({
|
|
114
|
+
content: /*#__PURE__*/React.createElement(InfoPanelVideo, {
|
|
115
|
+
url: infoPanelData.url
|
|
116
|
+
}, /*#__PURE__*/React.createElement(Title, {
|
|
117
|
+
title: title,
|
|
118
|
+
subTitle: subTitle
|
|
119
|
+
})),
|
|
120
|
+
height: '60vh'
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
} while (false);
|
|
73
124
|
|
|
74
125
|
timeoutRef.current = setTimeout(function () {
|
|
75
|
-
|
|
126
|
+
controller.openDrawer(false);
|
|
127
|
+
controller.openPopUp(false);
|
|
76
128
|
}, end - start);
|
|
77
129
|
};
|
|
78
130
|
|
|
79
|
-
controller.on(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback);
|
|
131
|
+
controller.on(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback); // Object.assign(window, {
|
|
132
|
+
// $setInfoPanel: () => {
|
|
133
|
+
// controller.openPopUp(
|
|
134
|
+
// // <InfoPanelImg url='//vrlab-static.ljcdn.com/release/web/psq/a.8e868cb2.gif' />
|
|
135
|
+
// // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/b.f9a1ed52.png' />
|
|
136
|
+
// // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/c.4f88c112.png' />
|
|
137
|
+
// // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/seesay/tools/cat_music___f68fb9bbe1f7cd6d00a16456dd0b09ad.gif' />
|
|
138
|
+
// <InfoPanelImg url="http://vrlab-public.ljcdn.com/common/images/web/d94e1bd7-0311-4b20-9c41-a1294fe43554.png">
|
|
139
|
+
// <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
|
|
140
|
+
// </InfoPanelImg>
|
|
141
|
+
// // <InfoPanelVideo url="//vrlab-public.ljcdn.com/release/seesay/tools/2022011713142___b320f74a5e1b5ad4bb46b4dc69d73ecc.mp4">
|
|
142
|
+
// // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
|
|
143
|
+
// // </InfoPanelVideo>
|
|
144
|
+
// )
|
|
145
|
+
// },
|
|
146
|
+
// $setInfoPanel2: () => {
|
|
147
|
+
// controller.openPopUp(
|
|
148
|
+
// <InfoPanelImg url='//vrlab-static.ljcdn.com/release/web/psq/a.8e868cb2.gif' />
|
|
149
|
+
// // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/b.f9a1ed52.png' />
|
|
150
|
+
// // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/web/psq/c.4f88c112.png' />
|
|
151
|
+
// // <InfoPanelImg url='//vrlab-public.ljcdn.com/release/seesay/tools/cat_music___f68fb9bbe1f7cd6d00a16456dd0b09ad.gif' />
|
|
152
|
+
// // <InfoPanelImg url="http://vrlab-public.ljcdn.com/common/images/web/d94e1bd7-0311-4b20-9c41-a1294fe43554.png">
|
|
153
|
+
// // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
|
|
154
|
+
// // </InfoPanelImg>
|
|
155
|
+
// // <InfoPanelVideo url="//vrlab-public.ljcdn.com/release/seesay/tools/2022011713142___b320f74a5e1b5ad4bb46b4dc69d73ecc.mp4">
|
|
156
|
+
// // <Title title="场景联动抓拍图片" subTitle={'2022.02.17 14:00'} />
|
|
157
|
+
// // </InfoPanelVideo>
|
|
158
|
+
// )
|
|
159
|
+
// },
|
|
160
|
+
// })
|
|
161
|
+
|
|
80
162
|
return function () {
|
|
81
163
|
controller.off(_VreoUnit.VreoKeyframeEnum.InfoPanel, callback);
|
|
82
164
|
|
|
@@ -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
|
-
video_src: videoSrc
|
|
52
|
-
video_poster_src: videoPosterSrc
|
|
53
|
-
points:
|
|
88
|
+
video_src: videoSrc,
|
|
89
|
+
video_poster_src: videoPosterSrc,
|
|
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
|
}
|
|
@@ -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,30 +22,89 @@ 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 deafultWorkRef = React.useRef(null);
|
|
26
|
+
var updateWorkRef = React.useRef(null); // 恢复默认 VR
|
|
27
|
+
|
|
28
|
+
var restoreCallback = React.useCallback(function () {
|
|
29
|
+
// 先清理掉 之前的 VR 数据备份
|
|
30
|
+
updateWorkRef.current = null;
|
|
31
|
+
|
|
32
|
+
if (deafultWorkRef.current) {
|
|
33
|
+
var work = (0, _five.parseWork)(deafultWorkRef.current);
|
|
34
|
+
five.load(work);
|
|
35
|
+
}
|
|
36
|
+
}, []); // 暂停时: 恢复默认 VR
|
|
37
|
+
|
|
38
|
+
var pausedCallback = React.useCallback(function () {
|
|
39
|
+
if (deafultWorkRef.current) {
|
|
40
|
+
var work = (0, _five.parseWork)(deafultWorkRef.current);
|
|
41
|
+
Object.assign(window, {
|
|
42
|
+
$rawWork: work
|
|
43
|
+
});
|
|
44
|
+
five.load(work);
|
|
45
|
+
}
|
|
46
|
+
}, []); // 播放时:如果暂停前有更新 VR 需要还原
|
|
47
|
+
|
|
48
|
+
var playingCallback = React.useCallback(function () {
|
|
49
|
+
if (!updateWorkRef.current) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
five.load(updateWorkRef.current);
|
|
54
|
+
}, []);
|
|
25
55
|
React.useEffect(function () {
|
|
26
56
|
var callback = function callback(keyframe) {
|
|
27
57
|
var _five$work;
|
|
28
58
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
59
|
+
if (!deafultWorkRef.current) {
|
|
60
|
+
deafultWorkRef.current = five.work.raw.works;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
var data = keyframe.data; // 如果数据中有新 work 数据,则直接载入
|
|
33
64
|
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
65
|
+
if (data.work) {
|
|
66
|
+
updateWorkRef.current = (0, _five.parseWork)(data.work);
|
|
67
|
+
five.load(updateWorkRef.current);
|
|
68
|
+
return;
|
|
38
69
|
}
|
|
39
70
|
|
|
40
|
-
var
|
|
71
|
+
var lastRawWork = (_five$work = five.work) === null || _five$work === void 0 ? void 0 : _five$work.raw.works[0]; // 动态场景:不提供完成的签名数据,需重新整理
|
|
41
72
|
|
|
42
|
-
|
|
73
|
+
if (data.dynamic_scene && !data.panorama) {
|
|
74
|
+
var lastWork = JSON.parse(lastRawWork);
|
|
75
|
+
var panorama = lastWork.panorama;
|
|
76
|
+
var index = data.dynamic_scene.images.index;
|
|
77
|
+
panorama.list[index] = data.dynamic_scene.images;
|
|
78
|
+
data.panorama = panorama;
|
|
79
|
+
delete data.dynamic_scene;
|
|
80
|
+
}
|
|
81
|
+
|
|
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);
|
|
43
89
|
};
|
|
44
90
|
|
|
45
|
-
controller.on(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback);
|
|
91
|
+
controller.on(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback); // 离开 将之前的内容清空
|
|
92
|
+
|
|
93
|
+
controller.on(_VreoUnit.VreoKeyframeEnum.Exit, restoreCallback); // 新载入数据 将之前的内容清空
|
|
94
|
+
|
|
95
|
+
controller.on('loaded', restoreCallback); // 暂停 回到默认状态
|
|
96
|
+
|
|
97
|
+
controller.on('paused', pausedCallback); // 播放 回归暂停前状态
|
|
98
|
+
|
|
99
|
+
controller.on('playing', playingCallback);
|
|
46
100
|
return function () {
|
|
101
|
+
// 清理事件监听
|
|
47
102
|
controller.off(_VreoUnit.VreoKeyframeEnum.UpdateVRPanorama, callback);
|
|
103
|
+
controller.off(_VreoUnit.VreoKeyframeEnum.Exit, restoreCallback);
|
|
104
|
+
controller.off('loaded', restoreCallback);
|
|
105
|
+
controller.off('paused', pausedCallback);
|
|
106
|
+
controller.off('playing', playingCallback);
|
|
48
107
|
};
|
|
49
|
-
}, [
|
|
108
|
+
}, []);
|
|
50
109
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
51
110
|
}
|
package/lib/Player/typings.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
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';
|
|
2
5
|
export interface PlayerConfigs {
|
|
3
6
|
containter?: ReactDOM.Container;
|
|
4
7
|
keyframeMap: VreoKeyframeConfigMap;
|
|
@@ -11,4 +14,19 @@ export interface PlayerConfigs {
|
|
|
11
14
|
videoEffect?: HTMLVideoElement;
|
|
12
15
|
modelTVVideo?: HTMLVideoElement;
|
|
13
16
|
};
|
|
17
|
+
videoAgentMeshOptions?: VideoAgentMeshOptions;
|
|
18
|
+
/**
|
|
19
|
+
* 如果需要在 底部面板添加自定义内容,可以传递个 React 组件。
|
|
20
|
+
*/
|
|
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;
|
|
14
32
|
}
|