Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Multimedia Elements
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 11-14-2005, 10:40 PM
  #1
gerdeke
Novice (Level 1)
 
Join Date: Nov 2005
Posts: 5
iTrader: (0)
gerdeke is an unknown quantity at this point
accessing mediaplayer functionality from javascript

the following code works just fine in ie. but in mozzila its a no go. This is because .play() is undefined in mozzila for some reason. is there some why to still access the functionality of the WMP embedded objects?



<!-- begin embedded WindowsMedia file... -->
<table border='0' cellpadding='0' align="left">
<tr><td>
<OBJECT name='mePlayer' id='mePlayer' width="200" height="200"
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'>
<param name='fileName' value="http://localhost/test.avi">
<param name='animationatStart' value='true'>
<param name='transparentatStart' value='true'>
<param name='autoStart' value='0'>
<param name='showControls' value="true">
<param name='loop' value="false">
<EMBED type='application/x-mplayer2'
pluginspage='http://microsoft.com/windows/mediaplayer/en/download/'
id='mPlayer' name='mPlayer' displaysize='4' autosize='-1'
bgcolor='darkblue' showcontrols="true" showtracker='-1'
showdisplay='0' showstatusbar='-1' videoborder3d='-1' width="320" height="285"
src="http://localhost/test.avi" autostart="0" designtimesp='5311' loop="false">
</EMBED>
</OBJECT>
</td><td>


</td></tr>
</table>
<script language="javascript">
<!--
function play() {
if(!document.mePlayer.fileName) {
//MOZZILA
}
else {
document.mePlayer.play();
}
}

function stop() {
if(!document.mePlayer.fileName) {
//MOZZILA
}
else {
document.mePlayer.stop();
}
}

-->
</script>

<input type="button" onclick="play()" value="play">
<input type="button" onclick="stop()" value="stop">


Yes I know I could use the control panal for this example but I need to do this outside the control panal. Any clues???
gerdeke is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 11-14-2005, 11:13 PM
  #2
_Aerospace_Eng_
The CSS Master (somewhat)
 
Join Date: Dec 2004
Location: In a galaxy far far away...
Posts: 11,146
iTrader: (0)
_Aerospace_Eng_ has disabled reputation
No not in Firefox. The play and stop functions are IE only. You can do something like this however
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Music Player</title>
<script type="text/javascript">
<!--
function PlayIt(where,what){
document.getElementById(where).innerHTML='<object width="300" height="44" '
      +'classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" '
      +'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">'
      +'<param name="url" value="'+what+'">'
      +'<param name="uiMode" value="full">'
      +'<param name="autoStart" value="true">'
      +'<param name="loop" value="true">'
      +'<embed type="application/x-mplayer2" '
      +'pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" '
      +'showcontrols="true" uimode="full" width="300" height="45" '
      +'src="'+what+'" autostart="true" loop="true">'
+'<\/object>';
}
function StopIt(where){
document.getElementById(where).innerHTML='';
}
//-->
</script>
<style type="text/css">
body {
color:#000000;
margin:0;
padding:0;
text-align:center;
}
</style>
</head>
<body>
<a href="song1.mp3" onclick="PlayIt('music',this.href);return false">Song 1</a><br>
<a href="song2.mp3" onclick="PlayIt('music',this.href);return false">Song 2</a><br>
<a href="song3.mp3" onclick="PlayIt('music',this.href);return false">Song 3</a><br>
<a href="song4.mp3" onclick="PlayIt('music',this.href);return false">Song 4</a><br>
<a href="#" onclick="StopIt('music');return false">Stop Song</a>
<span id="music">
<object width="300" height="44" 
      classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" 
      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">
      <param name="url" value="">
      <param name="uiMode" value="full">
      <param name="autoStart" value="true">
      <param name="loop" value="true">
      <embed type="application/x-mplayer2" 
      pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" 
      showcontrols="true" uimode="full" width="300" height="44" 
      src="" autostart="true" loop="true"></embed>
</object>
</span>
</body>
</html>
__________________

76 invites left. PM me for a Gmail invite along with email addy.
Why we won't help you .::. Web Developer's Handbook .::. Why Tables for Layout is Stupid?
_Aerospace_Eng_ is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 11-15-2005, 05:32 PM
  #3
gerdeke
Novice (Level 1)
 
Join Date: Nov 2005
Posts: 5
iTrader: (0)
gerdeke is an unknown quantity at this point
Thanks for the quick reply. I will try it.
gerdeke is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 11-15-2005, 07:44 PM
  #4
gerdeke
Novice (Level 1)
 
Join Date: Nov 2005
Posts: 5
iTrader: (0)
gerdeke is an unknown quantity at this point
ok the problem with this setup is that when running two media player instances setting the autostart to true causes a load delay which is small but if I could get rid of it I would love it. Any other possible ways of obtaining access to the WMP application?
gerdeke is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 11-16-2005, 03:15 PM
  #5
forlamp
Myrmidon (Level 12)
 
Join Date: Mar 2004
Location: B.C, Canada
Posts: 196
iTrader: (0)
forlamp is on a distinguished road
hmm

Yeah, im currently looking into the exact same thing, difference is that FireFox by default does not have a WMP ActiveX control installed, you need to use the plugin method for this as it is installed by default in firefox.

The JS controls should work on IE/Netscape 7.1+/Mozilla, etc, pretty much any browser that DOES have the ActiveX controll installed.. just not firefox or opera...
FireFox has the ability to install the control manually, but you'd have to write a gudie for users to follow that, and we all know the less a user does the less chance there is of it breaking.

In fact im looking into this issue in great detail as of this weekend, if you want to collaborate efforts on this you can contact me via this board, or msn messenger @ forlamp@msn.com.
__________________
- fl :: ns
forlamp is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Reply
KEEP TABS
SPONSORS
 
Boxedart

 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 10:48 PM.

   

Mascot team created by Drawshop.com | Web Hosting

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.