Skip to content

Commit

Permalink
Update camera.py
Browse files Browse the repository at this point in the history
  • Loading branch information
pspchucky committed Mar 9, 2015
1 parent 3988acc commit c23eb9d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions plyer/platforms/android/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c23eb9d

Please sign in to comment.