tags:

views:

41

answers:

2

In my page i have a button called Play

In included windows media player using this tag

<embed id="wmpid" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" name="mediaplayer1" ShowStatusBar="false" EnableContextMenu="false"  autostart="0" width="200" height="45" loop="false" src="/1.wma"  />

The audio is starting when i click on the play contoller.

But when i click on the play button, that i created ,how i can play the audio

Thanks in advance

A: 

You need to handle events via JavaScript. Refer is-there-a-documented-javascript-api-for-windows-media-player

Personally I recommend Yahoo Media Player. Windows Media Player might not work on all platforms. Prefer a flash based player. You might need to convert wma to mp3.

Ankit Jain
"might not work" == *will not* work. Oddly, the Windows Media player never seems to load in my Chrome-on-Linux browser.
Stephen P
+1  A: 

You have to use JavaScript to play the sound by clicking on a button.

  <script>
  function EvalSound(soundobj) {
    var thissound= eval("document."+soundobj);
    thissound.Play();
  }
  </script>

  <embed src="success.wav" autostart=false width=0 height=0 name="sound1"
  enablejavascript="true">

Here are examples of a link, an image and a button calling the function.

  <a href="#" onMouseClick="EvalSound('sound1')">Click here</A>
Forlan07
Thanks a lotIt is working in IE.But in mozilla it is not working .Can u give me any solutionIn mozilla it showing an error thissound.Play is not a function
THOmas
try this link:http://www.daniweb.com/forums/thread147248.htmlThat should solve the problem.
Forlan07
By the way, if my answer is the solution you were looking for, it would be great if you can accept it ;)
Forlan07