Does media.show work on the latest simulators?

I’m using this code to capture and save an image. The image is captured alright, but it does not get saved in the DocumentsDirectory, hence resulting in a warning that the image was not found when i try to display it.

I was going through the forums to check this, and I found some posts around April that said media.show was not supported in simulator back then. I wanted to know if this works on simulator now or not. If yes, what is the error in my code?

local onComplete = function(event) if event.completed then -- Camera shot was successfully taken. local img = display.newImage("CameraShot.jpg", system.DocumentsDirectory, true) else -- User canceled out. end end local listener = function( event ) local filePath = { baseDir = system.DocumentsDirectory, filename = "CameraShot.jpg" } media.show( media.Camera, onComplete, filePath ) return true end bkgd:addEventListener( "tap", listener ) [import]uid: 175611 topic_id: 33838 reply_id: 333838[/import]

This might be an issue of delaying the process by a short time, as in, show the image in your “media.show” function, save it (as you’re doing), but then wait 1 second before you jump up to where you display it using display.newImage. It’s possible that it takes a bit of time before it gets saved to the directory, and it’s not there when you immediately call the display function.

Or, let me ask, is the image never getting saved to the Documents directory? When you check 10 seconds later, does it simply never exist?

Brent
[import]uid: 200026 topic_id: 33838 reply_id: 134505[/import]

I also had such issue, this is my solution:
[lua] if system.getInfo( “environment” ) ~= “simulator” then
image1 = display.newImage(“CameraShot.jpg”, system.DocumentsDirectory, true)
else
display.save( event.target ,“CameraShot.jpg”, system.DocumentsDirectory )
image1 = display.newImage(“CameraShot.jpg”, system.DocumentsDirectory, true)
event.target:removeSelf()
end [/lua]
[import]uid: 172733 topic_id: 33838 reply_id: 134526[/import]

no, the image never gets saved in the directory. Now i used a timer to call the display image function after 10 seconds. again I get the warning that the image does not exist.

This is what i did in the onComplete function:

local onComplete = function(event) if event.completed then -- Camera shot was successfully taken. local function show() local img = display.newImage("CameraShot.jpg", system.DocumentsDirectory, true) end timer.performWithDelay(10000, show) else -- User canceled out. end end [import]uid: 175611 topic_id: 33838 reply_id: 134583[/import]

Did you try something similar to @tatiana, using “display.save”? [import]uid: 200026 topic_id: 33838 reply_id: 134591[/import]

yes, that’s what i was doing initially, but on the device it magnifies the image which is not according to requirements of the project.

I saw a forum post posted around March this year, it said that media.show was supported in iOS and Android but not Corona Simulator. I want to know if that is still the case.

http://developer.coronalabs.com/forum/2012/02/12/saving-camera-picture

First response by Joshua Quick. [import]uid: 175611 topic_id: 33838 reply_id: 134592[/import]

This might be an issue of delaying the process by a short time, as in, show the image in your “media.show” function, save it (as you’re doing), but then wait 1 second before you jump up to where you display it using display.newImage. It’s possible that it takes a bit of time before it gets saved to the directory, and it’s not there when you immediately call the display function.

Or, let me ask, is the image never getting saved to the Documents directory? When you check 10 seconds later, does it simply never exist?

Brent
[import]uid: 200026 topic_id: 33838 reply_id: 134505[/import]

I also had such issue, this is my solution:
[lua] if system.getInfo( “environment” ) ~= “simulator” then
image1 = display.newImage(“CameraShot.jpg”, system.DocumentsDirectory, true)
else
display.save( event.target ,“CameraShot.jpg”, system.DocumentsDirectory )
image1 = display.newImage(“CameraShot.jpg”, system.DocumentsDirectory, true)
event.target:removeSelf()
end [/lua]
[import]uid: 172733 topic_id: 33838 reply_id: 134526[/import]

no, the image never gets saved in the directory. Now i used a timer to call the display image function after 10 seconds. again I get the warning that the image does not exist.

This is what i did in the onComplete function:

local onComplete = function(event) if event.completed then -- Camera shot was successfully taken. local function show() local img = display.newImage("CameraShot.jpg", system.DocumentsDirectory, true) end timer.performWithDelay(10000, show) else -- User canceled out. end end [import]uid: 175611 topic_id: 33838 reply_id: 134583[/import]

Did you try something similar to @tatiana, using “display.save”? [import]uid: 200026 topic_id: 33838 reply_id: 134591[/import]

yes, that’s what i was doing initially, but on the device it magnifies the image which is not according to requirements of the project.

I saw a forum post posted around March this year, it said that media.show was supported in iOS and Android but not Corona Simulator. I want to know if that is still the case.

http://developer.coronalabs.com/forum/2012/02/12/saving-camera-picture

First response by Joshua Quick. [import]uid: 175611 topic_id: 33838 reply_id: 134592[/import]