How to record video and store it in a specific location? (Android)

You must Login before you can answer or comment on any questions.

How to record video in Appcelerator Titanium and store in a specific location ?

I am using an Android 2.3.6 device with Titanium SDK 2.1.2GA.

This gist: https://gist.github.com/832488 does not seem to work as suggested / expected. It starts the video capture intent

var intent = Titanium.Android.createIntent({ action: 'android.media.action.VIDEO_CAPTURE' });

as an activityForResult but the callback in

Titanium.Android.currentActivity.startActivityForResult(intent, function(e) { ... });

is never called, none of notifications in code appear and the video is stored in some default location.

The KitchenSink app does not have any video example[for Android], only a camera example code. It does have a record_video module for android video capture but it only manages to capture a picture. The line

mediaTypes: Titanium.Media.MEDIA_TYPE_VIDEO,

does not seem to be working

Any help is appreciated. Thanks.

— asked 8 months ago by Jai Verma
0 Comments

2 Answers

At line 41 of https://gist.github.com/832488 you have this: Titanium.Android.currentActivity.startActivityForResult(intent, function(e) {

You must use current win, so:

win.activity.startActivityForResult(intent, function(e) {

It turns out that its all a 'context' play.

Found the reason at http://developer.appcelerator.com/question/137709/startactivityforresult-and-callback-function-problem#244265

  • The problem really is the use of heavyweight windows in Android by the SDK which means a new Javascript context.
  • A heavyweight window is always created when you open a new window from inside a TabGroup.

So, the gist at: https://gist.github.com/832488 works, given that the camera is not launched from within (inside) of a tabgroup.

Your Answer

Think you can help? Login to answer this question!