Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Pause Audio

  1. #1
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Pause Audio

    hi all i am using javascript code to play several sound files in my website using this code:
    Code:
    </script> 
    
    <!-- -->
    <bgsound id="soundfiles"> 
    <script language="JavaScript"><!-- // Sound on Mouseover javascript supplied by http://www.************** 
    var aySound = new Array(); // PLACE YOUR SOUND FILES BELOW 
    aySound[0] = "sounds/01.mp3"; 
    aySound[1] = "sounds/02.mp3"; 
    aySound[2] = "sounds/03.mp3";
    aySound[3] = "sounds/04.mp3"; 
    aySound[4] = "sounds/05.mp3";
    aySound[5] = "sounds/06.mp3";
    aySound[6] = "sounds/07.mp3";
    aySound[7] = "sounds/08.mp3";
    // Don't alter anything below this line 
    IE = (navigator.appVersion.indexOf("MSIE")!=-1 && document.all)? 
    1:0; NS = (navigator.appName=="Netscape" && navigator.plugins["LiveAudio"])? 
    1:0; ver4 = IE||NS? 1:0; onload=auPreload; 
    function auPreload() { 
    if (!ver4) return; 
    if (NS) auEmb = new Layer(0,window); 
    else { Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>"; 
    document.body.insertAdjacentHTML("BeforeEnd",Str); } var Str = ''; 
    for(i=0;i<aySound.length;i++) 
    Str += "<EMBED SRC='"+aySound[i]+"'AUTOSTART='FALSE' HIDDEN='TRUE'>" 
    if (IE) auEmb.innerHTML = Str; 
    else { auEmb.document.open(); 
    auEmb.document.write(Str); 
    auEmb.document.close(); } 
    auCon = IE? document.all.soundfiles:auEmb; auCon.control = auCtrl; } 
    function auCtrl(whSound,play) { 
    if (IE) this.src = play? aySound[whSound]:''; 
    else eval("this.document.embeds[whSound]." + (play? "play()":"stop()")) } 
    
    function playSound(whSound) 
    { 
    if (window.auCon) auCon.control(whSound,true); } 
    function stopSound(whSound) 
    { 
    
    if (window.auCon) auCon.control(whSound,false); } 
    
    //-->
    </script>
    i need to add a pause function to this code so i cane pause sound not stop it
    please help me
    best regards
    Last edited by metalvoice; 09-14-2008 at 12:35 AM.

  • #2
    Regular Coder
    Join Date
    Oct 2006
    Posts
    107
    Thanks
    3
    Thanked 5 Times in 5 Posts
    pause() is what you want. Need more?

  • #3
    New to the CF scene
    Join Date
    Sep 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you for your reply
    yes i need to know how to add the pause function in this code so i can handle it on a button

  • #4
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •