View Single Post
  #3 (permalink)  
Old 05-28-2005, 06:42 PM
john-formby's Avatar
john-formby john-formby is offline
Registered User
 
Join Date: Nov 2003
Location: Formby, UK
Posts: 239
Hi,
I did this example for someone else a few weeks ago and I think that it is the same thing you need. It will allow you to play files through an embedded media player using links.

Code:
<html>
<head>
<title>Embed Media Player</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script type"text/javascript">
function clip1()
{document.Player.fileName="CLIPS/YOUR_FIRST_CLIP_NAME.MPG";
if(document.getElementById("mediaPlayerMozilla"))
	document.getElementById("mediaPlayerMozilla").innerHTML = '<embed type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" showControls="1" width="280" height="256" src="CLIPS/YOUR_FIRST_CLIP_NAME.MPG"></embed>';}

function clip2()
{document.Player.fileName="CLIPS/YOUR_SECOND_CLIP_NAME.MPG";
if(document.getElementById("mediaPlayerMozilla"))
	document.getElementById("mediaPlayerMozilla").innerHTML = '<embed type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" showControls="1" width="280" height="256" src="CLIPS/YOUR_SECOND_CLIP_NAME.MPG"></embed>';}
</script>

</head>

<body>

<a href="javascript:clip1()">CLIP 1</a></p>
<p><a href="javascript:clip2()">CLIP 2</a></p>
 
<table cellpadding="0px" cellspacing="0px" border="0px">
<td>
<object id="Player" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
standby="Loading Microsoft Windows Media Player components..."
type="application/x-oleobject" width="280" height="256">
      <param name="ShowStatusBar" value="true">
      <param name="autostart" value="true">
      <param name="ShowAudioControls" value="false">
      <param name="ShowDisplay" value="false">
      <param name="ShowGotoBar" value="false">
      <param name="ShowTracker" value="false">
      <param name="ShowPositionControls" value="false">
      <param name="CaptioningID" value="capText">

<div id=mediaPlayerMozilla>
<embed type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" showControls="1" width="280" height="256"></embed>
<div>
</object>
</td>
</tr>
</table>

</body>
</html>
Just change CLIPS/YOUR_FIRST_CLIP_NAME.MPG and CLIPS/YOUR_SECOND_CLIP_NAME.MPG to the location of your clips.

Hope this helps,

John
__________________
Visit http://www.designers-paradise.net/ for hundreds of useful links to web design, programming and graphics resources.
Reply With Quote