Is there a 'best way' to play sound / music on the website? Should I use the JS plugin? SWF app or HTML element? Apart from this, I can be controlled via the HTML slider.
If I want to play several voices / music over each other, then I have to keep a 'player' for each of them or am I playing a player with many sounds?
The last time I needed to add voice to my website was 10 years ago, so I do not know what technology people use nowadays.
This is actually very simple HTML5 & lt; Audio & gt;
makes tagging easier than starting
It uses default audio controls:
& lt; Audio loop control & gt; & Lt; Source src = "yoursoundhere.mp3" type = "audio / mpeg" & gt; & Lt; / Audio & gt;
The Loop feature makes auto-loop if you want to start playing it on load, then add the autoplay attribute. Multiple audio tags run on each other.
Note that it only works with MP3s. Otherwise, you need to change the file type.
If you want a custom slider, there is something you can try:
& lt; Audio loop id = "audio" & gt; & Lt; Source src = "yoursoundhere.mp3" type = "audio / mpeg" & gt; & Lt; / Audio & gt; & Lt; Script & gt; // When slider value update function updates slider () {var audioplayer = document.getElementByID ("audio"); Var controlvalue = yourHTMLsliderValue (); Audioplayer.volume = controlvalue; } //first time. Var audio player = document.getElementByID ("audio"); Var controlvalue = yourHTMLsliderValue (); Audioplayer.volume = controlvalue; & Lt; / Script & gt;
Also note that the supported audio filetype MP3, .ogg, and .wav, and it only works in HTML5.
No comments:
Post a Comment