...

View Full Version : how to embed generic media player



bazz
11-25-2006, 02:30 PM
Hi, I want to enable users of a site, to play a selection of mp3 samples. Presently I have embedded windows media player but in IE it opens up QT when the selection is made, making site design difficult.

How can I code my page so that opening a music sample, opens the media player set in the users browser?

bazz

_Aerospace_Eng_
11-25-2006, 04:50 PM
What is the code you are using to embed the song?

bazz
11-27-2006, 01:56 PM
Hi Aerospace_Eng,

I have gone through the sticky several times and still don't see what I am getting wrong.

This is the javascript I have used.



<script type="text/javascript"><!--
function song(){
document.getElementById('music1').innerHTML="<embed type='application/x-mplayer2' id='music2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='"+document.getElementById('samples').value+"' name='MediaPlayer1' width='250' height='50' controltype='2' showcontrols='1' showstatusbar='1' AutoStart='true'></embed>";
}
//-->
</script>


This is the select part in the xhtml




<select id="samples" onchange="song()" size="1">
<option value="none">::::::::::::: Choose Your Song Here :::::::::::::</option>

<option value="http://mydomain.com/ProMusic/Annie Laurie.mp3">Annie Laurie.mp3</option>

</select>


and this is the code for the media player.



<span id="music1"><embed type="application/x-mplayer2" id="music1"
pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"
src=""
name="MediaPlayer1"
width="250"
height="50"
controltype="2"
showcontrols="1"
showstatusbar="1"
AutoStart="0">
</embed></span>



Any help you can give willl be much appreciated


bazz

_Aerospace_Eng_
11-27-2006, 04:43 PM
I don't think you've gone through the sticky as much as you should have. If you had you would have seen this post

http://www.codingforums.com/showpost.php?p=382794&postcount=320

It uses wmv but can made to use mp3 by changing the extension in the code.

bazz
11-28-2006, 12:00 AM
Thank you very much. I have it working now in IE but not in FF. Is there any way to make it work in both browsers?

bazz

_Aerospace_Eng_
11-28-2006, 04:43 AM
If you used the same code I provided and not tried to modify an existing script you had then it should work both in IE and Firefox. Perhaps you should post a link to your page. Its clear you aren't doing something correctly.

bazz
11-28-2006, 08:33 AM
Oh dear. I have looked again this morning and still can't see what's wrong.

here's the location of the page.

http:// w w w . cara-harpist.co.uk/cgi-bin/musicSamples?baseBusiness=Cara-Harpist_Performers_Musical_Harpist_Bangor_County-Down_351045382618_BT20-5HA_Cara-Harpist_North-Down-Tourism_1_Performers_Christine-Evans

bazz

bazz
11-29-2006, 09:34 PM
Oops, I forgot I've been spoofing my browser. I'll activate the domain and post again.

bazz

bazz
12-01-2006, 02:06 PM
still can;t see what;s wrong and now the domain is active so you can see it work in IE but not in FF.

http://www.cara-harpist.co.uk/cgi-bin/musicSamples?baseBusiness=Cara-Harpist_Performers_Musical_Harpist_Bangor_County-Down_351045382618_BT20-5HA_Cara-Harpist_North-Down-Tourism_1_Performers_Christine-Evans

Any tips greatly welcomed.

bazz



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum