sensi + seuil

This commit is contained in:
El-yazide MOHAMED 2025-06-08 09:46:21 +02:00
parent 303c76cbd6
commit a9808ba9d4

View File

@ -33,7 +33,7 @@ socket.on('position', (position) => {
clearTimeout(idleTimeout); clearTimeout(idleTimeout);
// Seuil de mouvement pour arrêt // Seuil de mouvement pour arrêt
if (Math.abs(speed) < 5) { if (Math.abs(speed) < 2) {
stopPlayback(); stopPlayback();
return; return;
} }
@ -50,8 +50,9 @@ socket.on('position', (position) => {
audio.play(); audio.play();
isPlaying = true; isPlaying = true;
} }
let playbackSpeed = 0.5 + speed / 400; // SENSIBILITÉ : le facteur diviseur est plus grand → plus doux
playbackSpeed = Math.min(Math.max(playbackSpeed, 0.5), 1.5); let playbackSpeed = 0.5 + speed / 1000;
playbackSpeed = Math.min(Math.max(playbackSpeed, 0.5), 1.0); // plage limitée à x1 max
audio.playbackRate = playbackSpeed; audio.playbackRate = playbackSpeed;
} }
} }