Welcome to Virtual Tutorial World Guest!




Background Music

 
Post new topic   Reply to topic    VTW Forum Index -> HTML
View previous topic :: View next topic  
Author Message
computergeek67
Administrator
Administrator


Joined: 31 Jul 2007
Posts: 144
Tokens: 147
Location: US

PostPosted: Sun Dec 30, 2007 1:41 pm    Post subject: Background Music Reply with quote

Time to time if you want to make your website more attractive then you can think about adding some nice background music to it. However please don' forget that html background music needs more bandwidth. The usually used mp3 files are small compared to wav files, but even so much bigger then a normal html page. The W3C not approved  . Besides this it can annoying peoples, even if you make it possible to control the sound. After this introduction let's make some work.

Using HTML background music is not a complicated task. You just need to select a sound file. It can be mp3, wav, mid but don't forget that is should be as small as possible. After you have the music it's time to integrate it into your html document. To do this we need to use the html tag. The tag inserts a browser plugin into your webpage. This plugin is installed on the client machine.

It's time to see a basic html background music integration. Here is a code which plays your sound:
     
Code:
<body>
      <p>HTML background music test</p>
      <embed src="bgsound.mp3" autostart="true">
      </body>

This code simply plays the given mp3 file as the page is loaded. However if the file ends the music will stop, so you maybe want to set to play music in a loop. Of course you can do this by the loop parameter and as result your code will look like this:
 
Code:
<embed src="bgsound.mp3" autostart="true" loop="true">
 

You can also controll the size of the browser plugin like this:
 
Code:
<embed src="bgsound.mp3" autostart="true" width="400" height="20">
 

It's nice that with this solution the visitor can control the background music, but it destroys your page design. So you maybe want to hide the control panel of the browser plugin. In case of tag you can also use the hidden parameter as follows:
 
Code:
<embed src="bgsound.mp3" autostart="true" loop="true" hidden="true">
 

At the end once again be careful when to use html background music.

-HTMLF1.com


_________________



Come to me if you have any questions
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    VTW Forum Index -> HTML All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Card File  Gallery  Forum Archive
Powered by phpBB © 2001, 2005 phpBB Group
Virtual Tutorial World ©2007-2008 computergeek67

Affiliates