Skip to content

Latest commit

 

History

History
72 lines (67 loc) · 2.91 KB

1.x_en_using_help.md

File metadata and controls

72 lines (67 loc) · 2.91 KB

small-video-record1 Using help

Instructions:

1:Add dependency
compile 'com.mabeijianxi:small-video-record:1.2.2'
2: Add in manifests
 <activity android:name="mabeijianxi.camera.MediaRecorderActivity"/>
3: Initialize the small video record in Application:
public static void initSmallVideo(Context context) {
        // Set the cache path for video
        File dcim = Environment
                .getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);
        if (DeviceUtils.isZte()) {
            if (dcim.exists()) {
                VCamera.setVideoCachePath(dcim + "/mabeijianxi/");
            } else {
                VCamera.setVideoCachePath(dcim.getPath().replace("/sdcard/",
                        "/sdcard-ext/")
                        + "/mabeijianxi/");
            }
        } else {
            VCamera.setVideoCachePath(dcim + "/mabeijianxi/");
        }
        VCamera.setDebugMode(true);
        VCamera.initialize(context);
    }
4: Shift the recording interface or select compression:
// recording
 MediaRecorderConfig config = new MediaRecorderConfig.Buidler()
                .doH264Compress(new AutoVBRMode()
//                        .setVelocity(BaseMediaBitrateConfig.Velocity.ULTRAFAST)
                        )
                .setMediaBitrateConfig(new AutoVBRMode()
//                        .setVelocity(BaseMediaBitrateConfig.Velocity.ULTRAFAST)
                )
                .smallVideoWidth(480)
                .smallVideoHeight(360)
                .recordTimeMax(6 * 1000)
                .maxFrameRate(20)
                .captureThumbnailsTime(1)
                .recordTimeMin((int) (1.5 * 1000))
                .build();
        MediaRecorderActivity.goSmallVideoRecorder(this, SendSmallVideoActivity.class.getName(), config);
// Select local video compression
LocalMediaConfig.Buidler buidler = new LocalMediaConfig.Buidler();
                        final LocalMediaConfig config = buidler
                                .setVideoPath(path)
                                .captureThumbnailsTime(1)
                                .doH264Compress(new AutoVBRMode())
                                .setFramerate(15)
				.setScale(1.0f)
                                .build();
                        OnlyCompressOverBean onlyCompressOverBean = new LocalMediaCompress(config).startCompress();	

Problem (solved in record 2):

1:The Compiler Environment should set in: targetSdkVersion<=22
2:When “java.lang.UnsatisfiedLinkError” occurs, you can try adding “android.useDeprecatedNdk=true” in gradle.properties, and then configure “ndk {abiFilters "armeabi", "armeabi-v7a"}” at “build. gradle” in the main module.

Sample download:

small-video-record:

sample Download Demo1