Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

playing an mp3 in current window


Rachael w.

Recommended Posts

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...