Valid hidden xhtml sound when webpage loaded?

Discussion in 'Web Design and Development' started by Dal123, Oct 7, 2009.

  1. Dal123 macrumors 6502a

    Dal123

    Joined:
    Oct 23, 2008
    Location:
    England
    #1
    I'm trying to have a sound recording (.amr) which gives a little audio description of my company and makes it seem more professional (I know that this is a little taboo but it will make my page look professional in the industry it's targeted at).
    After doing some brief research I can see it's a bit tricky to have a sound file that is hidden that validates in xhtml strict. Maybe an object tag, I've made a big effort to validate all my xhtml and css and would be a shame to sacrifice that now as so close to getting finished.
    Haven't had much time lately been working long hours and haven't had much time on my computer unfortunately :(.
    Input appreciated :).
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    I had some JavaScript for an online game where I was playing sound effects. I think it was working on most browsers, but haven't looked or used this code in a few years. I was using wav files. I've never used a .amr file so not sure what can play that on a page.

    PHP:
    function soundPlay(s)
    {
      if (
    window.operasoundPlayOpera(s);
      
    sound document.createElement("embed");
      
    sound.setAttribute("src"s);
      
    sound.setAttribute("id""sfx");
      
    sound.setAttribute("hidden"true);
      
    sound.setAttribute("autostart"true);
      
    document.body.appendChild(sound);
    }
    function 
    soundPlayOpera(sfx)
    {
      
    = new Audio(sfx);
      
    a.play();
    }
     
  3. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #3
    I looked this up out of interest and found .amr is compressed human speech audio used in 3G cell phones as part of MMS messages and similar uses and widely supported on Windows and Mac via QuickTime and/or Real Player. There is a proprietary ARM encoder and player for Windows only, as well.

    FYI
     
  4. Mal macrumors 603

    Mal

    Joined:
    Jan 6, 2002
    Location:
    Orlando
    #4
    I'd say try converting that file to an mp3 or similar before continuing, because chances are high someone's not going to be able to play that.

    As far as imbedding it, the JavaScript earlier should be fine.

    jW
     
  5. Dal123 thread starter macrumors 6502a

    Dal123

    Joined:
    Oct 23, 2008
    Location:
    England
    #5
    Angelwatt thank you very much, I thought it would be pretty simple but quite suprised at its complexity.
    Jim exactly right, a friend helped me to read some information regarding my company and used my mobile phone to record it. I was amazed how well it came out.
    Site is very close to completion, post a link when done.;)
    Thanks again :)
     

Share This Page