@realsee/vreo 0.1.6-alpha.1 → 0.1.6-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Player/modules/VideoAgent/VideoAgentMesh.js +1 -1
- package/lib/Player/modules/VideoAgent/VideoAgentScene.js +19 -5
- package/lib/Player/modules/keyframes/ModelVideo/index.js +2 -2
- package/lib/Player/modules/keyframes/UpdateVRPanorama/index.js +9 -5
- package/lib/typings/VreoUnit.d.ts +2 -1
- package/package.json +2 -2
- package/resources/Player/modules/VideoAgent/VideoAgentMesh.ts +1 -1
- package/resources/Player/modules/VideoAgent/VideoAgentScene.ts +9 -0
- package/resources/Player/modules/keyframes/ModelVideo/index.tsx +2 -2
- package/resources/Player/modules/keyframes/UpdateVRPanorama/index.tsx +7 -5
- package/resources/typings/VreoUnit.ts +2 -1
|
@@ -247,7 +247,7 @@ var VideoAgentMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
|
247
247
|
switch (_context3.prev = _context3.next) {
|
|
248
248
|
case 0:
|
|
249
249
|
videoUrl = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : '';
|
|
250
|
-
videoUrl =
|
|
250
|
+
videoUrl = videoUrl || '';
|
|
251
251
|
|
|
252
252
|
if (videoUrl) {
|
|
253
253
|
_context3.next = 10;
|
|
@@ -35,9 +35,19 @@ var VideoAgentScene = function VideoAgentScene(container) {
|
|
|
35
35
|
}));
|
|
36
36
|
|
|
37
37
|
_defineProperty(this, "run", function () {
|
|
38
|
-
|
|
38
|
+
var _this$videoAgentMesh$;
|
|
39
|
+
|
|
40
|
+
var domElement = _this.renderer.domElement; // 视频开始 1s 不渲染:规避某些设备黑屏闪烁问题。视频前 2s 是最好是静默的。
|
|
41
|
+
|
|
39
42
|
if (!(_this.videoAgentMesh.paused || _this.videoAgentMesh.freeze) && _this.videoAgentMesh.currentTime > 1000) {
|
|
40
43
|
_this.renderer.render(_this.scene, _this.camera);
|
|
44
|
+
} // 兼容非视频场景
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
if (!((_this$videoAgentMesh$ = _this.videoAgentMesh.videoUrl) !== null && _this$videoAgentMesh$ !== void 0 && _this$videoAgentMesh$.endsWith('.mp4'))) {
|
|
48
|
+
if (domElement.style.display !== 'none') domElement.style.display = 'none';
|
|
49
|
+
} else {
|
|
50
|
+
if (domElement.style.display !== 'block') domElement.style.display = 'block';
|
|
41
51
|
}
|
|
42
52
|
|
|
43
53
|
requestAnimationFrame(_this.run);
|
|
@@ -56,14 +66,18 @@ var VideoAgentScene = function VideoAgentScene(container) {
|
|
|
56
66
|
width: container.offsetWidth,
|
|
57
67
|
height: container.offsetHeight
|
|
58
68
|
};
|
|
59
|
-
var
|
|
60
|
-
|
|
69
|
+
var _domElement = this.renderer.domElement;
|
|
70
|
+
|
|
71
|
+
_domElement.classList.add('VideoAgent-canvas');
|
|
72
|
+
|
|
61
73
|
this.renderer.setSize(state.width * window.devicePixelRatio, state.height * window.devicePixelRatio);
|
|
62
|
-
|
|
74
|
+
|
|
75
|
+
_domElement.setAttribute('style', "width: ".concat(state.width, "px;height: ").concat(state.height, "px;"));
|
|
76
|
+
|
|
63
77
|
this.videoAgentMesh = new _VideoAgentMesh.VideoAgentMesh(480, 270, 1, 1);
|
|
64
78
|
|
|
65
79
|
if (needRender) {
|
|
66
|
-
container.append(
|
|
80
|
+
container.append(_domElement);
|
|
67
81
|
this.scene.add(this.videoAgentMesh);
|
|
68
82
|
this.run();
|
|
69
83
|
}
|
|
@@ -48,8 +48,8 @@ function ModelVideo() {
|
|
|
48
48
|
ref.current.disable();
|
|
49
49
|
_context.next = 6;
|
|
50
50
|
return ref.current.load({
|
|
51
|
-
video_src: videoSrc
|
|
52
|
-
video_poster_src: videoPosterSrc
|
|
51
|
+
video_src: videoSrc,
|
|
52
|
+
video_poster_src: videoPosterSrc,
|
|
53
53
|
points: [vertexs]
|
|
54
54
|
}, (_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
55
|
|
|
@@ -28,11 +28,15 @@ function UpdateVRPanorama() {
|
|
|
28
28
|
|
|
29
29
|
var _ref = keyframe.data,
|
|
30
30
|
panoIndex = _ref.panoIndex,
|
|
31
|
-
images = _ref.images
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
images = _ref.images,
|
|
32
|
+
work = _ref.work;
|
|
33
|
+
|
|
34
|
+
if (work) {
|
|
35
|
+
five.load(work);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
console.warn('not support.');
|
|
36
40
|
var newWorkJSON = JSON.parse(JSON.stringify((_five$work = five.work) === null || _five$work === void 0 ? void 0 : _five$work.raw.work)); // // 原Work数据不能被修改
|
|
37
41
|
|
|
38
42
|
if (newWorkJSON.panorama && newWorkJSON.panorama.list && newWorkJSON.panorama.list[panoIndex]) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Mode, Pose, WorkCubeImage } from '@realsee/five';
|
|
1
|
+
import { Mode, Pose, WorkCubeImage, Work } from '@realsee/five';
|
|
2
2
|
import { CameraMovementEffect, Rotation } from '../fivePlugins/CameraMovementPlugin/typings';
|
|
3
3
|
export declare enum VreoKeyframeEnum {
|
|
4
4
|
/** 运镜 */
|
|
@@ -115,6 +115,7 @@ export declare type PrompterData = {
|
|
|
115
115
|
export declare type UpdateVRPanoramaData = {
|
|
116
116
|
panoIndex: number;
|
|
117
117
|
images: WorkCubeImage;
|
|
118
|
+
work?: Work;
|
|
118
119
|
};
|
|
119
120
|
/**
|
|
120
121
|
* 顶点
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@realsee/vreo",
|
|
3
|
-
"version": "0.1.6-alpha.
|
|
3
|
+
"version": "0.1.6-alpha.5",
|
|
4
4
|
"description": "Vreo (VR Video 缩写) 是基于如视三维渲染引擎 Five 和 用户界面构建库 React 实现的如视 3D 空间剧本播放器。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"realsee",
|
|
@@ -35,7 +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/five": "^5.0.0-alpha.
|
|
38
|
+
"@realsee/five": "^5.0.0-alpha.91",
|
|
39
39
|
"@types/offscreencanvas": "^2019.6.4",
|
|
40
40
|
"@types/react": "^17.0.37",
|
|
41
41
|
"@types/react-dom": "^17.0.11",
|
|
@@ -196,7 +196,7 @@ export class VideoAgentMesh extends THREE.Mesh {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
async play(videoUrl = '') {
|
|
199
|
-
videoUrl =
|
|
199
|
+
videoUrl = videoUrl || ''
|
|
200
200
|
if (!videoUrl) {
|
|
201
201
|
if (this.videoUrl) await this.videoInstance.play()
|
|
202
202
|
else console.warn('警告:视频资源未初始化。')
|
|
@@ -31,10 +31,19 @@ export class VideoAgentScene {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
run = () => {
|
|
34
|
+
const domElement = this.renderer.domElement
|
|
35
|
+
|
|
34
36
|
// 视频开始 1s 不渲染:规避某些设备黑屏闪烁问题。视频前 2s 是最好是静默的。
|
|
35
37
|
if (!(this.videoAgentMesh.paused || this.videoAgentMesh.freeze) && this.videoAgentMesh.currentTime > 1000) {
|
|
36
38
|
this.renderer.render(this.scene, this.camera)
|
|
37
39
|
}
|
|
40
|
+
|
|
41
|
+
// 兼容非视频场景
|
|
42
|
+
if (!this.videoAgentMesh.videoUrl?.endsWith('.mp4')) {
|
|
43
|
+
if (domElement.style.display !== 'none') domElement.style.display = 'none'
|
|
44
|
+
} else {
|
|
45
|
+
if (domElement.style.display !== 'block') domElement.style.display = 'block'
|
|
46
|
+
}
|
|
38
47
|
requestAnimationFrame(this.run)
|
|
39
48
|
}
|
|
40
49
|
|
|
@@ -20,8 +20,8 @@ export function ModelVideo() {
|
|
|
20
20
|
ref.current.disable()
|
|
21
21
|
await ref.current.load(
|
|
22
22
|
{
|
|
23
|
-
video_src: videoSrc
|
|
24
|
-
video_poster_src: videoPosterSrc
|
|
23
|
+
video_src: videoSrc,
|
|
24
|
+
video_poster_src: videoPosterSrc,
|
|
25
25
|
points: [vertexs],
|
|
26
26
|
},
|
|
27
27
|
controller.configs?.videos?.modelTVVideo
|
|
@@ -9,12 +9,14 @@ export function UpdateVRPanorama() {
|
|
|
9
9
|
|
|
10
10
|
React.useEffect(() => {
|
|
11
11
|
const callback = (keyframe: VreoKeyframe) => {
|
|
12
|
-
const { panoIndex, images } = keyframe.data as UpdateVRPanoramaData
|
|
12
|
+
const { panoIndex, images, work } = keyframe.data as UpdateVRPanoramaData
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
14
|
+
if (work) {
|
|
15
|
+
five.load(work)
|
|
16
|
+
return
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
console.warn('not support.')
|
|
18
20
|
const newWorkJSON = JSON.parse(JSON.stringify(five.work?.raw.work))
|
|
19
21
|
|
|
20
22
|
// // 原Work数据不能被修改
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Mode, Pose, WorkCubeImage } from '@realsee/five'
|
|
1
|
+
import { Mode, Pose, WorkCubeImage, Work } from '@realsee/five'
|
|
2
2
|
import { CameraMovementEffect, Rotation } from '../fivePlugins/CameraMovementPlugin/typings'
|
|
3
3
|
|
|
4
4
|
export enum VreoKeyframeEnum {
|
|
@@ -125,6 +125,7 @@ export type PrompterData = {
|
|
|
125
125
|
export type UpdateVRPanoramaData = {
|
|
126
126
|
panoIndex: number
|
|
127
127
|
images: WorkCubeImage
|
|
128
|
+
work?: Work
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
/**
|