Video processing in Android

Hi,

I’m trialing Corona Enterprise now, hoping that it can save me development time for my app.  I currently have an Android app that does the following tasks:

  1. live video processing from device camera and saving the video

  2. managing the saved videos in a library and playing them back.

Task (1) involves some heavy data crunching and must be done in Android, while task (2) mainly involves UI and can be done in LUA.

I have gone through all the enterprise samples and I manage to compile all of them, but for 2 weeks I still couldn’t get off the ground in making Corona work for me.  I think Corona will be perfect for my app but I really need some help.  Can you help me please?

Thanks

Caleb

Exactly what issue(s) are you having?

Hi, 

I have some existing android codes that do:

  1. live video processing from device camera and saving the video

  2. managing the saved videos in a library and playing them back.

 

I want to replace (2) with Corona Lua code, and re-use (1) which involves a lot of heavy duty video processing.  I have already gone through and compiled all the sample codes in Enterprise version but I still don’t know how to get started.  Can you help?

 

Caleb

You would want to integrate your (1) code to one of the sample enterprise projects.  Then you would want to hook it up so that you can call those functions from the lua side.  You can see an example of calling some native functions in the SimpleLuaExtension sample project.

Hi, my android project was developed in Eclipse.  It is quite different from the “app” template provided in the Enterprise version.  Can you provide a step-by-step guide on how to do the integration?  Particularly:

  1. what modifications are required on the original Eclipse-Android project?

  2. how to call the Eclipse-Android code from say, “main.lua”?

As I mentioned, I managed to compile all the Enterprise sample codes.  Just don’t know how to do these 2 steps.

Many thanks,

Zeke

Hi,

One more specific question (following the last thread):

  1. how can Corona start a new Android Activity - this is assuming we start off with a Corona menu which can load different Android activities.  This is the opposite of the sample code “Launch from Native UI”, which start of with Android menu and call different Corona functions.

Caleb

  1. How to port your code depends on how your code is structured.  If it was all in one class file you could just copy that over.  If it was integrated into the activity then you’ll have to decouple it from the activity.  You code could be structured in some other format.

  2. In the SimpleLuaExtension sample code, it calls “myTests.printTable(collection)” which is a java function.  You can use that project as an example.  The quick over view is that you have to register(CoronaApplication.java line 38) a java class(PrintTableLuaFunction.java) which implements the com.naef.jnlua.NamedJavaFunction interface. 

  3. You would start an Android Activity like in any other Android application, get the CoronaActivity(http://docs.coronalabs.com/daily/native/android/html/com/ansca/corona/CoronaEnvironment.html#getCoronaActivity()) and then starting the other activity with an intent(http://developer.android.com/reference/android/app/Activity.html#startActivity(android.content.Intent)

Hi,

  1. I am trying to call an Android activity (an Android native layout), so it is not all in one class file.  

  2. I have been trying to call an Android activity from “SimpleLuaExtension” sample code but with no success.  Can you make an example for me please?

  3. What do you mean by “get Corona Activity and then starting the other activity with an intent”?  Can you illustrate this on (2) above please?

  4. Is there anyway we can speed up this communication, perhaps via email or phone please?

Many thanks for your help.

Best,

Caleb

If you want a more indepth sample then http://www.coronalabs.com/products/support-training/.  Basically you need to get an instance of the CoronaActivity and then call CoronaActivity’s startActivity method with the intent that will start your activity. 

Exactly what issue(s) are you having?

Hi, 

I have some existing android codes that do:

  1. live video processing from device camera and saving the video

  2. managing the saved videos in a library and playing them back.

 

I want to replace (2) with Corona Lua code, and re-use (1) which involves a lot of heavy duty video processing.  I have already gone through and compiled all the sample codes in Enterprise version but I still don’t know how to get started.  Can you help?

 

Caleb

You would want to integrate your (1) code to one of the sample enterprise projects.  Then you would want to hook it up so that you can call those functions from the lua side.  You can see an example of calling some native functions in the SimpleLuaExtension sample project.

Hi, my android project was developed in Eclipse.  It is quite different from the “app” template provided in the Enterprise version.  Can you provide a step-by-step guide on how to do the integration?  Particularly:

  1. what modifications are required on the original Eclipse-Android project?

  2. how to call the Eclipse-Android code from say, “main.lua”?

As I mentioned, I managed to compile all the Enterprise sample codes.  Just don’t know how to do these 2 steps.

Many thanks,

Zeke

Hi,

One more specific question (following the last thread):

  1. how can Corona start a new Android Activity - this is assuming we start off with a Corona menu which can load different Android activities.  This is the opposite of the sample code “Launch from Native UI”, which start of with Android menu and call different Corona functions.

Caleb

  1. How to port your code depends on how your code is structured.  If it was all in one class file you could just copy that over.  If it was integrated into the activity then you’ll have to decouple it from the activity.  You code could be structured in some other format.

  2. In the SimpleLuaExtension sample code, it calls “myTests.printTable(collection)” which is a java function.  You can use that project as an example.  The quick over view is that you have to register(CoronaApplication.java line 38) a java class(PrintTableLuaFunction.java) which implements the com.naef.jnlua.NamedJavaFunction interface. 

  3. You would start an Android Activity like in any other Android application, get the CoronaActivity(http://docs.coronalabs.com/daily/native/android/html/com/ansca/corona/CoronaEnvironment.html#getCoronaActivity()) and then starting the other activity with an intent(http://developer.android.com/reference/android/app/Activity.html#startActivity(android.content.Intent)

Hi,

  1. I am trying to call an Android activity (an Android native layout), so it is not all in one class file.  

  2. I have been trying to call an Android activity from “SimpleLuaExtension” sample code but with no success.  Can you make an example for me please?

  3. What do you mean by “get Corona Activity and then starting the other activity with an intent”?  Can you illustrate this on (2) above please?

  4. Is there anyway we can speed up this communication, perhaps via email or phone please?

Many thanks for your help.

Best,

Caleb

If you want a more indepth sample then http://www.coronalabs.com/products/support-training/.  Basically you need to get an instance of the CoronaActivity and then call CoronaActivity’s startActivity method with the intent that will start your activity.