PDA

View Full Version : mp3s in site


pathfairy
11-02-2002, 02:32 AM
Hi first time here, been using first page for quite some time now and rarely have problems with it, however recently built a site for local school and yesterday attempted to add new page which contains 20 short mp3 tracks, I naively thought that I just needed to use the usual a href tag to link to them but all that does is open up media player but doesn't allow the tracks to play, I'm now baffled, any ideas?

Josh
11-02-2002, 02:43 AM
Do you mean to play on the browser?

pathfairy
11-02-2002, 03:21 AM
Yes basically I want people to be able to click on the links and hear the tracks

Josh
11-02-2002, 03:35 AM
try these code:page1.htm:
<a href="page2.htm">page2</a>

page2.htm:
<embed src="blah.mp3">

pathfairy
11-02-2002, 03:46 AM
Thanks for that, sorry to be a pain but how does that relate to my code, here's what one of my links looks like, still rather inexperienced at this
<A HREF="audio/absence.mp3">Abscence</A>

Josh
11-02-2002, 03:57 AM
just change the code into:
<A HREF="page2.htm">Abscence</A>
then create page2.htm with the code in it:
<embed src="audio/absence.mp3">

pathfairy
11-02-2002, 04:13 AM
It's the page 2 bit that confuses me, I have all the mp3s in a folder "audio" so can I not just use the code <embed src="abscence.mp3"> , or do I simply need a seperate page (page2) that contains nothing other than a list of embed tags for all 20 tracks? seriously baffled now

Josh
11-02-2002, 04:30 AM
oh ok,there's another method:using javascript:<bgsound id="music1">
<a href="#" onclick="playmp3_1()">absence1</a>
<a href="#" onclick="playmp3_2()">absence2</a>
'....
<script>
function playmp3_1()
{
music1.src="absence1.mp3";
}
function playmp3_2()
{
music1.src="absence2.mp3";
}
'........
</script>

Josh
11-02-2002, 04:32 AM
I forgot to say,put it in the original page,not page2.
(I couldn't get <embed> worked,duno why)so I used <bgsound>.

Zero Angel
11-02-2002, 08:17 AM
You could make the music site-wide by following Josh's suggestion, but having the HTML file containing the music embed placed in a 0-height frame.

for example:

index.html
....
<frames>
<frameset cols="100%,*">
<frame src="main.html">
<frame src="null.html" name="mframe">
</frameset>
....

main.html
....
<a href="null.html" target="mframe">Music Disabled</a><br>
<a href="music1.html" target="mframe">Music Track 1</a><br>
<a href="music2.html" target="mframe">Music Track 2</a><br>
....

music1.html
.....
<body>
<embed src="music1.mp3" autostart="true">
</body>
</html>


As you can see, each track will require a separate HTML document to play the track. Please note that if a visitor clicks on an off-site link, the music will continue to play. This can be either good or bad (usually bad!)