Appcelerator Titanium: how to record video?

Deadly 提交于 2019-12-13 12:36:37

问题


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

I am using an Android 2.3.6 device.

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.


回答1:


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.



来源:https://stackoverflow.com/questions/13192528/appcelerator-titanium-how-to-record-video

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!