embedded music (mp3 or wma) with controls

Harvey

Registered
Hey guys,

I have seen this done before, but not sure how to reproduce it myself.

I want to embed a music file into a webpage, but also give the webpage controls so that the user can click to start and stop the music.

I have seen things done with the "embed" tag, but I have only been able to do it such that the file starts to play immediately upon page load. Or I have seen things providing links to a m3u file, but I haven't been able to reproduce that yet. That seems like it should allow you to click a link in the page, which would then start playing the file.

If anyone knows how to do this, it would help me out a lot!

Thanks.

-Harvey
 
Hey!

There's a lot of ways to go about this... If you're into QuickTime, you could do a splash screen which first displays and when the user clicks it, the movie or MP3 starts playing. Have a look at the trailers on www.apple.com/trailers for an example. They use it a lot over there. You can probably use their own code if this is what you want to do, but I'll post an example below. Also, you create the splash by simply cuttin' and pastin' it into a new, empty movie in QuickTime.app, then export it.

Code:
<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="196" width="240">
<param name="src" value="show-me-first.mov">
<param name="href" value="then-play-me.mov">
<param name="target" value="myself">
<param name="autoplay" value="false">
<param name="controller" value="false">
<embed height="100" pluginspage="http://www.apple.com/quicktime/download/" src="show-me-first.mov" href="then-play-me.mov" target="myself" type="video/quicktime" width="100" controller="true" autoplay="false">
</object>

Also, I believe you can simply add the autoplay attribute in your <embed> and set it to "false". This might prevent it from playing before the user hits the play button on the controller even though the user's QuickTime setting is set to play immideatly.

And, oh, use controller="true" in your <embed> to get the standard QuickTime bar. Note that you'll have to add 16 pixels to the height specified in the <embed> as the controller otherwise would not fit.

If you run into any problems I can recommend the documentation over at Apple's Developer site.

Good luck.
 
Go with Flash. That way you'll be sure most of the people can hear it without downloading any extra plug-in. Also you can do a pre-loader that shows how much % is left until the music is loaded... That among lots of other things
 
Back
Top