..
Introduction
Did you ever think of your site a small player sound files (songs, sounds, etc. ..) to allow visitors to listen to a song, all without even having to resort to special programs or programming languages?
Probably yes, then you've probably given up and just leaving, imagining the complexity of development. So here's a trick that will allow you, with a simple line of HTML code to create a small player, including the PLAY, PAUSE and STOP, and even the volume control!
The Tags to be used is <embed> compatible with MS Internet Explorer (version 3.0 and later) and Netscape Navigator (version 3.0 onwards).
In fact <embed> does is call up the default player installed on your PC and set certain features through a series of attributes, listed below, accompanied by appropriate examples.
"Src" attribute
As for the images this attribute is used to specify the address of the sound file you want to play that, among other extensions supported by this plug-in can be either:
Keep in mind also the size of the file you want to enter please, because most "big" is and you will have to wait longer to load, and thus they would listen to the song!
An example
<embed src= "nome_file.mp3"> </ embed>Attributes "width" and "height"
Set the width and height of the player.
If you have Internet Explorer as your browser, the player will appear very large, threatening to break the layout of your page. In order to avoid this is to always give good measures of the player, this is done in the same way you give the dimensions tables, images, and so on, adding that the tag attributes width and height, which measures will expressed in pixels.
Keep in mind that even then the default size of the players are different depending on the browser, another reason why it is advisable to set fixed values.
Note: To avoid putting too small measures, and "cut out" so the volume control, set the width to 280 dell'embed minimum.
Let's take an example that includes the volume bar
<embed src="nome_file.mp3" width= "280" height= "45"> </ embed>Let's take a second example that includes only the PLAY and STOP
<embed src="nome_file.mp3" width= "75" height= "45"> </ embed>Attribute "autostart"
You will notice that the music will start automatically when the page. This is because the attribute is set to autostart by default to "true" value.
If instead you want the music starts only when the user presses the PLAY button, set this attribute to "false".
Let's take an example
<Embed
src = "nome_file.mp3"
width = "280"
height = "45"
autostart = "false">
</ Embed>
Attribute "loop"
And 'possible to ensure that the song is repeated (or less) to infinity, so that if the user wants to listen to him several times not to re-press PLAY every time the song ends. At the end, we must summon the attribute loop.
If set to 1 will ensure that once the song to start over automatically, endlessly. Otherwise, by default, loop takes the value 0, and once performed the song the player will stop.
For example
<Embed
src = "nome_file.mp3"
width = "280"
height = "45"
autostart = "false"
loop = "1">
</ Embed>
Attribute "hidden"
You can also make you, if you wish, that the player is not displayed, by setting the hidden attribute to "true" value (the default value, as we understand, is "false").
It can be useful if you want to put a background music to the site. Remember, however, in this case to set the attribute "autostart" to "true", so to start the song automatically, because you could not see the player, can not interact with it.
An example
<Embed
src = "nome_file.mp3"
autostart = "true"
loop = "1"
hidden = "true">
</ Embed>
The Tag "NOEMBED"
As mentioned in the introductory paragraph, it must be said also that <embed> is not compatible with all browsers, which is why you should add, immediately after the closing </ embed> Tagged <noembed>, whose purpose is to provide alternate text in case of lack of support.
Here is an example
<embed src="nome_file.mp3"> </ embed> <noembed> multimedia element is not supported </ NOEMBED>
| |
CSS (Course)
Web Design and Accessibility according to W3C CSS and XHTML. Starting from 29 €. |
| |
HTML (Course)
The markup language for the Web from 29 €. |
| |
Web Design (Course)
Design Web Sites with HTML, CSS and Dynamic HTML. Starting from 39 €. |