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

What did I do wrong?

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

What does the browser console tell you about it?

SyntaxError: missing ) after argument list

So a closing parenthesis is missing.

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

Looking at the code, you have closed the object that you’re giving to the manageAudio function, but where’s the closing parenthesis that’s supposed to close the argument list that you’re giving to the function?

You haven’t closed the function either.

What happens with playing?

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

playing();

You place the closing parenthesis in the wrong place, it needs to be after the object that playing is inside of.

I don’t understand

        manageAudio(opts.playing)  {
        playing
      }
}

You placed the closing parenthesis in the wrong place, putting it well before where it must be.

It’s still not working.

manageAudio(opts.playing, {
  playing
});

As I was saying earlier, your function hasn’t been closed either.

Open closed
{}

 {
 playing
}

I don’t understand, and I still don’t understand.

All functions declarations have the following structure:

function someName(parameters) {
  // ...
}

The closing curly brace that ends the function, seems to be missing from your code.

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

Use the Tidy button, and you’ll see if you have too many or too few.

1 Like

I don’t understand how many I’m supposed to have, and what they should look like.