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) {