[SOLVED] - Playing Embedded Audio

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
iknownothing
Forum Contributor
Posts: 337
Joined: Sun Dec 17, 2006 11:53 pm
Location: Sunshine Coast, Australia

[SOLVED] - Playing Embedded Audio

Post by iknownothing »

Hey Guys,
I have some Email Stationery (HTML) where a person recieving an email, can CHOOSE to listen to one of four audio files. So far I have them embedded and I know they work fine, however, what I want is to completely hide the Windows Media interface, and use an image to emulate clicking play (and maybe stop, but its not that important). I'd image this may require some javascript, does anyone know how this is done?

Thanks.
Last edited by iknownothing on Thu Mar 15, 2007 8:48 pm, edited 2 times in total.
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

You are sending me emails that will play music?

I don't know many people would be impressed. I know lots of people who would start calling for your head though.
User avatar
iknownothing
Forum Contributor
Posts: 337
Joined: Sun Dec 17, 2006 11:53 pm
Location: Sunshine Coast, Australia

Post by iknownothing »

nickvd wrote:You are sending me emails that will play music?

I don't know many people would be impressed. I know lots of people who would start calling for your head though.
Which is why Autoplay is OFF. Only when a person WANTS to listen to the audio file (which is business orientated, not music), it will be played (hopefully by a clickable image instead of the WM interface).

The file is also pulled from a website too, so the recipient doesnt have to wait 10 minutes while their email gets delivered to them (as an attachment would do).
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Post by daedalus__ »

<div style="visibility: hidden">
<embed> or <object> or both
</div>


<opinion>
I really can't recommend doing this especially if the songs are going to be attachments. If I regularly got 10 megabyte e-mails from you I would probably be a little angry.
</opinion>
User avatar
iknownothing
Forum Contributor
Posts: 337
Joined: Sun Dec 17, 2006 11:53 pm
Location: Sunshine Coast, Australia

Post by iknownothing »

I've figured it out using...

Code: Select all

function play(media){
document.getElementById('mediaplayer').innerHTML=
'<object classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95"'
+'id="player" hidden="true" width="0" height="0">'
+'<param name="showControls" value="false">'
+'<param name="hidden" value="true">'
+'<param name="fileName" value="'+media+'">'
+'</object>'
}

Code: Select all

onclick="play('AUDIO FILE GOES HERE');"


<td id="mediaplayer"></td>
I have it set so that it will only play when someone wants it to be, and is linked to a webpage, so the files aren't an attachment. There is no reason for a recipient to get frustrated because, there is no audio until they want it.
Post Reply