Click here to Skip to main content
Click here to Skip to main content

Tagged as

Background Music in HTML 5

, 17 Jul 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
Playing background music in HTML 5.

In the following simple trick, I am going to show you how to play audio in the background using HTML 5:

<!DOCTYPE html>
<html>
  <link rel="stylesheet" href="styles.css">
  <title>Background Music</title>
 
  <audio autoplay loop>
      <source src="johann_sebastian_bach_air.ogg">
      <source src="johann_sebastian_bach_air.mp3">
  </audio
 
  <h1>You're hooked on Bach!</h1>
</html>

Kindly change the audio source name to your own.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

mhamad zarif
Software Developer Netiks
Lebanon Lebanon
I have been a programmer for about one year.My power is in asp.net and flash (actionscript 3).I also work on windows application using vb.net and c#.

Comments and Discussions

 
GeneralMy vote of 4 PinmemberSsntosh Chouhan10-Aug-13 20:40 
BugTypo PinmemberTiago Becerra Paolini1-Jan-13 15:01 
Generalnot so bad..but also not so good...! Pinmembervaibhav201029-Feb-12 3:29 
Generalnot so bad..but also not so good...! Pinmembervaibhav201029-Feb-12 3:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141216.1 | Last Updated 17 Jul 2011
Article Copyright 2011 by mhamad zarif
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid