Gap less playback through the soundmanager
-
21-12-2019 - |
Frage
I am using soundmanager2 in my project. it have loops so the sound file is repeated with the loops.. But unfortunately there is a gap in between when the loop iterates, well this loop gap is small in the Chrome browser, but there is more gap when i am browsed my project in the Safari or ipad,,,, in short my aim is to achieve continuously sound it hears like a long song.. any help is appreciable
<script type="text/javascript" src="script/soundmanager2.js"></script>
<script type="text/javascript">
var loops = 3 ;
var looped = 0;
soundManager.flashVersion = 9;
soundManager.url = 'swf/';
soundManager.onready(function () {
soundManager.createSound({
id: "sound1",
url: "audiofiles/sound1.wav",
stream: true,
autoPlay: true,
multiShot: true,
onfinish: function () {
if (looped < loops) {
soundManager.play('sound1');
looped++;
} else {
looped = 0;
}
}
});
soundManager.play('sound1', { loops: 3 });
});
</script>
Lösung
I think you have to Use Web Api token
Andere Tipps
Have a look here for my pure HTML5 based solution : gapless looping audio html5
As explained there, source the file through a Data URI and loop using 2 instances.
Example SoundManager2 code :
function LoopBackgroundMusic(){
back_music.play();
setTimeout(LoopBackgroundMusic, 5333); //5333 is the length of the audio clip in milliseconds
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow