AlbumCameraRecorderX
Source code address: github.com/zhongjhATC/…
This version is based on the AndroidX version of the development offshoot. Any version number with an X after it is developed on AndroidX.
At present, it has been put into use in official projects.
If you have any suggestions or would like to add features, please feel free to contact us in Issues
Chinese
An efficient multimedia support operation library, can be a variety of simple configuration operation photo, album, recording, recording and other functions.
Also support supporting the use of pictures, video, audio nine grid function.
Part of the code of this open source library comes from Matisse.
Many thanks to Zhihu for providing such a great open source project!
Non-x version branches
Non-x library version, maintenance stopped (github.com/zhongjhATC/…)
features
- Support for custom styles. Support to replace the relevant button inside.
- Supports album, recording, and recording functions in one (such as Tiktok). You can configure only one function.
- Although there is a lot of functionality, some libraries can be introduced with the desired functionality
- Rich callback interface and debugging information, leveraging existing apis to achieve rich effects.
- Strong compatibility, whether the lower version of 4.1 or the current latest version of Android 11, are compatible with relevant processing
- Support all image reading and processing customization, such as custom Glide, Fresco, etc
- Support to select pictures from album
- Support photo albums according to mobile phone files to distinguish different folder selection
- Strong customization, support a variety of customization to select the maximum number of pictures, videos, and so on, also support to show only custom file size
- Support custom album style, color, size and so on
- Support flash and front and rear camera switching when recording and taking photos
- Support double finger touch zoom in and out when recording and taking photos, support single finger sliding up and down to control brightness
- Recording, photographing, long pressing buttons, etc. All UI customizable, all SVG images can handle animation details well
- Recording supports segment recording, and video editing will be added later
- Image editing support color graffiti, input text, Mosaic processing, rotation, cropping and other processing
- Support recording processing
- All the recorded photos are compressed
- Versions after 1.0.19x are compatible with Android Q. If you want to keep your project SDK28, you can keep 1.0.18x
The introduction of
Step 1. Add the JitPack repository to your build file
allprojects {
repositories {
...
maven { url 'https://www.jitpack.io' }
}
}
Copy the code
Step 2. Add the dependency
Dependencies {implementation 'com. Making. ZhongjhATC. AlbumCameraRecorder: albumCameraRecorderCommon: 1.0.29 X' / / public library, Must use this library implementation 'com. Making. ZhongjhATC. AlbumCameraRecorder: multilibrary: 1.0.29 X'/lib/core, Calls to display album, record the screen, recording and implementation '. Com. Making zhongjhATC. AlbumCameraRecorder: progresslibrary: 1.0.29 X '/ /, It is mainly used to display relevant data after obtaining data and corresponding upload progress. If you only need to obtain data such as photos, videos and recordings, write the presentation mode after obtaining by yourself. Can use this implementation does not need to be 'com. Making. ZhongjhATC. AlbumCameraRecorder: imageedit: 1.0.29 X' / / edit images using implementation 'com. Making. ZhongjhATC. AlbumCameraRecorder: videoedit: 1.0.29 X' supporting / / edit video using}Copy the code
The snapshot
Compatibility test of common mobile phones in the market
100% throughCompatibility test report.
use
Enable multimedia related functions
CameraSetting = new CameraSetting(); cameraSetting.mimeTypeSet(MimeType.ofAll()); AlbumSetting = new AlbumSetting(true).mimetypeset (mimetype.ofall ())// Supported types: Pictures, AddFilter (new GifSizeFilter(320, 320, 5 * filter.k * filter.k))// Customize filter.originalEnable (true)// Enable original image.maxOriginalSize (10); RecorderSetting RecorderSetting = new RecorderSetting(); GlobalSetting = MultiMediaSetting. From (mainSimpleactive.this).choose(mimetype.ofall ()); If (mBinding. CbAlbum. IsChecked ()) / / open the photo album features globalSetting albumSetting (albumSetting); If (mBinding. CbCamera. IsChecked ()) / / open shot function globalSetting cameraSetting (cameraSetting); If (mBinding. CbRecorder. IsChecked ()) / / open the recording function globalSetting recorderSetting (recorderSetting); globalSetting .setOnMainListener(errorMessage -> Toast.makeText(MainSimpleActivity.this.getApplicationContext(), "Custom failure message: The tape has reached upper limit, "Toast. LENGTH_LONG) show ()). AllStrategy (new SaveStrategy (true," com. Zhongjh. Cameraapp. Fileprovider ", "AA/test")) / / set the path and protection path, etc. 7.0 imageEngine (new Glide4Engine ()) / / for glide - V4. MaxSelectablePerMediaType (5 - AlreadyImageCount, 1 - alreadyVideoCount, 1 - alreadyAudioCount)// Maximum 10 images or maximum 1 video.Copy the code
Gets the relevant returned data
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode ! = RESULT_OK) return; switch (requestCode) { case REQUEST_CODE_PREVIEW: ``` case REQUEST_CODE_CHOOSE: / / get type, according to the different type switch (MultiMediaSetting. ObtainMultimediaType (data)) {case MultimediaTypes. PICTURE: / / picture a List < String > path = MultiMediaSetting. ObtainPathResult (data); mBinding.mplImageList.addImagesStartUpload(path); break; Case MultimediaTypes. VIDEO: / / VIDEO a List < String > videoPath = MultiMediaSetting. ObtainPathResult (data); mBinding.mplImageList.addVideoStartUpload(videoPath); break; Case MultimediaTypes. AUDIO: / / voice RecordingItem RecordingItem = MultiMediaSetting. ObtainRecordingItemResult (data); mBinding.mplImageList.addAudioStartUpload(recordingItem.getFilePath(), recordingItem.getLength()); break; case MultimediaTypes.BLEND: / / mixed type, which means may with video image. MBinding. MplImageList. AddImagesStartUpload (MultiMediaSetting. ObtainPathResult (data)); break; } break; }}Copy the code
If you need to use the nine grid exhibition data, you can seeThe relevant code.
Related apis, more apis and support continue to be added
- Call a common configuration API for multimedia.
- Call the multimedia album configuration API.
- Call the recording configuration API for multimedia.
- Call multimedia recording configuration API.
- Configure multimedia UI-related properties
The following apis will also be useful if you use the Kyukusu library shown here
- 9 grid related API.
- 9 grid related events.
- 9 grid related properties, configuration UI and so on
History update
Historical updates summarized since version 1.0.1.
Apk direct experience download
- The 1.0.0 version may be slightly different from the latest version of the current code
- Link to download: fir. Im /s9b6? Releas…
Write in the last
-
Welcome to Star (GitHub)
-
If you find any BUG, please leave a message or leave Issues.
-
Any reprint please indicate the source