/AlbumCameraRecorder

🔥一个高效的多媒体支持操作库,可多方面的简单配置操作相册、拍照、录制、录音等功能。也支持配套使用的展示图片、视频、音频的九宫格功能。 (An efficient multimedia support operation library, can be a variety of simple configuration operation album, photo, recording, recording and other functions.Also support supporting the use of the display of pictures, video, audio of the nine grid function.)

Primary LanguageJavaMIT LicenseMIT

AlbumCameraRecorderX

MinSdk License

This release is an offshoot of the AndroidX release.Any version number followed by an X is based on the AndroidX version.

At present, it has been put into use in the formal project.

If you have any suggestions or want to add functions, you can put forward on Issues

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 the display of pictures, video, audio 9 grid function.

  • Part of the code for this open source library comes from Matisse.
  • This open source library camera code from CameraView.

Non-X version branching

A non-X library version, no longer maintained(https://github.com/zhongjhATC/AlbumCameraRecorder/tree/master)

peculiarity

  • Support for custom styles. Support to change the relevant buttons inside.
  • Support album, recording, recording and other functions in one (similar to Douyin, etc.), and you can configure only one of the functions independently.
  • Customizable permission requests are supported and can be directed to the library to complete permission requests
  • While there are many features, some libraries can be introduced as required
  • Rich callback interface and debugging information, using the existing API to achieve a rich effect.
  • Strong compatibility, whether the lower version of 4.1 or the current latest version of Android 11, has been carried out related compatibility processing
  • Support all image reading and processing customization, such as custom Glide, Fresco, etc
  • Support to select pictures from albums
  • Supports photo albums to select different folders according to mobile phone files
  • Strong customization, support a variety of maximum selection of how many pictures, videos, and so on, also support only display custom file size
  • Support custom album style, color, size and so on
  • Support flash and front and rear camera switching when taking photos
  • Support double finger touch to zoom in and out when recording and photographing, and single finger sliding up and down to control brightness
  • recording, taking photos, pressing buttons, all of the UI is customizable, all SVG images are good for handling animation details
  • Recording support for segment recording, video editing will be added in the future
  • Image editing supports color graffiti, input text, Mosaic processing, rotation, cropping and other processing
  • Support recording processing
  • Deep compression is available for all recorded photos, custom compression is available for pictures, LuBan compression is available for Demo, and FFMPEG compression is available for videos
  • Perfect cache management system
  • Improved animation effects, which will be added later
  • Performance optimizations, memory leaks -- all carefully addressed

import

Step 1. Add the JitPack repository to your build file

allprojects {
	repositories {
		...
		maven { url 'https://www.jitpack.io' }
	}
}

Step 2. Add the dependency

dependencies {
     // if you want to simplify the code and at the same time use multilibrary and progresslibrary, albumCameraRecorderCommon, can directly use the combined library
     implementation 'com.github.zhongjhATC.AlbumCameraRecorder:combined:1.1.33X'

     // Public library, if not using the combined library above
     implementation 'com.github.zhongjhATC.AlbumCameraRecorder:albumCameraRecorderCommon:1.1.33X'
     // core lib, call display album, screen recording, recording, etc
     implementation 'com.github.zhongjhATC.AlbumCameraRecorder:multilibrary:1.1.33X'
     // It is mainly used to display the relevant upload progress after obtaining data. If you only need to obtain photos, videos and recordings, you don't need to use this
     implementation 'com.github.zhongjhATC.AlbumCameraRecorder:progresslibrary:1.1.33X'

     // use it with editing pictures
     implementation 'com.github.zhongjhATC.AlbumCameraRecorder:imageedit:1.1.33X'
     // For editing video
     implementation 'com.github.zhongjhATC.AlbumCameraRecorder:videoedit:1.1.33X'
}

snapshoot

Compatibility testing of mobile phones is commonly used in the market

100% throughCompatibility Test Report.

use

Enable multimedia related functions

    // Shooting Related Settings
    CameraSetting cameraSetting = new CameraSetting();
    // Types supported: picture, video
    cameraSetting.mimeTypeSet(MimeType.ofAll());

    // album
    mAlbumSetting = new AlbumSetting(false)
            // Types supported: picture, video
            .mimeTypeSet(MimeType.ofAll())
            // Whether to display the number of multiple selected images
            .countable(true)
            // Custom filter
            .addFilter(new GifSizeFilter(320, 320, 5 * BaseFilter.K * BaseFilter.K))
            // Open the original
            .originalEnable(true)
            // Maximum original size, valid only if originalEnable is true
            .maxOriginalSize(10);

    // recorder
    RecorderSetting recorderSetting = new RecorderSetting();

    // globalSetting
    mGlobalSetting = MultiMediaSetting.from(MainSimpleActivity.this).choose(MimeType.ofAll());

    if (mBinding.cbAlbum.isChecked()){
        // Open the album function
        mGlobalSetting.albumSetting(mAlbumSetting);
    }
    if (mBinding.cbCamera.isChecked()){
        // Turn on the shooting function
        mGlobalSetting.cameraSetting(cameraSetting);
    }
    if (mBinding.cbRecorder.isChecked()){
        // Enable recording
        mGlobalSetting.recorderSetting(recorderSetting);
    }

    mGlobalSetting
            .setOnMainListener(errorMessage -> {
                Log.d(TAG, errorMessage);
                Toast.makeText(MainSimpleActivity.this.getApplicationContext(), errorMessage, Toast.LENGTH_LONG).show();
            })
            // Set paths and 7.0 protection paths, and so on
            .allStrategy(new SaveStrategy(true, "com.zhongjh.cameraapp.fileprovider", "aabb"))
            // for glide-V4
            .imageEngine(new Glide4Engine())
            // Maximum 5 images or maximum 3 video
            .maxSelectablePerMediaType(null,
                                    5,
                                    3,
                                    3,
                                    alreadyImageCount,
                                    alreadyVideoCount,
                                    alreadyAudioCount)
                            .forResult(REQUEST_CODE_CHOOSE);

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:
            // Gets the type and sets different things according to the type
            switch (MultiMediaSetting.obtainMultimediaType(data)) {
                case MultimediaTypes.PICTURE:
                    // picture
                    List<String> path = MultiMediaSetting.obtainResult(data);
                    break;
                case MultimediaTypes.VIDEO:
                    // video
                    List<String> videoPath = MultiMediaSetting.obtainResult(data);
                    break;
                case MultimediaTypes.AUDIO:
                    // voice
                    RecordingItem recordingItem = MultiMediaSetting.obtainRecordingItemResult(data);
                    break;
                case MultimediaTypes.BLEND:
                    // Mixed type, which means the image may accompany the video.
                    List<Uri> blends = MultiMediaSetting.obtainResult(data);
                    break;
            }
            break;
    }
}

If you need to use the data of the nine-grid exhibition, you can see A code for details.

Related APIs, more APIs and support for continuous enrichment added

If you use the shown library, the following APIs are also useful for you

History update

History update.

Apk direct experience download

Write in the last

  1. If you think it works, give me a Star(GitHub

  2. If you find any BUG, please leave a comment or leave a Issues(Issues

  3. Any reprint please indicate the source