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


#1005

I did that:
https://jsfiddle.net/6ts492f6/467/


#1006

What line does the linter say it is?


#1007

ReferenceError: playButton is not defined
https://jsfiddle.net/6ts492f6/468/


#1008

After tidying the code, I see that there's other functions where the function declaration line is indented in differently than the others.

That's the next thing to focus on.


#1009

What line number?.......

or numbers.

or else I will mess it up.
https://jsfiddle.net/6ts492f6/470/


#1010

When you scroll down the page, do you see the purple function first word on some lines? You are looking for a function that is horizontally at a different place than the rest of the functions.


#1011

All lines.


#1012

Yes, check all lines starting from the top, looking at the horizontal placement of the function word on that line. You are looking for one of them that has a different horizontal indent than the rest of them.


#1013

this one?

  function showButton(button, playing) {
    if (playing) {
      showPlayButton(button);
    } else {
      showPauseButton(button);
    }

#1014

That function looks to be indented correctly at the same column as the other functions above it.

The function below it looks to have a different indent to it though, doesn't it.


#1015

What's the difference?

  function showButton(button, playing) {
    if (playing) {
      showPlayButton(button);
    } else {
      showPauseButton(button);
    }

    function manageAudio(player, opts) {
      if (opts.playing) {
        pauseAudio(player);
      } else {
        playAudio(opts.playing);
      }
    }

#1016

Yes, and that's a clear indication that you have failed to close the above function.


#1017

    function showButton(button, playing) {
      if (playing) {
        showPlayButton(button);
      } else {
        showPauseButton(button);
      }
    }


    function manageAudio(player, opts) {
      if (opts.playing) {
        pauseAudio(player);
      } else {
        playAudio(opts.playing);
      }
    }

#1018

That's looking good now.


#1019

What's next?
https://jsfiddle.net/6ts492f6/474/


#1020

What does the browser console say?


#1021

SyntaxError: missing ) in parenthetical


#1022

This is the part where I'm having the most trouble.

    function playButton(button) {
      var player = getAudio();
      var playing = isPlaying(button);
      showButton(button, playing);
      manageAudio(opts.playing) {
        playing
      });
    }
  }

#1023

And for me, it shows the showPause() function in regard to that, and the showPause of the function isn't colored in orange either.

Something's wrong in that area.


#1024

Do you see how you have one curly brace lined up with the start of the function line, and another curly brace below it that isn't lined up with anything meaningful?