@realsee/vreo 0.1.6-alpha.4 → 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.
|
@@ -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
|
}
|
package/package.json
CHANGED
|
@@ -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
|
|