From c23eb9dd00f061b0d9b20cebe99989450a52de86 Mon Sep 17 00:00:00 2001 From: pspchucky Date: Sun, 8 Mar 2015 23:33:36 -0700 Subject: [PATCH] Update camera.py --- plyer/platforms/android/camera.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plyer/platforms/android/camera.py b/plyer/platforms/android/camera.py index cc7391126..4a6201082 100644 --- a/plyer/platforms/android/camera.py +++ b/plyer/platforms/android/camera.py @@ -24,6 +24,20 @@ def _take_picture(self, on_complete, filename=None): parcelable = cast('android.os.Parcelable', uri) intent.putExtra(MediaStore.EXTRA_OUTPUT, parcelable) activity.startActivityForResult(intent, 0x123) + + def _take_video(self, on_complete, filename=None): + assert(on_complete is not None) + self.on_complete = on_complete + self.filename = filename + android.activity.unbind(on_activity_result=self._on_activity_result) + android.activity.bind(on_activity_result=self._on_activity_result) + intent = Intent(MediaStore.ACTION_VIDEO_CAPTURE) + uri = Uri.parse('file://' + filename) + parcelable = cast('android.os.Parcelable', uri) + intent.putExtra(MediaStore.EXTRA_OUTPUT, parcelable) + intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1) #0 = low quality, suitable for MMS messages, 1 = high quality + #intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, X) #Optional, allows limiting record time to X seconds. + activity.startActivityForResult(intent, 0x123) def _on_activity_result(self, requestCode, resultCode, intent): if requestCode != 0x123: