Using the camera as a fill, only updating when something happening on screen and in portrait

I am trying to use the camera feed as a fill but it only seems to update if something is happening with my app, graphics moving etc… if nothing is moving then the image freezes.

Also my app is in Landscape, how do I rotate the camera ?

Am I doing something wrong or is this how it works ?

Dave

Hi Dave,

I think we’ll need to see some code around this. There could be any number of factors involved.

Thanks,

Brent

Hi,

Am not sure what code you want to see but here is where I display the feed -

cameraBackground = display.newRect( display.contentCenterX, display.contentCenterY, display.contentWidth, display.contentHeight ) cameraBackground.name = "image" characterGroup:insert( 1, cameraBackground )   if ( system.getInfo("environment") ~= "simulator" ) then cameraBackground.fill = { type="camera" } else cameraBackground:setFillColor( 0.5 ) -- testing in simulator end

Hi Dave,

Hmmm… the code looks basically fine. Can you describe what you mean by “something is happening with my app, graphics moving etc…”? Which graphics are moving, and how? When exactly does the camera fill halt? Are there any errors in the Terminal?

Brent

So basically the feed comes on and freezes, then if I move any graphics around the screen the feed goes live again. The demo I looked at had fish going around the screen so am wondering if this is needed.

At the moment am spinning the button that launches the live feed and that keeps it live. So that will do for now but the portrait only thing is no good as I need it landscape.

Not checked console as running on device.

Dave

Hi Dave,

Are you using “display.setDrawMode( “default” )” anywhere, which would disable “forceRender”? I think the latter may be required to keep the video feed updating, but I’m not an expert on this topic.

For the orientation, can you just rotate the fill to make it go to landscape? Again, I wish I could be more helpful but this feature is not my expertise.

Brent

Cheers Brent.

Both problems sorted :slight_smile:

For anyone else reading this I switch on forceRender while the feed is live, then go back to Default when switched off. Am presuming Default is the default as I couldn’t find setDrawMode in any of my code.

For the portrait/landscape problem I swapped the width and height around and then rotated 90 degrees.

Thanks again.

Dave

Hi Dave,

I think we’ll need to see some code around this. There could be any number of factors involved.

Thanks,

Brent

Hi,

Am not sure what code you want to see but here is where I display the feed -

cameraBackground = display.newRect( display.contentCenterX, display.contentCenterY, display.contentWidth, display.contentHeight ) cameraBackground.name = "image" characterGroup:insert( 1, cameraBackground )   if ( system.getInfo("environment") ~= "simulator" ) then cameraBackground.fill = { type="camera" } else cameraBackground:setFillColor( 0.5 ) -- testing in simulator end

Hi Dave,

Hmmm… the code looks basically fine. Can you describe what you mean by “something is happening with my app, graphics moving etc…”? Which graphics are moving, and how? When exactly does the camera fill halt? Are there any errors in the Terminal?

Brent

So basically the feed comes on and freezes, then if I move any graphics around the screen the feed goes live again. The demo I looked at had fish going around the screen so am wondering if this is needed.

At the moment am spinning the button that launches the live feed and that keeps it live. So that will do for now but the portrait only thing is no good as I need it landscape.

Not checked console as running on device.

Dave

Hi Dave,

Are you using “display.setDrawMode( “default” )” anywhere, which would disable “forceRender”? I think the latter may be required to keep the video feed updating, but I’m not an expert on this topic.

For the orientation, can you just rotate the fill to make it go to landscape? Again, I wish I could be more helpful but this feature is not my expertise.

Brent

Cheers Brent.

Both problems sorted :slight_smile:

For anyone else reading this I switch on forceRender while the feed is live, then go back to Default when switched off. Am presuming Default is the default as I couldn’t find setDrawMode in any of my code.

For the portrait/landscape problem I swapped the width and height around and then rotated 90 degrees.

Thanks again.

Dave