Library integrates screen record api in android 5.0 and above
Java HTML
Latest commit 3f53834 Nov 11, 2015 huaiqian change structure
Permalink
Failed to load latest commit information.
app
gradle/wrapper
icon
recordlibrary
.gitignore
README.md
VideoCpature.iml
build.gradle
gradlew
gradlew.bat
settings.gradle

README.md

ScreenRecordLibrary

Intro

ScreenRecord library is used to capture screen for devices with android 5.0 and above. It used the latest Media Projection API exposed by android since API level 21.

Demo

If you want to use this library in your code, you can download the project, and refer to app module in the code.
If you just want to use this Screen Record Tool, you can download it from google play or 应用宝

Usage

This library is uploaded to sonatype, you can use it following these steps:
1. add sonatype repository in your build.gradle

    allprojects {
    repositories {
        jcenter()
        mavenCentral()
        maven {
            url 'https://oss.sonatype.org/content/groups/public'
        }
    }
  1. need to compile this library
        compile 'com.github.charlesjean:recordlibrary:0.0.2'
  1. after you acquire media projection permission from user, you need to start screen record service with the following code
          Intent intent = new Intent(this, RecordService.class);
            int width = ParameterManager.getInstance(this).getVideoWidth();
            int height = ParameterManager.getInstance(this).getVideoHeight();
            boolean needAudio = ParameterManager.getInstance(this).needAudio();
            boolean isLandScapeMode = ParameterManager.getInstance(this).isLandScapeModeOn();
            int quality = ParameterManager.getInstance(this).getVideoQuality();

            intent.putExtra(RecordConst.RECORD_INTENT_RESULT, resultCode);
            intent.putExtra(RecordConst.RECORD_DATA_INTENT, data);
            intent.putExtra(RecordConst.KEY_RECORD_SCREEN_WITH, width);
            intent.putExtra(RecordConst.KEY_RECORD_SCREEN_HEIGHT, height);
            intent.putExtra(RecordConst.KEY_RECORD_NEED_AUDIO, needAudio);
            intent.putExtra(RecordConst.KEY_RECORD_IS_LANDSCAPE, isLandScapeMode);
            intent.putExtra(RecordConst.KEY_VIDEO_QUALITY, quality);
            intent.putExtra(RecordConst.KEY_VIDEO_DIR, getResources().getString(R.string.save_dir));
            intent.putExtra(RecordConst.KEY_NOTIFICATION_ICON, R.drawable.ic_launcher);
            startService(intent);

For more detail, you can refer to the demo project.

License

This library is under Apache License, Version 2.0, not including the demo project.