Hi,
I am trying to record an audio from phone’s microphone as another audio is being played. This works fine in the simulator but does not work on my iPad. Recording takes place on the iPad but audio is not played.
My code is as below:
I have marked where I start the audio with a comment: Playing audio here
and
I have marked where I start recording with a comment: Starting Recording here
local function startAudioRecording ( ) if "simulator" == system.getInfo("environment") then gamesettings.audioRecordingCount = gamesettings.audioRecordingCount + 1; dataFileName = "audiorecording" .. gamesettings.audioRecordingCount .. ".aif" else local platformName = system.getInfo( "platformName" ) if "iPhone OS" == platformName then gamesettings.audioRecordingCount = gamesettings.audioRecordingCount + 1; dataFileName = "audiorecording" .. gamesettings.audioRecordingCount .. ".aif" elseif "Android" == platformName then gamesettings.audioRecordingCount = gamesettings.audioRecordingCount + 1; dataFileName = "audiorecording" .. gamesettings.audioRecordingCount .. ".3gp" else -- print("Unknown OS " .. platformName ) end end loadsave.saveTable(gamesettings, "settings.json") -- storing the default settings on the phone local filePath = system.pathForFile( dataFileName, system.DocumentsDirectory ) recordingObj = media.newRecording( filePath) recordingObj:startRecording(); end local function callFinished ( event ) audio.stop( ); if (recordingObj:isRecording()) then recordingObj:stopRecording(); end storyboard.gotoScene( "menu" ); end if (event.phase == "ended") then if (event.target.id == "answer\_button") then answerCallButton.isVisible = false; rejectCallButton.isVisible = false; textLine1.text = "Connected... " audio.stop( ringToneChannel ); audio.dispose( ringTone ); ringTone = nil; ringToneChannel = nil; -- Playing Audio Here santaInitialTalkChannel = audio.play( santaInitialTalk, { channel=2, loops=0, onComplete = callFinished } ); -- Starting Recording Here startAudioRecording(); endCallButton.isVisible = true; end end
Any help will be great.
Thanks