I am trying to play files that are created at runtime with the media audio recording methods. They are recorded as .aif and play just fine when I grab them manually from the directory. This happens in the OS X simulator and on an iPhone 3GS. I’ve even created a barebones test app (see below) just to see if something else I was doing was messing it up.
Is it something I’m doing or is it the media:playSound()?
[code]local ui = require(“ui”)
local localGroup = display.newGroup()
local isRecording = false
local path = system.pathForFile( “testing.aif”, system.DocumentsDirectory )
local r = media.newRecording( path )
local startButtonPress = function( event )
if isRecording then
r:stopRecording()
startButton:setText( “Start” )
media:playSound( path )
isRecording = false
else
r:startRecording()
startButton:setText( “Stop” )
isRecording = true
end
end
– Main function
local function main()
– Start button
startButton = ui.newButton{
default = “greenButton.png”,
over = “greenButton_over.png”,
onRelease = startButtonPress,
text = “Start”,
font = native.systemFontBold,
–textColor = { 51, 51, 51, 255 },
size = 20,
emboss = true
}
startButton.x = display.contentWidth - (startButton.width / 2) - 36
startButton.y = display.contentHeight - startButton.height - 3
localGroup:insert( startButton )
return true
end
–Get things moving
main()[/code] [import]uid: 55576 topic_id: 11234 reply_id: 311234[/import]