ottimizzazione face tracking e backup di navigazione (tap e tastiera/pedale)

This commit is contained in:
David Frassi
2026-07-13 18:35:54 +02:00
parent 9f9b164937
commit 94d014f815
4 changed files with 33 additions and 3 deletions
+1 -1
View File
@@ -105,7 +105,7 @@
</div>
<!-- Sections rendering -->
<div class="lyrics-view">
<div class="lyrics-view" (click)="handleLyricsClick($event)">
<div *ngFor="let section of parsedSections(); let si = index"
class="section"
[class.chorus]="section.type === 'chorus'"
+24
View File
@@ -42,6 +42,30 @@ export class PlayerPage implements OnInit, AfterViewInit, OnDestroy {
} else if (event.key === 'MediaPlayPause') {
this.toggleAudio();
event.preventDefault();
} else if (event.key === 'PageUp' || event.key === 'ArrowLeft') {
this.prev(true);
event.preventDefault();
} else if (event.key === 'PageDown' || event.key === 'ArrowRight') {
this.next(false, true);
event.preventDefault();
}
}
handleLyricsClick(event: MouseEvent) {
const target = event.target as HTMLElement;
if (target && (target.closest('button') || target.closest('ion-button') || target.closest('.side-indicator') || target.closest('.autoscroll-indicator') || target.closest('ion-icon'))) {
return;
}
const selection = window.getSelection();
if (selection && selection.toString().length > 0) {
return;
}
const clickX = event.clientX;
const width = window.innerWidth;
if (clickX > width / 2) {
this.next(false, true);
} else {
this.prev(true);
}
}
@@ -102,11 +102,17 @@ export class FaceDetectorService {
this.processLandmarks(results);
});
let lastFrameTime = 0;
const FRAME_INTERVAL_MS = 100; // Analizza massimo 10 fotogrammi al secondo per risparmiare CPU/RAM
this.camera = new CameraLib(videoElement, {
onFrame: async () => {
if (this.isCameraActive() && this.faceMesh) {
const now = Date.now();
if (now - lastFrameTime >= FRAME_INTERVAL_MS) {
lastFrameTime = now;
await this.faceMesh.send({ image: videoElement });
}
}
},
width: 320,
height: 240
+1 -1
View File
@@ -1 +1 @@
export const VERSION = '2026.06.27.1457';
export const VERSION = '2026.07.13.1755';