Hi,
I am currently running the following code and this keeps crashes the simulator everytime I press the record button. Is there a limitation with the simulator here? Or is there something wrong with this code? (Most of this code was followed through a tutorial). Any help would be much appreciated.
The code prints the line “recording started” and then the simulator crashes.
display.setStatusBar(display.HiddenStatusBar)
-- Buttons
local stop
local record
-- Variables
local play
local playAgain
local recording
local recPath
local recorded
-- Functions
local Main = {}
local addListeners = {}
local startRecording = {}
local stopRecording = {}
local completed = {}
function Main()
stop = display.newImage('stop.png', 170, 380)
record = display.newImage('record.png', 70, 380)
addListeners()
end
function addListeners()
record:addEventListener('tap', startRecording)
end
function startRecording(e)
stop:addEventListener('tap', stopRecording)
recPath = system.pathForFile('recording.wav', system.DocumentsDirectory)
recording = media.newRecording(recPath)
recording:startTuner()
recording:startRecording()
print("recording started")
end
function stopRecording(e)
print("recording stopped")
stop:removeEventListener('tap', stopRecording)
recording:stopRecording()
recording:stopTuner()
recorded = audio.loadStream('recording.wav', system.DocumentsDirectory)
audio.play(recorded, {onComplete = completed})
end
function completed()
print("sound completed")
end
Main()
Could anyone run this code in their sim and see if it crashes or let me know if there is a problem? [import]uid: 153878 topic_id: 32157 reply_id: 332157[/import]