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

From what I can see there, you are.

Should I remove opts from any of them too?

The opts object passed to the manageAudio() function contains a key called playing that has suitable information, so no you shouldn’t remove any of them from there.

can’t assign to properties of (new Boolean(false)): not an object

That’s trying to tell you that player is undefined. We know that it shouldn’t be undefined, so it’s time to investigate why.

Setting a breakpoint on that line and running the code, I see that player equals false

Why is that? The call stack shows me that the playAudio() function is called by the manageAudio() function. Let’s take a look there and find out what’s going on.

Well there’s your problem. The manageAudio() function is calling playAudio() with a boolean as its first argument, when the playAudio() function expects a player as the first argument when calling it instead.

How do we fix that?

Stop giving it a boolean and give it what it needs instead.

huh…

Look at this:

    function playAudio(player) {

And look at that:

        playAudio(opts.playing);

Can you see what the problem is?

no…

But I’m assuming you can see that they are different, and therefore may do different things

yes…

Let’s dig deeper then. What is assigned to the opts.playing variable?

player, opts

Do this???

    function playAudio(player, opts) {
      player.volume = 1.0;

You can find out what is assigned as playing in the opts parameter, by looking at the function assignment in the playButton() function.

even more confused…

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

Do I need to change this to something else?
function playAudio(player) {