Much better camera support for FKB
This commit is contained in:
12
js/camera.js
12
js/camera.js
@@ -28,9 +28,15 @@ export const BrowserModCameraMixin = (C) =>
|
||||
|
||||
this._camera_framerate = 2;
|
||||
|
||||
window.addEventListener("click", () => this._video.play(), {
|
||||
once: true,
|
||||
});
|
||||
window.addEventListener(
|
||||
"click",
|
||||
() => {
|
||||
if (this._video.ended || this._video.paused) this._video.play();
|
||||
},
|
||||
{
|
||||
once: true,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
update_camera() {
|
||||
|
||||
@@ -66,12 +66,27 @@ export const FullyKioskMixin = (C) =>
|
||||
});
|
||||
}
|
||||
|
||||
startCamera() {
|
||||
if (this._fullyCameraTimer !== undefined) return;
|
||||
this._fullyCameraTimer = window.setInterval(() => {
|
||||
this.sendUpdate({
|
||||
camera: window.fully.getCamshotJpgBase64(),
|
||||
});
|
||||
}, 200);
|
||||
}
|
||||
stopCamera() {
|
||||
window.clearInterval(this._fullyCameraTimer);
|
||||
this._fullyCameraTimer = undefined;
|
||||
}
|
||||
|
||||
fullyMotionTriggered() {
|
||||
if (this._keepingAlive) return;
|
||||
this._fullyMotion = true;
|
||||
this.startCamera();
|
||||
clearTimeout(this._motionTimeout);
|
||||
this._motionTimeout = setTimeout(() => {
|
||||
this._fullyMotion = false;
|
||||
this.stopCamera();
|
||||
this.fully_update();
|
||||
}, 5000);
|
||||
this.fully_update();
|
||||
|
||||
@@ -129,7 +129,7 @@ class BrowserMod extends ext(BrowserModConnection, [
|
||||
if (msg.name) {
|
||||
this.entity_id = msg.name.toLowerCase();
|
||||
}
|
||||
if (msg.camera) {
|
||||
if (msg.camera && !this.isFully) {
|
||||
this.setup_camera();
|
||||
}
|
||||
this.config = { ...this.config, ...msg };
|
||||
|
||||
Reference in New Issue
Block a user