Problem Playing Recorded Audio on Nabi 2 Tablet (Android)

Hi everyone,

I have had a customer contact me saying they have a problem with one of my apps on the Nabi 2 tablet for kids. It runs Android 4.

My app allows the recording of audio by the user using the internal mic. It works fine on iOS and all the Android devices I’ve tested it on.

If the device is an Android one I am recording in .raw format. My code is taken originally from the simple audio recorder example and then tweaked to use raw instead of 3gp as the quality seems better and I read both these formats can be used for Android. The file is being recorded and saved with that extension but I just can’t play it back.

On the Nabi 2 device I get the following error when debugging when I try to play back audio that has been recorded:

D/AwesomePlayer( 115): Failed to open file, all profile flags have to set through setprop method.
I/NuCachedSource2( 115): ERROR_END_OF_STREAM
D/AwesomePlayer( 115): Failed to open file, all profile flags have to set through setprop method.
I/MPEG4Extractor( 115): NON-QT MODE DECIDED
E/MediaPlayer( 6001): error (1, -2147483648)

Does anyone have any ideas? Should I use the 3gp format? I’m using media.playSound to play back the audio as I’m aware that audio.play won’t work for recorded audio.

Thanks,

Ian [import]uid: 123492 topic_id: 35481 reply_id: 335481[/import]

I also have 1 app that records audio and i now have had 4 customers complain about this problem on the Nabi 2 device. I dont have a device yet to test on. but it sounds like the identical problem.

I would really like to get this fixed, Corona Staff please help us out here. [import]uid: 88147 topic_id: 35481 reply_id: 141097[/import]

On Android, I highly recommend that you record to 3GP. Most Android devices that I’ve tested with only support 3GP and not RAW… and will ignore your RAW format request and record to 3GP anyways.

Corona’s [lua]audio[/lua] API does not support 3GP files, but our [lua]media[/lua] APIs do support 3GP. So, use the [lua]media.playSound()[/lua] function to playback recorded audio files instead.
http://docs.coronalabs.com/api/library/media/playSound.html
[import]uid: 32256 topic_id: 35481 reply_id: 141110[/import]

Hi Joshua,

Thanks for the reply but I’ve tested it with 3GP and I get exactly the same error.

I am using media.playSound() (I’ve read up extensively on this) and it works fine on all other Android devices I’ve tested on and on iOS. No other customers have complained out of tens of thousands of downloads.

With Learning Gems and us having the same issue with the same tablet there’s clearly a problem with this particular tablet (and possibly other Android devices) when playing back recorded audio on apps developed in Corona.

If anyone on the Corona staff has any thoughts on this it would be much appreciated.

Thanks,

Ian [import]uid: 123492 topic_id: 35481 reply_id: 141159[/import]

again i dont have the device yet to actually test on but here is the code i am using to record the audio:

[lua] function setAudioFileName(tempLoopID)
dataFileName = “word-”…tempLoopID
local platformName = system.getInfo( “platformName” )
if platformName == “iPhone OS” then dataFileName = dataFileName … “.aif” end
if platformName == “Android” then dataFileName = dataFileName … “.3gp” end
if platformName ~= “Android” and platformName ~= “iPhone OS” then dataFileName = dataFileName … “.3gp” end
–print (dataFileName)
end

function startRecording(tempLoopID,tempWordKeyID)
if recordingLoopID == “none” or recordingLoopID == tempLoopID then – prevents multiple records at one time.

if recordingFlag == false then
–print (“I am recording now”)
recordingLoopID = tempLoopID
activeRecordButton[tempLoopID].isVisible = true
word.setAudioFileName(tempWordKeyID) – generate the file name.
local filePath = system.pathForFile( dataFileName, system.DocumentsDirectory )
–print (filePath)
r = media.newRecording(filePath)
r:startRecording()
recordingFlag = true
else
r:stopRecording()
media.playSound( dataFileName, system.DocumentsDirectory, word.onCompleteSound)

dbfunctions.wordUpdateAudio(tempWordKeyID,dataFileName)
activeRecordButton[tempLoopID].isVisible = false
recordingFlag = false
recordingLoopID = “none”
–print (“DONE RECORDING”)
word.setReset()

end

end[/lua]

and here is the code i am using to Play the audio file later on. Note, i have a bunch of WAV files i use as well. but i doubt those are the issue:

[lua] function audioPlayCurrentWord(tempCount)

–tree.view(usableWords[currentWordCount])
local filetype = usableWords[currentWordCount][“audiofile”]:sub(-3)
–print (“Audio File to Play:”,usableWords[currentWordCount][“audiofile”],filetype)

if filetype == “wav” then
local tempChannel = audio.findFreeChannel()
audio.setVolume( 1.0, { channel=tempChannel } )
local sound1 = audio.loadSound(“audio/list”…usableWords[currentWordCount][“listkeyid”]…"/"…usableWords[currentWordCount][“audiofile”])
audio.play(sound1,{ channel = tempChannel, loops = 0, fadeIn = 10 })
else
media.playSound( usableWords[currentWordCount][“audiofile”], system.DocumentsDirectory, onCompleteSound)
end
end[/lua] [import]uid: 88147 topic_id: 35481 reply_id: 141195[/import]

Very similar to my code.

Learning Gems - Are you experiencing the problem when recording or when playing back the recorded audio?

For me the recording works fine - it’s the playing back of that recorded audio where the error occurs.

D/AwesomePlayer( 115): Failed to open file, all profile flags have to set through setprop method.
I/NuCachedSource2( 115): ERROR_END_OF_STREAM
D/AwesomePlayer( 115): Failed to open file, all profile flags have to set through setprop method.
I/MPEG4Extractor( 115): NON-QT MODE DECIDED
E/MediaPlayer( 6001): error (1, -2147483648)

I bet you would be getting the same error if you could test on a device.

I’ve searched for the error message on Google but nothing of any use comes back. [import]uid: 123492 topic_id: 35481 reply_id: 141199[/import]

I don’t know if its the recording or playback since i don’t have a device to test on. All the customers are saying (and posting 1 star reviews) is that it doesn’t record… but how would they know if it did or didn’t. since they can’t hear it playback…

if you want to sideload my apk on your device and test it. i can send you a apk for testing. email me directly at : rgleason@learninggems.com if you like. [import]uid: 88147 topic_id: 35481 reply_id: 141204[/import]

I suspect that Corona is selecting a sample rate that the Nabi 2 does not support. I can’t confirm this at the moment since we do not have a Nabi 2 to test with. Nor will a remote testing service help us in this case.

Ian, do you have a Nabi 2?
If so, and if you don’t mind, then I might call on you test something out for me.

Also, I recommend that you both write up a bug report about this issue by clicking the “Report a Bug” link at the top of this web page. This way it’ll get in our queue and this issue won’t get lost on our forums. Thanks! [import]uid: 32256 topic_id: 35481 reply_id: 141245[/import]

Hi Joshua,

Yes - I do have a Nabi 2 and would be more than happy to test anything you need me to. Just let me know what you want me to do.

Will submit a bug report now.

Thanks for your help with this. Have a great weekend.

Ian [import]uid: 123492 topic_id: 35481 reply_id: 141344[/import]

I also have 1 app that records audio and i now have had 4 customers complain about this problem on the Nabi 2 device. I dont have a device yet to test on. but it sounds like the identical problem.

I would really like to get this fixed, Corona Staff please help us out here. [import]uid: 88147 topic_id: 35481 reply_id: 141097[/import]

On Android, I highly recommend that you record to 3GP. Most Android devices that I’ve tested with only support 3GP and not RAW… and will ignore your RAW format request and record to 3GP anyways.

Corona’s [lua]audio[/lua] API does not support 3GP files, but our [lua]media[/lua] APIs do support 3GP. So, use the [lua]media.playSound()[/lua] function to playback recorded audio files instead.
http://docs.coronalabs.com/api/library/media/playSound.html
[import]uid: 32256 topic_id: 35481 reply_id: 141110[/import]

Hi Joshua,

Thanks for the reply but I’ve tested it with 3GP and I get exactly the same error.

I am using media.playSound() (I’ve read up extensively on this) and it works fine on all other Android devices I’ve tested on and on iOS. No other customers have complained out of tens of thousands of downloads.

With Learning Gems and us having the same issue with the same tablet there’s clearly a problem with this particular tablet (and possibly other Android devices) when playing back recorded audio on apps developed in Corona.

If anyone on the Corona staff has any thoughts on this it would be much appreciated.

Thanks,

Ian [import]uid: 123492 topic_id: 35481 reply_id: 141159[/import]

again i dont have the device yet to actually test on but here is the code i am using to record the audio:

[lua] function setAudioFileName(tempLoopID)
dataFileName = “word-”…tempLoopID
local platformName = system.getInfo( “platformName” )
if platformName == “iPhone OS” then dataFileName = dataFileName … “.aif” end
if platformName == “Android” then dataFileName = dataFileName … “.3gp” end
if platformName ~= “Android” and platformName ~= “iPhone OS” then dataFileName = dataFileName … “.3gp” end
–print (dataFileName)
end

function startRecording(tempLoopID,tempWordKeyID)
if recordingLoopID == “none” or recordingLoopID == tempLoopID then – prevents multiple records at one time.

if recordingFlag == false then
–print (“I am recording now”)
recordingLoopID = tempLoopID
activeRecordButton[tempLoopID].isVisible = true
word.setAudioFileName(tempWordKeyID) – generate the file name.
local filePath = system.pathForFile( dataFileName, system.DocumentsDirectory )
–print (filePath)
r = media.newRecording(filePath)
r:startRecording()
recordingFlag = true
else
r:stopRecording()
media.playSound( dataFileName, system.DocumentsDirectory, word.onCompleteSound)

dbfunctions.wordUpdateAudio(tempWordKeyID,dataFileName)
activeRecordButton[tempLoopID].isVisible = false
recordingFlag = false
recordingLoopID = “none”
–print (“DONE RECORDING”)
word.setReset()

end

end[/lua]

and here is the code i am using to Play the audio file later on. Note, i have a bunch of WAV files i use as well. but i doubt those are the issue:

[lua] function audioPlayCurrentWord(tempCount)

–tree.view(usableWords[currentWordCount])
local filetype = usableWords[currentWordCount][“audiofile”]:sub(-3)
–print (“Audio File to Play:”,usableWords[currentWordCount][“audiofile”],filetype)

if filetype == “wav” then
local tempChannel = audio.findFreeChannel()
audio.setVolume( 1.0, { channel=tempChannel } )
local sound1 = audio.loadSound(“audio/list”…usableWords[currentWordCount][“listkeyid”]…"/"…usableWords[currentWordCount][“audiofile”])
audio.play(sound1,{ channel = tempChannel, loops = 0, fadeIn = 10 })
else
media.playSound( usableWords[currentWordCount][“audiofile”], system.DocumentsDirectory, onCompleteSound)
end
end[/lua] [import]uid: 88147 topic_id: 35481 reply_id: 141195[/import]

Very similar to my code.

Learning Gems - Are you experiencing the problem when recording or when playing back the recorded audio?

For me the recording works fine - it’s the playing back of that recorded audio where the error occurs.

D/AwesomePlayer( 115): Failed to open file, all profile flags have to set through setprop method.
I/NuCachedSource2( 115): ERROR_END_OF_STREAM
D/AwesomePlayer( 115): Failed to open file, all profile flags have to set through setprop method.
I/MPEG4Extractor( 115): NON-QT MODE DECIDED
E/MediaPlayer( 6001): error (1, -2147483648)

I bet you would be getting the same error if you could test on a device.

I’ve searched for the error message on Google but nothing of any use comes back. [import]uid: 123492 topic_id: 35481 reply_id: 141199[/import]

I don’t know if its the recording or playback since i don’t have a device to test on. All the customers are saying (and posting 1 star reviews) is that it doesn’t record… but how would they know if it did or didn’t. since they can’t hear it playback…

if you want to sideload my apk on your device and test it. i can send you a apk for testing. email me directly at : rgleason@learninggems.com if you like. [import]uid: 88147 topic_id: 35481 reply_id: 141204[/import]

I suspect that Corona is selecting a sample rate that the Nabi 2 does not support. I can’t confirm this at the moment since we do not have a Nabi 2 to test with. Nor will a remote testing service help us in this case.

Ian, do you have a Nabi 2?
If so, and if you don’t mind, then I might call on you test something out for me.

Also, I recommend that you both write up a bug report about this issue by clicking the “Report a Bug” link at the top of this web page. This way it’ll get in our queue and this issue won’t get lost on our forums. Thanks! [import]uid: 32256 topic_id: 35481 reply_id: 141245[/import]

Hi Joshua,

Yes - I do have a Nabi 2 and would be more than happy to test anything you need me to. Just let me know what you want me to do.

Will submit a bug report now.

Thanks for your help with this. Have a great weekend.

Ian [import]uid: 123492 topic_id: 35481 reply_id: 141344[/import]

Has there been any progress on identifying this issue? And hopefully a fix or work around? [import]uid: 88147 topic_id: 35481 reply_id: 142011[/import]

I’ve heard nothing yet - be great to see this issue sorted out.

As I said, I have a device and am more than happy to test anything Corona want to send me and send back all the error logs etc.

Thanks,
Ian [import]uid: 123492 topic_id: 35481 reply_id: 142066[/import]

Sorry about the late response.
We’ll be investigating this issue today. [import]uid: 32256 topic_id: 35481 reply_id: 142116[/import]