Camera Display Window

I have a non-corona xcode app for iOS that has a small window within the standard iphone display that the back facing camera live view shows in. Plus a button to take a photo and display that photo in a similar small size windows beside the live view.

I would like to get this working code into a plugin to use in the regular(non-enterprise) version of corona.

Any thoughts on how what to watch out for in trying to place such a windows in normal corona?

Right now this code is contained mainly in a FirstViewController.h and .m files.

hitechartist - Let me first ask you something to understand the context. You say you want to make a plugin to use in regular Corona SDK. That actually involves a bit more complexity as the plugins for Corona SDK (non-Enterprise developers) that are coming will be hosted by us (the company). Is that what you intend?

On the other hand, if you build the plugin for your own use, you are free to do whatever you want, but you do need Corona Enterprise to build.

Does that make sense?

Thanks for getting to me.

Yes, what I had in mind was to build a plugin I could sell or at the least build and then use in my regular corona sdk.

I thought I saw others advertising plugins for sale and thought that might be possible.

It would still be helpful and you could point me in the right direction.

Even if for my own use.

hitechartist - Ok, I understand the scenario you had in mind. That scenario will actually be possible, but it will take a little bit of time. Not a ton - but it isn’t possible today. We do plan on enabling a full plugin marketplace. Once that is up, you would be able to develop a plugin and then sell it on the marketplace (which is what you had in mind).

The plugins that you have seen some people selling are Enterprise plugins for other Enterprise customers. They cannot yet be used by Corona SDK customers since the whole build server isn’t quite in place yet.

As for you using it for your own use, within Corona SDK - that would be possible if it is hosted on our server at some point as a “normal” plugin (i.e. the marketplace scenario). If you build it for your own use, you will still have to build with Corona Enterprise as the Corona simulator by itself cannot build in native libraries.

Not sure if I cleared things up or just confused you further…

In any case, I’m not the person to answer your actual technical question. But given the above, I think your question has just turned into what is a best practice for doing something like what you describe in a plugin? Is that right?

David

Yes that’s right and thank you.

What you need is to get access to the id<CoronaRuntime> which then lets you get access to the root view controller.

<code>

CORONA_EXPORT

int luaopen_plugin_nameOfPlugin( lua_State *L )

{

    void *platformContext = CoronaLuaGetContext( L );

    id<CoronaRuntime> runtime = (id<CoronaRuntime>)platformContext;

    UIViewController *root = runtime.appViewController;

    …

}

</code>

There’s more info on CoronaRuntime here: http://docs.coronalabs.com/native/ios/CoronaRuntime.html

And also (though I’m guessing you already know this) info on presenting view controllers from other view controllers here: http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html

hitechartist - Let me first ask you something to understand the context. You say you want to make a plugin to use in regular Corona SDK. That actually involves a bit more complexity as the plugins for Corona SDK (non-Enterprise developers) that are coming will be hosted by us (the company). Is that what you intend?

On the other hand, if you build the plugin for your own use, you are free to do whatever you want, but you do need Corona Enterprise to build.

Does that make sense?

Thanks for getting to me.

Yes, what I had in mind was to build a plugin I could sell or at the least build and then use in my regular corona sdk.

I thought I saw others advertising plugins for sale and thought that might be possible.

It would still be helpful and you could point me in the right direction.

Even if for my own use.

hitechartist - Ok, I understand the scenario you had in mind. That scenario will actually be possible, but it will take a little bit of time. Not a ton - but it isn’t possible today. We do plan on enabling a full plugin marketplace. Once that is up, you would be able to develop a plugin and then sell it on the marketplace (which is what you had in mind).

The plugins that you have seen some people selling are Enterprise plugins for other Enterprise customers. They cannot yet be used by Corona SDK customers since the whole build server isn’t quite in place yet.

As for you using it for your own use, within Corona SDK - that would be possible if it is hosted on our server at some point as a “normal” plugin (i.e. the marketplace scenario). If you build it for your own use, you will still have to build with Corona Enterprise as the Corona simulator by itself cannot build in native libraries.

Not sure if I cleared things up or just confused you further…

In any case, I’m not the person to answer your actual technical question. But given the above, I think your question has just turned into what is a best practice for doing something like what you describe in a plugin? Is that right?

David

Yes that’s right and thank you.

What you need is to get access to the id<CoronaRuntime> which then lets you get access to the root view controller.

<code>

CORONA_EXPORT

int luaopen_plugin_nameOfPlugin( lua_State *L )

{

    void *platformContext = CoronaLuaGetContext( L );

    id<CoronaRuntime> runtime = (id<CoronaRuntime>)platformContext;

    UIViewController *root = runtime.appViewController;

    …

}

</code>

There’s more info on CoronaRuntime here: http://docs.coronalabs.com/native/ios/CoronaRuntime.html

And also (though I’m guessing you already know this) info on presenting view controllers from other view controllers here: http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html