Savetti Savetti - 1 year ago 96
Android Question

Corona SDK audio not working on Android

I am currently working on a small game in Corona SDK. I have recently began adding audio/sound-fx to the game. All the audio works fine on the simulator, on my PC, and on my tablet. However, when I play the game on my Galaxy s7 the audio simply doesn't do anything.

Here is what I am using:

local function onLoginBtnRelease()
local btnpressSound = audio.loadStream( "/assets/Audio/FX/buttonpress.mp3" )
local btnpressSoundChannel = btnpressSound, { channel=3} )

local loginBtn = widget.newButton{
textOnly = true,
onRelease = onLoginBtnRelease,
loginBtn.x = 440
loginBtn.y = display.contentHeight -160

and just in case this could be an issue that i'm not seeing or knowing could effect Android, here is a screenshot of the mp3 file path
MP3 File Path

I have searched and searched all over and I simply cannot find a solution to this issue. From everything I can see, this should be working fine in Android. It works great on the simulator, my PC, and my tablet... Any help with what I may not be thinking about or am doing wrong would be greatly appreciated.

Thank you

edit: BTW, I have tested this on 5 different Android devices. 2 s7's, 1 s5, and 2 s3's.

edit2: I have tried placing the audio in the root folder and changing the file path and that also did not work... =(

edit3: I have tried wav, mp3, & ogg; all with the same results.

Answer Source

I fixed this issue by changing the path to the file from

local btnpressSound = audio.loadStream( "/assets/Audio/FX/buttonpress.mp3" )


local btnpressSound = audio.loadStream( "assets/Audio/FX/buttonpress.mp3" )