Audio Loop Not Working

Hi All,

I can’t seem to get my loop working on this audio clip.  It is probably very simple and i’m just overlooking it as i’m new to Corona.  Any help would be greatly appreciated and rewarded with an emjoi!  Here is my code.

local piano2 = display.newImage(“button1b.png”, 40, 50);

piano2.status = “waiting”;

local piano2Sound = audio.loadSound(“piano2.mp3”);

function piano2:tap(e)

if(self.status == “waiting”) then

audio.setVolume( 0.5 )

audio.play(piano2Sound,{

channel = 1,

loop = -1,

onComplete = function(e)

self.status = “playing”;

end

});

elseif(self.status == “playing”) then

audio.pause(1);

self.status = “paused”;

elseif(self.status == “paused”) then

audio.resume(1);

self.status = “playing”;

end

end

piano2:addEventListener(“tap”,piano2);

@jongarsman1076,

Welcome to the forum.

  1. You have ‘loop’.  The correct name is ‘loops’.

https://docs.coronalabs.com/api/library/audio/play.html#options-optional

  1. Please use the built-in post editing tools to format code posts:

formatyourcode.jpg

I knew it wasn’t something dumb I was missing.  Thank yoU!

@jongarsman1076,

Welcome to the forum.

  1. You have ‘loop’.  The correct name is ‘loops’.

https://docs.coronalabs.com/api/library/audio/play.html#options-optional

  1. Please use the built-in post editing tools to format code posts:

formatyourcode.jpg

I knew it wasn’t something dumb I was missing.  Thank yoU!