Audio on HTML site (basic question)

CluelessChimp

Beta member
Messages
4
Location
UK
Hi,

I've just started working my way through the W3school website and I'm stuck already :ermm:

Can't get my head round how you get audio files up. On the site is suggests code like the:

<a href="song.mp3">Play Song</a>

<script type="text/javascript" src="http://mediaplayer.yahoo.com/js">
</script>

but I don't get how you link the song.mp3 part to one of my own files. What am I missing? I thought you maybe had to upload a file to a host site or something and then put int the URL but couldn't get that to work. I'm new to all this, sorry. Any advice would be very much appreciated, thanks:)
 
Hi,

So you are right on track. You upload the file to your server, and then you set the href to the path of the file that you want. Since you are just starting with html I would recommend going with the html5 example below.

HTML:
<audio controls="controls" height="50px" width="100px">
  <source src="song.mp3" type="audio/mpeg" />
  <source src="song.ogg" type="audio/ogg" />
<embed height="50px" width="100px" src="song.mp3"      />
</audio>

Rather than coping what it says on the w3schools page just read that and it will help you understand each element.
 
Sorry, still utterly lost.

What do you mean upload the file to the server? You mean upload it to a site like this:

zSHARE - 2-07 Ravel_ Pr__lude.m4a - Free File Hosting Service | Audio and Video Sharing | Image Uploading | Web storage

Then what do I do? I've tried putting that wherever it says "song.something" but that seems to be wrong.

How does this href come into play? Do I need to put something like this:

<a href "http://www.zshare.net/download/989646174fee8078/">

lol, sorry for being dumb
 
OK so that link is BS. Ignore that.

Think I've got it to work now with the yahoo media player code. So I just have to link it to a file on my PC like this right:


<a href="C:\Users\Matt\Music\iTunes\iTunes Media\Music\Angela Hewitt\Bach_ The Well-Tempered Clavier, Book 1\1-02 Bach_ Well-Tempered Clavier, Bo.m4a">Play Song</a>

<script type="text/javascript" src="http://mediaplayer.yahoo.com/js"></script>


So if I want to actually put the page on the internet how do I get the file to go with it? If that makes sense? Will just need to be put in some directory or something and then I upload the whole thing? Long way off from getting anything hosted I'm just thinking out loud, sorry haha

thanks for your help.

I'll try and get it to work with some of the other audio methods now and prob will come back if I get stuck.

Thanks again :)
 
OK I have another quick question. Is there a way to get it to play the audio without showing any of the play buttons or anything. I want to create a link where you just click on the word and it plays a sound, for example, on a language learning site where you click on a word and you just here how it's pronounced. It doesn't bring up any audio console type thing or direct you to another page; you just click on the word and it plays the sound. Can this be achieved in HTML or do I need to learn some other language for this?

Thanks for you help.
 
Yes there is. I am not able to think of what the html is right now but I will look it up and then get back to you with what it would be.
 
Hi,

I am very sorry I didn't get back to you sooner, I found what I think you are looking for on the w3schools site.

HTML:
<a href="song.mp3">Play the song</a>
 
Back
Top Bottom