By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,106 Members | 2,335 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,106 IT Pros & Developers. It's quick & easy.

Embedding Windows Media Player controls in Firefox

P: 1
Hi,
I'm currently trying to build a website for a DJ friend of mine and I have come stuck with a couple of issues.
I've searched everywhere and put some code together but I still have problems.

I want to be able to map controls of the media player to images on the page
ie - when user clicks play image - song plays. I can currently get it working in IE but I can't get it to work in Firefox.

Problems:

1. The buttons (image buttons) will only work in IE only if
<PARAM name = "AutoStart" value="1">
if this is false then the buttons don't work.

In IE mp3 actually does not autoStart but in Firefox it does and I don't want that
Any ideas?

2 - when clicked the buttons work fine in IE
- in Firefox the buttons won't work.
Get the following error in Javascript debugger:
Player is not defined
var x = Player.playState;

Any ideas?

I tried document.getElementById but had no luck!

Javascript to play file
Expand|Select|Wrap|Line Numbers
  1. <SCRIPT> <!--
  2.  
  3.         function Play () {
  4.             var x = Player.playState;
  5.                 if (x == 2) { 
  6.                     Player.controls.play();                  
  7.                     } 
  8.                 else {                     
  9.                     Player.URL =  "tunes/Beethoven's Symphony No. 9 (Scherzo).wma";
  10.                     }         
  11.         }
  12.  
  13.        function Pause () {
  14.                  Player.controls.pause();           
  15.         } 
  16.  
  17.  
  18.        function VolumeUp () {
  19.              var x = Player.settings.volume; 
  20.              Player.settings.volume = x + 10;     
  21.         }        
  22.  
  23.         function VolumeDown () {                  
  24.             var x = Player.settings.volume;
  25.             Player.settings.volume = x - 10;
  26.         }
  27.  
  28. --> </SCRIPT>
  29.  

Code for player:
Expand|Select|Wrap|Line Numbers
  1. <OBJECT  ID="Player" width="0" height="0"  CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
  2. <PARAM name = "Volume"  value="50"> 
  3. <PARAM name = "AutoStart"  value="1">
  4. <PARAM name = "ShowDisplay" value = "false">
  5. <PARAM name ="ShowControls" value="false">
  6. <param name="DisplayMode" value="false">
  7.  
  8.  
  9. <embed type="application/x-mplayer2" pluginspage = "http://www.microsoft.com/windows/mediaplayer/"
  10. id ="Player" name="http://www.....com/Beethoven's Symphony No. 9 (Scherzo).wma"
  11. value="http://www.....com/Beethoven's Symphony No. 9 (Scherzo).wma"
  12. src="http://www.....com/Beethoven's Symphony No. 9 (Scherzo).wma"
  13. width="100"
  14. height="100"
  15. autostart ="false">
  16. </embed>
  17.  
  18. </OBJECT> 
  19.  
  20. <a href= javascript:Play() title ="Play">
  21.     <img src="play.png" border = "0" alt="Play" title ="Play"/></a>
  22.                     &nbsp;
  23. <a href= javascript:Pause() alt = "Pause"title ="Pause">
  24.     <img src="pause.png" border = "0" alt="Pause" title ="Pause"/></a>
  25.  
  26. <a href= javascript:VolumeDown() title ="Volume Down" alt="Volume Down" title ="Volume Down"/>-</a>
  27.         &nbsp;
  28. <a href= javascript:VolumeUp() alt = "Volume Up"title ="Volume Up" alt="Volume Up" title ="Volume Up"/>+</a>
  29.  
I've used <embed> tag to get the player to work in firefox.

Any help would be great!

Cheers
Oct 18 '07 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
The following MozillaZine links may help:
Embedding Windows Media Player in Firefox
Windows Media Player
Nov 5 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.