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