Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Embedding Audio Player

Status
Not open for further replies.

jordan8201

Instructor
May 22, 2003
15
US
I am going to be uploading sermons to our church website soon, and would like them to be played in an embedded media player. I am using the following code to embed the player:

<OBJECT ID="MediaPlayer1" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" CODEBASE=" Version=5,1,52,701" STANDBY="Loading Microsoft Windows® Media Player components..." TYPE="application/x-oleobject" width="280" height="46">
<param name="fileName" value="<param name="animationatStart" value="true">
<param name="transparentatStart" value="true">
<param name="autoStart" value="true">
<param name="showControls" value="true">
<param name="Volume" value="-300">
<embed type="application/x-mplayer2" pluginspage=" src=" name="MediaPlayer1" width=280 height=46 autostart=1 showcontrols=1 volume=-300>
</OBJECT>

I have also seen a flash player that can be embedded which i would not mind using.

This works fine, but I will having as many as 200 different sermons on the page at a time, and I do not want to have to create a separate html file for each. I want to create a table with the sermon title and things, so that when they click the link, it will automatically open that .wma file in the player within the same page. Is this possible? Thanks.

Jedidiah
 
Maybe you can add a series of hyperlink like this and a handler. The handler changemediafile() is like this.
[tt]
function changemediafile(surl) {
var player=document.getElementById("MediaPlayer1");
player.fileName=surl;
}
[/tt]
The anchars, like this.
[tt]
<a href="javascript:void(0)" onclick="changemediafile(' false;">some description 1</a><br />
<a href="javascript:void(0)" onclick="changemediafile(' false;">some description 2</a><br />
<a href="javascript:void(0)" onclick="changemediafile(' false;">some description 3</a><br />
<!-- etc etc -->
[/tt]
 
Thanks for the reply. I am not at all familiar with javascipt yet. I am in the process of getting some books on it. I don't even know that I put the function in the correct place. I tried what you said and uploaded the file to
The code is <script type="text/javascript">function changemediafile(surl) {
var player=document.getElementById("MediaPlayer1");
player.fileName=surl;
}
</script>
</head>

<body>
<OBJECT ID="MediaPlayer1" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" CODEBASE=" Version=5,1,52,701" STANDBY="Loading Microsoft Windows® Media Player components..." TYPE="application/x-oleobject" width="280" height="46">
<param name="fileName" value="<param name="animationatStart" value="true">
<param name="transparentatStart" value="true">
<param name="autoStart" value="true">
<param name="showControls" value="true">

<param name="Volume" value="-300">
<embed type="application/x-mplayer2" pluginspage=" src=" name="MediaPlayer1" width=280 height=46 autostart=1 showcontrols=1 volume=-300>
</OBJECT>
<br /><br />
<a href="javascript:void(0)" onclick="changemediafile(' false;">some description 1</a><br />
<a href="javascript:void(0)" onclick="changemediafile(' false;">some description 2</a><br />
<a href="javascript:void(0)" onclick="changemediafile(' false;">some description 3</a><br />
<!-- etc etc -->
</body>

but as you can see it is not working. I am sure I didn't do something right.
Thanks,

Jedidiah
 
Could you check your wma files whether they play on mediaplayer at all. I don't see they are of audio media-type and of nonzero length. (Right-click on your mediaplayer and select the properties, you would see those data are missing at all.) Verify it on your local system first?
 
I meant simply when you right-click on the graphic of media-play on the screen and choose properties. It seems the properties File-tab page is showing for some entries:
[tt] length: 00.00
media-type: [empty here][/tt]
They should shows size of the file and audio type probably.

It behaves like this even without the archors added per my suggestion. That's why I suggest you to check the wma's loaded to your site.
 
I apologize, but I am apparently missing something. When I use the URL i listed above that does check the wma's when loaded on my site. I do not know how to make them play in the media player tho. Apparently they are not going to it or something.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top