JSFiddle - React, Tailwind, and code Playground

HTML

<div id="timer"><span>click play</span></div>
<a href="#" id="btn_start">PLAY</a>
<audio id="audiosource">
    <source src="http://www.soundjay.com/button/button-1.mp3" type="audio/mpeg" /> 
    <source src="http://www.soundjay.com/button/button-1.wav" type="audio/wav" />
</audio>

JavaScript

function myApp() { 
      this.paused = false;
      this.paused = true // set pause to true (stop)
      this.isactive = false; // countdown is active
      return this.observer(); // call and return the "observer" method of the "myApp" class
    }

    myApp.prototype.observer = function() { // observer method
      var self = this; // set this to self (this is the current instance of this class)

      $('#btn_start').on('click', function(event){ // where an user click on "btn_start"
        event.preventDefault();
        self.play('mp3'); // call the play method and store the state in a public var
        self.countdown(30, self.onEnd); // 30 is the audio duration - second parameter is the callback when the audio is finished
        self.isactive = true;
      });
      return this; // return this instance
    };

    myApp.prototype.play = function() { // play method
      var song = document.getElementById('audiosource');
      if (this.paused === true)
      {
        console.log('play song');
        song.play();
        this.paused = false;
      }
      else
      {
        console.log('pause song');
        song.pause();
        this.paused = true;
      }
      return this;
    };

    myApp.prototype.countdown = function(duration, callback) { // countdown method
      var self = this, // class instance
           countdown = null, // countdown
           ctx = null; // setIntervall clearer
           timer = duration; // timer

      if (this.isactive === true) // if this method yet called
	  {
        return false;
	  }
      countdown = function() {
          console.log('start countdown:' + self.paused);
        if (timer === 0)
        {
           clearInterval(ctx);
           callback.call(this);
           return false;
        }
        if (self.paused === false) // if not in pause
        {
          timer -= 1;
          console.log(timer);
          $('#timer > span').html(timer);
        }
      };
      ctx = setInterval(countdown,...