Coding Global Background
Coding Global
\n \n\n","comment":[{"@type":"Comment","author":{"@type":"Person","name":"burberryshrooms","url":"https://discord.com/users/1462382100224282738","image":"https://cdn.discordapp.com/avatars/1462382100224282738/1b1546944033b5ebe7818d32a005d1e4.webp?size=1024"},"datePublished":"2026-03-17T17:30:07.256Z","text":"The reason could be that the song is set to not loop or that there is a script preventing it from playing past a certain point. Try checking the code for any conditions that could cause the song to stop playing prematurely."},{"@type":"Comment","author":{"@type":"Person","name":"pixel","url":"https://discord.com/users/668710667754405909","image":"https://cdn.discordapp.com/avatars/668710667754405909/0d3f3fe4dbe195c121ba4b4fe6d4c553.webp?size=1024"},"datePublished":"2026-03-25T18:46:46.308Z","text":"it's restarting because of your `onend` function. You literally telling it to play again when it finishes. \n\n`onend: function() { if (!_isStopping && _loginSound) { _loginSound.seek(0); _loginSound.play(); } }` \n\nSo even if the song ends normally, it just goes back to 0 and starts again. That's why it feels like it's not finishing. \n\nAlso, if it's stopping before the actual end, it could be how the file is loaded or buffered, especially with `html5: false`. Try switching that to be true and see if it plays through properly.\n\nBut yeah main issue is that `onend` logic, you basically forced it to loop manually."}],"dateModified":"2026-03-25T18:46:46.436Z"}

Does anyone know why the song doesn’t play until the end but instead stops and then restarts? It’s 2

0 Nachrichten
1 Mitglieder
Erstellt a month ago
Aktualisiert 17 days ago
In Discord öffnen
0
0x000
Verified
Does anyone know why the song doesn’t play until the end but instead stops and then restarts? It’s 2:55 minutes long, but it stops earlier.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>html,body,*{background:transparent}</style>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/howler/2.1.2/howler.core.min.js"></script>
<script>
var _loginSound = null;
var _isStopping = false;

function playLoginSound(path) {
_isStopping = false;
if (_loginSound) { _loginSound.stop(); _loginSound.unload(); _loginSound = null; }

_loginSound = new Howl({
src: [path],
loop: false,
volume: 0.3,
html5: false,
onend: function() {
if (!_isStopping && _loginSound) {
_loginSound.seek(0);
_loginSound.play();
}
},
onloaderror: function(id, err) {
console.log('[Sound] Load error:', err);
},
onplayerror: function(id, err) {
console.log('[Sound] Play error:', err);
if (_loginSound) {
_loginSound.once('unlock', function() {
_loginSound.play();
});
}
}
});

_loginSound.play();
}

function stopLoginSound() {
_isStopping = true;
if (!_loginSound) return;
var sound = _loginSound;
_loginSound = null;
sound.fade(sound.volume(), 0.0, 2000);
setTimeout(function() {
sound.stop();
sound.unload();
}, 2100);
}
</script>
</body>
</html>

Antworten (2)