Hi everybody!
I need some advice on how to setup my script correctly for the Howler.js sound API.
In this stackoverflow question you can find SoundManager2 and Howler.js code examples for audio playback.
I basically use the SoundManager2 script from that page - with a few modifications as shown in my code snippet below(this script works flawlessly with my app, unfortunately I have problems to make it work with the Howler.js API).
With this script I can simply play a sound by calling the sound id("Song1") and the function("playAudio" for example).
My question:
How can I structure the Howler.js script correctly
-get quick insight into the functions for the Howler.js API here- to get the same functionality
→ play a sound by calling the sound id and the correct function?
Any help with this task would be amazing!
Code:
<!DOCTYPE html>
<script type="text/javascript" src="api/soundmanager2.js"></script>
<script>
soundManager.setup({
url: 'api/',
onready: function() {
soundManager.createSound({
id: 'Song1',
url: 'audio/Song1.ogg'
});
},
});
function playAudio(snd) {
soundManager.play(snd);
}
function stopAudio(snd) {
soundManager.stop(snd);
}
</script>
برچسب:
نویسنده: آیلین رضوانی
تاريخ: دوشنبه
2 بهمن
1396 ساعت: 18:47