Getting audio players to play their respective streams out of their element


#624

That seems good.


#625

https://jsfiddle.net/zfs5qqq9/200/


#626

You are using several hide classnames, such as "hidea" and "hideb" and so on.
That's because you are doing things the hard way.

You need to tell the code for that last button how to remove all of those hide class names.


#627

  function isPlaying(button) {
    var play = getPlay(button);
    return play.classList.contains("hidea") || play.classList.contains("hideb") ||
      play.classList.contains("hidec") || play.classList.contains("hided") ||
      play.classList.contains("hidee") || play.classList.contains("hidef");
  }

Delete this??????

 function isPlaying(button) {
    var play = getPlay(button);
    return play.classList.contains("hidef");
  }

#628

You must replace it instead of deleting it.


#629

This goes there:

function isPlaying(button) {
    var play = getPlay(button);
    return play.classList.contains("hidea") || play.classList.contains("hideb") ||
      play.classList.contains("hidec") || play.classList.contains("hided") ||
      play.classList.contains("hidee") || play.classList.contains("hidef");
  }

#630

https://jsfiddle.net/zfs5qqq9/204/


#631

What instructions do I need to follow to experience that one?


#632

Fixed:
https://jsfiddle.net/zfs5qqq9/208/


#633

'pauseAllButtons' is out of scope.
pauseAllButtons();
53.16
Unused 'pause'.
var pause = getPause(button);
54.16
'isPlaying' is out of scope.
if (isPlaying(button)) {
55.38
Expected ';' and instead saw '}'.
showPlayButton(button)
151.8
'pauseAllButtons' is out of scope.
pauseAllButtons();
161.16
Unused 'pause'.
var pause = getPause(button);
162.16
'isPlaying' is out of scope.
if (isPlaying(button)) {
163.38
Expected ';' and instead saw '}'.
showPlayButton(button)
242.32
Expected one space between 'function' and '('.
playButtons.forEach(function(button) {
290.8
'pauseAllButtons' is out of scope.
pauseAllButtons();
298.16
Unused 'pause'.
var pause = getPause(button);
299.16
'isPlaying' is out of scope.
if (isPlaying(button)) {
300.38
Expected ';' and instead saw '}'.
showPlayButton(button)
341.32
Expected one space between 'function' and '('.
playButtons.forEach(function(button) {
389.8
'pauseAllButtons' is out of scope.
pauseAllButtons();
397.16
Unused 'pause'.
var pause = getPause(button);
398.16
'isPlaying' is out of scope.
if (isPlaying(button)) {
399.38
Expected ';' and instead saw '}'.
showPlayButton(button)
493.8
'pauseAllButtons' is out of scope.
pauseAllButtons();
501.16
Unused 'pause'.
var pause = getPause(button);
502.16
'isPlaying' is out of scope.
if (isPlaying(button)) {
503.38
Expected ';' and instead saw '}'.
showPlayButton(button)
599.8
'pauseAllButtons' is out of scope.
pauseAllButtons();
607.16
Unused 'pause'.
var pause = getPause(button);
608.16
'isPlaying' is out of scope.
if (isPlaying(button)) {
609.38
Expected ';' and instead saw '}'.
showPlayButton(button)


#634

Move the pauseAllButtons() function further up in the code.


#635

    function showPauseButton(button) {
        var pause = getPause(button);
        pauseAllButtons();
        hideAllButtons(button);
        show(pause);
        button.classList.add("active");
    }

#636

'pauseAllButtons' is out of scope.
pauseAllButtons();

    function showPauseButton(button) {
        var pause = getPause(button);
        pauseAllButtons();
        hideAllButtons(button);
        show(pause);
        button.classList.add("active");
    }

    function pauseAllButtons() {
        var buttons = document.querySelectorAll(".playButtona, .playButtonb, .playButtonc, .playButtond, .playButtone, .playButtonf");
        buttons.forEach(function hidePause(button) {
            var pause = getPause(button);
            if (isPlaying(button)) {
                showPlayButton(button)
            }
        });
    }

#637

The pauseAllButtons() function is still too low, It must be at a minimum, above the function from where it's called.


#638

pauseAllButtons();

is

above

function pauseAllButtons() {


#639

You mean too high?


#640

Yeah, that's the opposite of how it must be.


#641

unused pause:

    function pauseAllButtons() {
        var buttons = document.querySelectorAll(".playButtona, .playButtonb, .playButtonc, .playButtond, .playButtone, .playButtonf");
        buttons.forEach(function hidePause(button) {
            var pause = getPause(button);
            if (isPlaying(button)) {
                showPlayButton(button)
            }
        });
    }

#642

Kill it.


#643

'isPlaying' is out of scope.

    function pauseAllButtons() {
        var buttons = document.querySelectorAll(".playButtona, .playButtonb, .playButtonc, .playButtond, .playButtone, .playButtonf");
        buttons.forEach(function hidePause(button) {
            if (isPlaying(button)) {
                showPlayButton(button)
            }
        });
    }