ottimizzazione face tracking e backup di navigazione (tap e tastiera/pedale)
This commit is contained in:
@@ -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'"
|
||||
|
||||
@@ -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,10 +102,16 @@ 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) {
|
||||
await this.faceMesh.send({ image: videoElement });
|
||||
const now = Date.now();
|
||||
if (now - lastFrameTime >= FRAME_INTERVAL_MS) {
|
||||
lastFrameTime = now;
|
||||
await this.faceMesh.send({ image: videoElement });
|
||||
}
|
||||
}
|
||||
},
|
||||
width: 320,
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
export const VERSION = '2026.06.27.1457';
|
||||
export const VERSION = '2026.07.13.1755';
|
||||
|
||||
Reference in New Issue
Block a user