dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Stop the audio-player with a button

  1. #1
    Join Date
    Jul 2014
    Posts
    1

    Question Stop the audio-player with a button

    I'm making it short: I have a audio player (audio.js) which plays a song. But I want to make the audio pause when I click on a button above.



    This is my code:

    ("Hier die Musik ausschalten" is german and means "Stop playing".)

    HTML Code:
    <body>
    <h1>Mein Audio-Test</h1>
    
    <button class="noMusic">Hier die Musik ausschalten!</button>
    
        <!-----Der Audio-Player--->
    
    <audio src="audio/Palace%20Cat%20-%20Crookshanks.mp3" preload="auto" />
    
    
        <!--------- Scripts für Audio --------------->
        <script src="audio/audiojs/audio.js"></script>
        <script>
      audiojs.events.ready(function() {
        var as = audiojs.createAll();
      });
    </script>
    
    
        <!----------- jquery ----------->
        <script type="text/javascript" src="jquery/jquery-1.11.1.js"></script>
        <!-------- ----------- ------>
        <script>
    
        $( ".noMusic" ).click(function( event ) {
    
             var player = this.settings.createPlayer;
            container[audiojs].helpers.removeClass(this.wrapper, player.playingClass);
    
    
        });
            </script>
    
        </body>

    I really dont know what I'm doing wrong . Does anyone have an idea? Thank you very much!

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,589
    Please ask in the JavaScript (JQuery) frameworks forum.
    If your post falls off the page, bump it. ...
    Please remember to wrap any code you have in forum tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles