mirror of
https://git.roussel.pro/telecom-paris/pact.git
synced 2026-02-09 10:30:17 +01:00
Intégration de la reco d'image à l'interface borne
This commit is contained in:
@@ -84,7 +84,6 @@ class CameraPage {
|
||||
_frame() {
|
||||
if (this.streaming && this.enabled && this.width && this.height) {
|
||||
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
||||
// this.ctx.drawImage(this.video, 0, 0, this.width, this.height);
|
||||
this._drawEffects();
|
||||
}
|
||||
if (this.enabled) {
|
||||
@@ -106,6 +105,11 @@ class CameraPage {
|
||||
_drawEffects() {
|
||||
for (let effect of this.activeEffects) {
|
||||
let { x, y, width, height } = this._scaleEffect(effect.x, effect.y, effect.width, effect.height);
|
||||
width = width * this.videoWidth * 2;
|
||||
height = height * this.videoHeight * 2;
|
||||
x = x * this.videoWidth - width / 2;
|
||||
y = y * this.videoHeight - height / 2;
|
||||
console.log(width, height);
|
||||
if (effect.type == "thumbs_down") {
|
||||
this._drawThumbsDown(x, y, width, height);
|
||||
}
|
||||
|
||||
@@ -3,14 +3,16 @@ class WebsocketClient {
|
||||
this.socket = new WebSocket("ws://localhost:5000");
|
||||
this.socket.addEventListener("open", (event) => {
|
||||
this.socket.send("connected");
|
||||
console.log("connected")
|
||||
});
|
||||
this.socket.addEventListener("message", (event) => {
|
||||
|
||||
this.socket.onmessage = (event) => {
|
||||
let msg = JSON.parse(event.data);
|
||||
if (msg.type == "effects") {
|
||||
onNewEffects(msg.effects);
|
||||
}else if(msg.type == "state") {
|
||||
onNewState(msg.state);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -14,8 +14,11 @@ class StateManager {
|
||||
this._thankYouPage = new ThankYouPage();
|
||||
|
||||
this.wsClient = new WebsocketClient(
|
||||
(effects) => this._cameraPage.setEffects(effects),
|
||||
(state) => this.changeState(state)
|
||||
(effects) => {
|
||||
this.setState(STATE.video);
|
||||
this._cameraPage.setEffects(effects)
|
||||
},
|
||||
(state) => this.setState(state)
|
||||
);
|
||||
|
||||
this._sleepingPage.enabled = true;
|
||||
|
||||
Reference in New Issue
Block a user