![]() ![]() When the user either completes or cancels the video recording session, the onActivityResult() method of the calling activity will be called. Intent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri) New File(Environment.getExternalStorageDirectory().getAbsolutePath() The following code, for example, specifies that the video should be stored on the SD card in a file named myvideo.mp4: File mediaFile = A specific location for the media file may be specified using the putExtra() method of the intent, referencing the MediaStore.EXTRA_OUTPUT key constant to pass through the target URI value. When invoked in this way, the intent will place the recorded video into a file using a default location and file name. StartActivityForResult(intent, VIDEO_CAPTURE) Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE) The Android built-in video recording intent is represented by MediaStore.ACTION_VIDEO_CAPTURE and may be launched as follows: private static final int VIDEO_CAPTURE = 101 Use of the video capture intent involves, at a minimum, the implementation of code to call the intent activity and a method to handle the return from the activity. Report this ad Calling the Video Capture Intent When the user has finished recording, the intent will return to the application, passing through a reference to the media file containing the recorded video.Īs will be demonstrated in this chapter, this approach allows video recording capabilities to be added to applications with just a few lines of code. This allows an application to invoke the standard Android video recording interface. ![]() There are a number of ways to allow the user to record video from within an Android application via these built-in cameras, but by far the easiest approach is to make use of a camera intent included with the Android operating system. Many Android devices are equipped with at least one camera. ![]() Purchase the fully updated Android Studio Chipmunk Edition of this publication in eBook ($29.99) or Print ($46.99) formatĪndroid Studio Chipmunk Essentials - Java Edition Print and eBook (PDF) editions contain 94 chapters and over 800 pages You are currently reading the Android Studio 1.x - Android 5 Edition of this book. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |