ottimizzazione face tracking e backup di navigazione (tap e tastiera/pedale)
This commit is contained in:
@@ -105,7 +105,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Sections rendering -->
|
<!-- Sections rendering -->
|
||||||
<div class="lyrics-view">
|
<div class="lyrics-view" (click)="handleLyricsClick($event)">
|
||||||
<div *ngFor="let section of parsedSections(); let si = index"
|
<div *ngFor="let section of parsedSections(); let si = index"
|
||||||
class="section"
|
class="section"
|
||||||
[class.chorus]="section.type === 'chorus'"
|
[class.chorus]="section.type === 'chorus'"
|
||||||
|
|||||||
@@ -42,6 +42,30 @@ export class PlayerPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
} else if (event.key === 'MediaPlayPause') {
|
} else if (event.key === 'MediaPlayPause') {
|
||||||
this.toggleAudio();
|
this.toggleAudio();
|
||||||
event.preventDefault();
|
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);
|
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, {
|
this.camera = new CameraLib(videoElement, {
|
||||||
onFrame: async () => {
|
onFrame: async () => {
|
||||||
if (this.isCameraActive() && this.faceMesh) {
|
if (this.isCameraActive() && this.faceMesh) {
|
||||||
|
const now = Date.now();
|
||||||
|
if (now - lastFrameTime >= FRAME_INTERVAL_MS) {
|
||||||
|
lastFrameTime = now;
|
||||||
await this.faceMesh.send({ image: videoElement });
|
await this.faceMesh.send({ image: videoElement });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
width: 320,
|
width: 320,
|
||||||
height: 240
|
height: 240
|
||||||
|
|||||||
+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