Useful Stuff About:
Implementing HTML5 Audio
Purpose: How do you use HTML5 Audio to showcase music or any audio without the user having to install a plug-in on their computer in order for their browsers to head the audio? Use HTML5 Audio like this:
1. Create an mp3 file of music with filename bgmusic.mp3. Move the file into your Websites/project#/media folder
2. Copy and paste this code where you want the audio player to exists relative to your other content.
<audio controls="controls" autoplay="autoplay" id="myAudio"><!-- you can remove the autoplay if you don't want the music to auto start -->
<source src="project#/media/bgmusic.mp3" type="audio/mp3"><!-- Change the # to the correct project number -->
</audio
Typical problems:
- You didn't change the # to the correct project number
- The mp3 file is a 0 kb file so there's actually no music. Solution: Recreate the mp3 file.
- The file name of the mp3 file is NOT bgmusic.mp3 - the code and the filename has to match.
3. Optional CSS - if you want text to wrap around your player, copy and paste this code in your CSS file
audio {
float: right;/*or left*/
margin: 10px;
}