@realsee/vreo 0.2.0-alpha.1 → 0.2.0-alpha.10
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 +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.VreoKeyframeEnum.html +13 -13
- 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 +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 +1 -1
- package/lib/Player/index.js +94 -10
- 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 +5 -1
- 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 +43 -6
- package/lib/Player/modules/keyframes/PanoTextLabel/index.js +4 -12
- package/lib/Player/modules/keyframes/Prompter/index.js +2 -15
- 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 +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 +18 -6
- package/lib/typings/VreoUnit.js +14 -6
- package/package.json +4 -4
- 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 +53 -2
- package/resources/Player/modules/PopUp/index.tsx +26 -0
- package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +4 -3
- 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 +35 -2
- package/resources/Player/modules/keyframes/PanoTextLabel/index.tsx +2 -2
- package/resources/Player/modules/keyframes/Prompter/index.tsx +3 -14
- 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 +12 -3
- package/resources/shared-utils/createTransMatrix.ts +12 -0
- package/resources/typings/VreoUnit.ts +27 -7
- package/stylesheets/custom/SpatialScenePanel.css +309 -0
- package/stylesheets/default.css +92 -7
|
@@ -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,14 +1,22 @@
|
|
|
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
|
*/
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createTransMatrix(arr1: number[]): (arr2: number[]) => number[];
|
|
@@ -0,0 +1,43 @@
|
|
|
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.createTransMatrix = createTransMatrix;
|
|
9
|
+
|
|
10
|
+
var THREE = _interopRequireWildcard(require("three"));
|
|
11
|
+
|
|
12
|
+
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); }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
17
|
+
|
|
18
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19
|
+
|
|
20
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21
|
+
|
|
22
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
23
|
+
|
|
24
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
|
+
|
|
26
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
27
|
+
|
|
28
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
29
|
+
|
|
30
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
31
|
+
|
|
32
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
33
|
+
|
|
34
|
+
function createTransMatrix(arr1) {
|
|
35
|
+
var matrix4 = new THREE.Matrix4();
|
|
36
|
+
matrix4.fromArray(arr1);
|
|
37
|
+
return function (arr2) {
|
|
38
|
+
var vector3 = _construct(THREE.Vector3, _toConsumableArray(arr2));
|
|
39
|
+
|
|
40
|
+
vector3.applyMatrix4(matrix4);
|
|
41
|
+
return vector3.toArray();
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -61,7 +61,7 @@ export declare type VreoKeyframeConfigMap = {
|
|
|
61
61
|
* 剧本关键帧
|
|
62
62
|
*/
|
|
63
63
|
export interface VreoKeyframe {
|
|
64
|
-
uuid
|
|
64
|
+
uuid?: string;
|
|
65
65
|
type: VreoKeyframeEnum;
|
|
66
66
|
start: number;
|
|
67
67
|
end: number;
|
|
@@ -95,14 +95,16 @@ export declare type VreoKeyframeEvent = {
|
|
|
95
95
|
[key in VreoKeyframeEnum]: (keyframe: VreoKeyframe) => void;
|
|
96
96
|
} & {
|
|
97
97
|
loaded: (vreoUnit: VreoUnit) => void;
|
|
98
|
-
paused: () => void;
|
|
98
|
+
paused: (ended?: boolean) => void;
|
|
99
99
|
playing: () => void;
|
|
100
|
+
unknownKeyframeType: (keyframe: Record<string, any>) => void;
|
|
100
101
|
};
|
|
101
102
|
/**
|
|
102
103
|
* 相机运动
|
|
103
104
|
*/
|
|
104
105
|
export declare type CameraMovementData = {
|
|
105
|
-
effect
|
|
106
|
+
effect?: CameraMovementEffect;
|
|
107
|
+
transEffect?: "fly" | "fade" | "instant";
|
|
106
108
|
mode: Mode;
|
|
107
109
|
panoIndex: number;
|
|
108
110
|
loop?: boolean;
|
|
@@ -145,9 +147,13 @@ export interface Vertex {
|
|
|
145
147
|
z: number;
|
|
146
148
|
}
|
|
147
149
|
/**
|
|
148
|
-
*
|
|
150
|
+
* 矩形顶点
|
|
149
151
|
*/
|
|
150
152
|
export declare type QuadrangleVertexs = [Vertex, Vertex, Vertex, Vertex];
|
|
153
|
+
/**
|
|
154
|
+
* 顶点数组
|
|
155
|
+
*/
|
|
156
|
+
export declare type Vertexs = Vertex[];
|
|
151
157
|
/**
|
|
152
158
|
* 视频广告
|
|
153
159
|
*/
|
|
@@ -163,7 +169,8 @@ export declare type ModelVideoData = {
|
|
|
163
169
|
/**
|
|
164
170
|
* 视频映射在模型中的顶点
|
|
165
171
|
*/
|
|
166
|
-
vertexs: QuadrangleVertexs;
|
|
172
|
+
vertexs: QuadrangleVertexs | Vertexs;
|
|
173
|
+
matrixWorld?: number[];
|
|
167
174
|
};
|
|
168
175
|
/**
|
|
169
176
|
* 全景文本标签
|
|
@@ -209,13 +216,18 @@ export declare enum InfoPanelTypeEnum {
|
|
|
209
216
|
Image = "Image",
|
|
210
217
|
Video = "Video"
|
|
211
218
|
}
|
|
219
|
+
export declare enum InfoPanelStyleEnum {
|
|
220
|
+
Drawer = "Drawer",
|
|
221
|
+
PopUp = "PopUp"
|
|
222
|
+
}
|
|
212
223
|
/**
|
|
213
224
|
* 信息面板
|
|
214
225
|
*/
|
|
215
226
|
export declare type InfoPanelData = {
|
|
216
227
|
type: InfoPanelTypeEnum;
|
|
228
|
+
style?: InfoPanelStyleEnum;
|
|
217
229
|
url: string;
|
|
218
|
-
|
|
230
|
+
title?: string;
|
|
219
231
|
subTitle?: string;
|
|
220
232
|
};
|
|
221
233
|
/**
|
package/lib/typings/VreoUnit.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.VreoKeyframeEnum = exports.PanoTagEnum = exports.PanoEffectEnum = exports.InfoPanelTypeEnum = void 0;
|
|
6
|
+
exports.VreoKeyframeEnum = exports.PanoTagEnum = exports.PanoEffectEnum = exports.InfoPanelTypeEnum = exports.InfoPanelStyleEnum = void 0;
|
|
7
7
|
var VreoKeyframeEnum;
|
|
8
8
|
/**
|
|
9
9
|
* 支持自定义剧本关键帧配置项
|
|
@@ -55,13 +55,21 @@ exports.PanoEffectEnum = PanoEffectEnum;
|
|
|
55
55
|
* 信息面板类型枚举
|
|
56
56
|
*/
|
|
57
57
|
var InfoPanelTypeEnum;
|
|
58
|
-
/**
|
|
59
|
-
* 信息面板
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
58
|
exports.InfoPanelTypeEnum = InfoPanelTypeEnum;
|
|
63
59
|
|
|
64
60
|
(function (InfoPanelTypeEnum) {
|
|
65
61
|
InfoPanelTypeEnum["Image"] = "Image";
|
|
66
62
|
InfoPanelTypeEnum["Video"] = "Video";
|
|
67
|
-
})(InfoPanelTypeEnum || (exports.InfoPanelTypeEnum = InfoPanelTypeEnum = {}));
|
|
63
|
+
})(InfoPanelTypeEnum || (exports.InfoPanelTypeEnum = InfoPanelTypeEnum = {}));
|
|
64
|
+
|
|
65
|
+
var InfoPanelStyleEnum;
|
|
66
|
+
/**
|
|
67
|
+
* 信息面板
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
exports.InfoPanelStyleEnum = InfoPanelStyleEnum;
|
|
71
|
+
|
|
72
|
+
(function (InfoPanelStyleEnum) {
|
|
73
|
+
InfoPanelStyleEnum["Drawer"] = "Drawer";
|
|
74
|
+
InfoPanelStyleEnum["PopUp"] = "PopUp";
|
|
75
|
+
})(InfoPanelStyleEnum || (exports.InfoPanelStyleEnum = InfoPanelStyleEnum = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@realsee/vreo",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.10",
|
|
4
4
|
"description": "Vreo (VR Video 缩写) 是基于如视三维渲染引擎 Five 和 用户界面构建库 React 实现的如视 3D 空间剧本播放器。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"realsee",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"LICENSE"
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
|
-
"dev": "vite --port=3088",
|
|
21
|
+
"dev": "vite --port=3088 --host 0.0.0.0",
|
|
22
22
|
"build": "tsc && vite build",
|
|
23
23
|
"preview": "vite preview",
|
|
24
24
|
"docs": "npx typedoc",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"@babel/preset-env": "^7.16.4",
|
|
36
36
|
"@babel/preset-react": "^7.16.0",
|
|
37
37
|
"@babel/preset-typescript": "^7.16.0",
|
|
38
|
+
"@realsee/dnalogel": "^0.1.7-alpha.10",
|
|
38
39
|
"@realsee/five": "^5.0.0-alpha.103",
|
|
39
40
|
"@types/offscreencanvas": "^2019.6.4",
|
|
40
41
|
"@types/react": "^17.0.37",
|
|
@@ -53,7 +54,6 @@
|
|
|
53
54
|
"@tweenjs/tween.js": "18.6.4",
|
|
54
55
|
"classnames": "^2.3.1",
|
|
55
56
|
"mobx": "^6.3.7",
|
|
56
|
-
"mobx-react": "^7.2.1"
|
|
57
|
-
"react-transition-group": "^4.4.2"
|
|
57
|
+
"mobx-react": "^7.2.1"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
const BLANK_AUDIO = ''
|
|
3
|
+
+ 'data:audio/mpeg;base64,'
|
|
4
|
+
+ '//uQxAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAADAAAGhgBVVVVVVVVVVVVVVVVVVVVVVVV'
|
|
5
|
+
+ 'VVVVVVVVVVVVVVVVVVVWqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr///////////'
|
|
6
|
+
+ '////////////////////////////////8AAAA5TEFNRTMuOThyAc0AAAAAAAAAABSAJAiqQgAAg'
|
|
7
|
+
+ 'AAABobxtI73AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
|
|
8
|
+
+ 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
|
|
9
|
+
+ 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
|
|
10
|
+
+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VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU=';
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
export function createHTMLAudioElement(): HTMLAudioElement {
|
|
37
|
+
const ndAudio = document.querySelector('#vreo-playController-audio')
|
|
38
|
+
if (ndAudio) {
|
|
39
|
+
return ndAudio as HTMLAudioElement
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const audio = document.createElement('audio')
|
|
43
|
+
audio.style.display = 'none'
|
|
44
|
+
audio.setAttribute('id', 'vreo-playController-audio')
|
|
45
|
+
audio.controls = false
|
|
46
|
+
document.body.appendChild(audio)
|
|
47
|
+
audio.src = BLANK_AUDIO
|
|
48
|
+
|
|
49
|
+
// 触发一次播放
|
|
50
|
+
Promise.resolve(async () => await audio.play())
|
|
51
|
+
|
|
52
|
+
return audio
|
|
53
|
+
}
|