Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

playing an mp3 in current window


Rachael w.

Recommended Posts

Posted

I have created an infobox which contains a button to play an mp3, however, it always loads in a new window!

 

Is there a way to have an mp3 play immediatly when the play button graphic is clicked and have another button to turn it off without opening another window or otherwise change the look of the site?

 

All I want is a simple on off clickable gif and the music to play with that click, not load any outside player or load in a new window? I want it to be invisible, just hearing the music with the ability to turn it off.

 

I've tried everything I can think of. I didnt see a contrib which would just simply do this.

 

Thank you in advance!

Posted
I have created an infobox which contains a button to play an mp3, however, it always loads in a new window!

 

Is there a way to have an mp3 play immediatly when the play button graphic is clicked and have another button to turn it off without opening another window or otherwise change the look of the site?

 

 

this can be done, although i'm not sure if you'll be able to do exactly what you want. it's called embedded audio, and the (not pretty) html to code for it looks something like this:

<object ID="preview" 
CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" 
HEIGHT="75" WIDTH="200"
>
<param NAME="console" VALUE="Clip1">
<param NAME="controls" VALUE="All">
<param NAME="autostart" VALUE="false">
<param NAME="src" VALUE="yourfilename.mp3">

<embed SRC="yourfilename.mp3" 
TYPE="audio/x-pn-realaudio-plugin" 
CONSOLE="Clip1" 
CONTROLS="All" 
HEIGHT="75" WIDTH="200" 
AUTOSTART="false"
>
</embed>
</object>

this is actually two separate html tags, the object tag and the embed tag. you need both because of screwy browser implementation differences.

 

this specific code will give you a little audio control, with play, fast-fwd, pause, volume, etc, that is 75 px high by 200 px wide.

 

obviously, you can change the above set parameters, like exactly which plugin it looks for if necessary.

 

you can google the <object> and <embed> tags, or something like "embedding audio in a web page" to learn more.

 

CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"??? geez, what were they thinking when they came up with that? talk about an invitation to make a typo. thank god for cut and paste functions.

 

rj

Posted

Thanks! That works great, however, it doesnt seem to work with firefox without the realplayer install. is it possible to have it work with whichever player that particular browser has installed?

Posted

Well, I changed it to windows media player and it fixed the problem, now it is automatically starting in firefox and netscape.

 

Here's my code:

 

<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
id="mediaplayer1" height="40" width="145">
<param name="Filename" value="Close To You.mp3"><param name="AutoStart"
value="False"><param name="ShowControls" value="True"><param
name="ShowStatusBar" value="False"><param name="ShowDisplay"
value="False"><param name="AutoRewind" value="True">
<embed type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/"
src="Close To You.mp3" filename="Close To You.mp3" autostart="False"
showcontrols="True" showstatusbar="False" showdisplay="False"
autorewind="True" height="40" width="145"> 
</object>

Posted

well, now I cant figure out why its automatically starting in firefox. Thats going to be really annoying for visitors because everytime they click to a new page it starts the song over again.

 

Any help on this one would be appreciated!

Posted
well, now I cant figure out why its automatically starting in firefox. Thats going to be really annoying for visitors because everytime they click to a new page it starts the song over again.

 

Any help on this one would be appreciated!

 

For audio for my site I put links to both wma and real audio files, when someone clicks on a wma file it lets the user open it in windows media player which I like better than having a big ugly page opening to play an mp3.. with the real audio files you can set it up to simulate streaming audio.. not actually streaming but it has the resemblence of.

Meaningful. Creative. Change.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...