Loading ...
Sorry, an error occurred while loading the content.

13299Re: [JavaScript] Playing a sound

Expand Messages
  • Fernando (UK)
    Apr 3, 2006
    • 0 Attachment
      Actually the sound is not to annoy anyone, the user can choose if he
      wants to hear the sound when the message comes or not.
      And, yes, I am using .mp3

      I got to solve my problem using <embed>, which is cross-browser, like

      <span id="SOUND_SPAN"></span>


      function DHTMLSound(surl) {
      document.getElementById("SOUND_SPAN").innerHTML="<embed src='"+surl+"'
      hidden='true' autostart='true' loop='false'>";

      // Sound of new message
      var sound_file = 'sound/new_message_sound.mp3';
      DHTMLSound(sound_file); // To play

      f3l escreveu:

      >On Sat, 01 Apr 2006 06:43:26 -0500, Fernando (UK)
      ><fernandosouzaphp@...> wrote:
      >>Considering the user has the appropriate plugin installed, what is the
      >>best way to play a sound using javascript?
      >>This is not working for me in FF or IE:
      >and it shouldn't, u must use bgsound
      >I'm not sure about that being standard, so I wouldnt recommend it.
      >people are anoyed by the sounds in webpages, so I'd recommend something
      >1. use flash
      >2. do NOT use wav, try compressing it in mp3 or something,
      >WAVs are way too heavy, and people are more likely not to wait for it.
      >>document.getElementById('EMAIL_WARNING_SOUND').src =
      >><iframe id="EMAIL_WARNING_SOUND" name="EMAIL_WARNING_SOUND" src=""
      >>style="visibility:hidden; display:none"></iframe>
    • Show all 6 messages in this topic