Sound in a web site

Last post 07-09-2008 8:54 AM by nikos05. 5 replies.

Sort Posts:

  • Sound in a web site

    07-09-2008, 4:52 AM
    • Member
      2 point Member
    • nikos05
    • Member since 07-03-2008, 4:36 AM
    • Posts 6

    Hi!

     I want to put a sound in my web application. I have already use: <meta http-equiv="REFRESH" content="0;URL='./attention.wav?autostart=true'"> inside the <head> tag but sounds when page_load. The problem is that I want to use that when I call a function and that function returns an error.

    Can anyone help me with this?

     Thanks in advance! Nikos
  • Re: Sound in a web site

    07-09-2008, 5:13 AM
    Answer
    • All-Star
      15,201 point All-Star
    • yasserzaid
    • Member since 09-22-2007, 9:10 PM
    • Egypt
    • Posts 2,575
  • Re: Sound in a web site

    07-09-2008, 6:06 AM
    • Contributor
      4,508 point Contributor
    • deesh1531982
    • Member since 12-24-2007, 1:15 PM
    • Posts 766
    "Never underestimate the power of stupid people in large groups"
  • Re: Sound in a web site

    07-09-2008, 6:42 AM
    Answer
    • Contributor
      2,342 point Contributor
    • Maulik Patel
    • Member since 12-21-2007, 6:48 AM
    • Ahmedabad
    • Posts 333

    <bgsound src="sample.wav" loop="-1"> OR

    <embed src="sample.wav" autostart="false" loop="false">
    </embed>
    bottomRoundFrame();

     OR

     

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" ValidateRequest="false" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
        <script>
        function setEmbed(ID, fileName)
        {
            debugger;
            var element = document.getElementById(ID);
            //Write the following three lines in one:
            element.innerHTML = '<embed src="'+fileName+'.m3u" autostart="0" loop="0" height="45" width="170" type="'+getMimeType()+'"></embed>';
        }
        
        function getMimeType()
        {
            var mimeType = "application/x-mplayer2"; //default
            var agt=navigator.userAgent.toLowerCase();
            if (navigator.mimeTypes && agt.indexOf("windows")==-1)
            {
                //non-IE, no-Windows
                var plugin=navigator.mimeTypes["audio/mpeg"].enabledPlugin;
                if (plugin) mimeType="audio/mpeg" //Mac/Safari & Linux/FFox
            }//end no-Windows
            return mimeType
        }
        
        </script>
    </head>
    <body onload="setEmbed('sample', 'http://www.yourdomain.com/music/sample.mp3')">  
    <form runat="server">
        <span id="sample">Finding plugin...</span>
    </form>
    </body>
    </html>
    

      

    1) Very good article about how to deal with music using java script. http://www.phon.ucl.ac.uk/home/mark/audio/play.htm 

    2) http://www.scriptwell.net/howtoplaysound.htm 

    Maulik Patel
    MCTS, Software Engineer

    Don't forget to click "Mark as Answer" on the post that helped you. This will give you point and help readers to know which post solved your issue and make their search easy.
  • Re: Sound in a web site

    07-09-2008, 7:09 AM
    • All-Star
      62,473 point All-Star
    • TATWORTH
    • Member since 02-04-2003, 8:34 AM
    • England
    • Posts 12,196
    • TrustedFriends-MVPs

    >I want to put a sound in my web application
    Please remember deaf users need to access your site and therefore ensure that hearing the sound is not mandatory to using the site.

    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: Sound in a web site

    07-09-2008, 8:54 AM
    • Member
      2 point Member
    • nikos05
    • Member since 07-03-2008, 4:36 AM
    • Posts 6

    Thank's for the help I solve my problem.

Page 1 of 1 (6 items)