How to create a video recorder with CameraX in Android Studio Java tutorial

  Рет қаралды 6,231

Everyday Programmer

Everyday Programmer

Күн бұрын

In this step-by-step tutorial, you will learn how to build a video recorder android app using Android's CameraX library with Java. CameraX is a modern API introduced by Google, which simplifies camera development on Android devices, providing consistent behavior across various devices and versions of Android.
First we will setting up the project and integrating CameraX library into your Android application. Then we will add UI elements such as buttons and overlays. Then we will handle permissions to access the camera, audio and storage. Then we will configuring the camera preview using the Preview use case, allowing users to see what the camera captures in real-time. Then we will Implement the VideoCapture use case to capture high-quality videos with ease.
By the end of this video, you will learn how to create a fully functional video recorder app using Android's CameraX library.
Source Code: tii.la/oIfaMPE
Source Code: github.com/Eve...
CameraX Docs: developer.andr...
Join membership to get access to perks & Complete Source Codes:
/ @everydayprogrammer
Subscribe: www.youtube.co...
Thank you for watching!
Don't forget to like, share, and subscribe for more exciting tutorials on Android app development, Java programming, and other related topics. Happy coding :)

Пікірлер: 36
@osamaghafoor3209
@osamaghafoor3209 Жыл бұрын
Very informative video at all - I've facing many issue regarding camera-X , by this video these issue clear and successfully executed Thanks & keep it up !
@EverydayProgrammer
@EverydayProgrammer Жыл бұрын
Glad it helped. Thank you for your feedback!
@djimi9803
@djimi9803 Жыл бұрын
Keep going java developper 💪💪💪
@EverydayProgrammer
@EverydayProgrammer Жыл бұрын
Sure! Thank you for your support. 🤗
@restolsarl
@restolsarl 6 ай бұрын
very good, but I think something wrong with music playing louder than your voice halfway thru the video..
@meenakshibariyekar3457
@meenakshibariyekar3457 8 күн бұрын
Is their any way to save the recorded videos in a list instead of saving it in mobile device
@systemuser528
@systemuser528 Жыл бұрын
Love you. Dont Stop, one day you will be big.
@EverydayProgrammer
@EverydayProgrammer Жыл бұрын
Thank you very much for you love and support! 🤗
@AndroidDev-rj3oe
@AndroidDev-rj3oe 4 ай бұрын
nice tutorial buddy 👌👍
@EverydayProgrammer
@EverydayProgrammer 4 ай бұрын
Thanks ✌️
@maximepillet4432
@maximepillet4432 Жыл бұрын
Thank you for the video. How could I disable the autofocus of the camera while recording videos ?
@EverydayProgrammer
@EverydayProgrammer Жыл бұрын
Below Camera camera = cameraProvider.bindToLifecycle(this, cameraSelector, preview, videoCapture); Add the following code: camera.getCameraControl().cancelFocusAndMetering();
@addike_online7442
@addike_online7442 11 ай бұрын
Very organized and well understandable ☺️. Anyway I have a question. Can you teach me how to display a text view or image on the screen whiles recording a video. Thanks you
@EverydayProgrammer
@EverydayProgrammer 11 ай бұрын
Yeah! That's easy just add a text view or image view in the layout xml file and additionally add android:elevation="10sp" to your image view or text view element tag and then you are good to go.
@addike_online7442
@addike_online7442 11 ай бұрын
@@EverydayProgrammer thank you so much. I'm most grateful. However, I actually wanted to capture the content display of the text view or image view in the recording. Any advice ? 🥳
@EverydayProgrammer
@EverydayProgrammer 11 ай бұрын
Now I get it. I'll make a tutorial on it ASAP.
@addike_online7442
@addike_online7442 11 ай бұрын
@@EverydayProgrammer thank you once again. I know it would be a new project but I didn't know how to request for that. I really appreciate your time and support 🤝👏
@EverydayProgrammer
@EverydayProgrammer 11 ай бұрын
No problem, It's my pleasure! Thank you for your support!! Always feel free to ask for any tutorial you wish.
@amandasjoberg463
@amandasjoberg463 6 ай бұрын
Unfortunately I could barely hear you over the music. How could I set up a video recording using a CameraController?
@kx4407
@kx4407 7 ай бұрын
please how add timestamp in recording video
@alangordon3980
@alangordon3980 8 ай бұрын
Thank you for this very good example of how to use CameraX to record video. This is the best and easiest one to follow. But I cannot get it to work because keep getting the error message "Error: java.io.IOException: Unable to create MediaStore entry." I have searched and tried a number of suggestions I found online but still get this error. Using both a real android phone or simulator. Is there a version dependency? What would you suggest to fix this?
@EverydayProgrammer
@EverydayProgrammer 8 ай бұрын
Hi, can you tell on which line this error occurs ?
@alangordon3980
@alangordon3980 8 ай бұрын
@@EverydayProgrammer Using the code from your git repository to keep this simple, I only modified the Toast to "log.i" and added some log lines. I am using Android Studio Hedgehog 2023.1.1 When running I am asked for the permissions as expected and I respond with allow. The log shows the following sequence when press the red button: Start Capture Start Finalize Error: 5 java.io.IOException: Unable to create MediaStore entry. The code block that causes the error is below. recording = videoCapture.getOutput().prepareRecording(MainActivity.this, options).withAudioEnabled().start(ContextCompat.getMainExecutor(MainActivity.this), videoRecordEvent -> { if (videoRecordEvent instanceof VideoRecordEvent.Start) { Log.i("VIDEO_RECORD_TAG", "Start Capture"); capture.setEnabled(true); } else if (videoRecordEvent instanceof VideoRecordEvent.Finalize) { Log.i("VIDEO_RECORD_TAG", "Start Finalize"); if (!((VideoRecordEvent.Finalize) videoRecordEvent).hasError()) { String msg = "Video capture succeeded: " + ((VideoRecordEvent.Finalize) videoRecordEvent).getOutputResults().getOutputUri(); Log.i("VIDEO_RECORD_TAG", msg); //Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); } else { recording.close(); recording = null; String msg = "Error: " + ((VideoRecordEvent.Finalize) videoRecordEvent).getError(); msg += " " + ((VideoRecordEvent.Finalize) videoRecordEvent).getCause(); Log.i("VIDEO_RECORD_TAG", msg); //Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); } capture.setImageResource(R.drawable.round_fiber_manual_record_24); } });
@alangordon3980
@alangordon3980 8 ай бұрын
Figured out the problem. Your example code is missing this "if" wrapper: if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) { contentValues.put(MediaStore.Video.Media.RELATIVE_PATH, "Movies/CameraX-Video"); } Put this in and now works with latest Android Studio. Thanks again for the example it has been very helpful. @@EverydayProgrammer
@mretineh1172
@mretineh1172 6 ай бұрын
Thank you for this sire.
@harshittathagat2030
@harshittathagat2030 7 ай бұрын
Can you tell me how can I add external USB camera support in this code?
@oanmuhammad6121
@oanmuhammad6121 Жыл бұрын
great video but i am getting 3gp formate of video. is there a way i can change that to mp4
@pradeepbhadana-er6my
@pradeepbhadana-er6my 5 ай бұрын
in front camera facing mirror problem after recoding
@kujmous
@kujmous 7 ай бұрын
Am I the only person who thought the music was too loud? There were explanations that were pointless.
@EverydayProgrammer
@EverydayProgrammer 7 ай бұрын
Will fix it.
@addike_online7442
@addike_online7442 10 ай бұрын
Hello champion, hope you're doing great. Any updates from the request yet. I look forward to your kind support. Thank you
@EverydayProgrammer
@EverydayProgrammer 10 ай бұрын
Sorry I almost forgot, will definitely upload tomorrow.
@addike_online7442
@addike_online7442 10 ай бұрын
@@EverydayProgrammer 🥳🥳🤝 thank you Soo much. I'll be waiting all day tomorrow 🕺🕺
@mülayim-d7b
@mülayim-d7b Жыл бұрын
hi, Is there a way to record video in the background even when I exit the application or navigate on the home screen?
@EverydayProgrammer
@EverydayProgrammer Жыл бұрын
Hi, Camera X does not allow to record when the app is closed so it's likely not possible to do it. But it might work if implemented with a service with layout.
@mülayim-d7b
@mülayim-d7b Жыл бұрын
@@EverydayProgrammer What does a layout with service mean? can you give an example? I saw this application in the market, I wonder how it was done
YouTube like tags input text field in Android Studio
12:19
Everyday Programmer
Рет қаралды 1,1 М.
Android. Работаем с камерой через CameraX.
26:55
Sergey Arkhipov Java Tutorials
Рет қаралды 9 М.
Brawl Stars Edit😈📕
00:15
Kan Andrey
Рет қаралды 49 МЛН
HAH Chaos in the Bathroom 🚽✨ Smart Tools for the Throne 😜
00:49
123 GO! Kevin
Рет қаралды 13 МЛН
SHAPALAQ 6 серия / 3 часть #aminkavitaminka #aminak #aminokka #расулшоу
00:59
Аминка Витаминка
Рет қаралды 658 М.
How to Build a Camera App With CameraX - Taking Photos
29:35
Philipp Lackner
Рет қаралды 40 М.
DHH - Ruby on Rails, 37signals, and the future of web development
1:09:57
How to Build a Video Recorder With CameraX in Android
11:38
Philipp Lackner
Рет қаралды 10 М.
I Made A Tier List Of Virtual Instruments YOU Submitted
36:11
Make Pop Music
Рет қаралды 8 М.
Brawl Stars Edit😈📕
00:15
Kan Andrey
Рет қаралды 49 МЛН