SystemRecApi

Project Url: Tornaco/SystemRecApi
Introduction: Android 录屏框架,目的是使用 system uid 实现(内录)submix 的录制。
More: Author   ReportBugs   
Tags:

基于 CS 模式,服务端安装于 System 下,拥有系统权限。客户端安装于 data 下(普通安装),通过 aidl 和服务断通讯。

客户端 Gradle 编译

  • Add it in your root build.gradle at the end of repositories:

      allprojects {
          repositories {
              ...
              maven { url 'https://jitpack.io' }
          }
      }
    
  • Add the dependency

    dependencies {compile 'com.github.Tornaco:SystemRecApi:v1.3'}
    

Build in travis

Build Status

服务端的 API 调用(先确保服务端已经安装)

所有 API 均集成于RecBridgeServiceProxy

  1. 获取其实例

    RecBridgeServiceProxy proxy = RecBridgeServiceProxy.from(this);
    
  2. 开始录制

    RecBridgeServiceProxy.from(context)
                     .start(IParam.builder()
                                     .audioSource(settingsProvider.getInt(SettingsProvider.Key.AUDIO_SOURCE))
                                     .frameRate(settingsProvider.getInt(SettingsProvider.Key.FAME_RATE))
                                     .audioBitrate(settingsProvider.getInt(SettingsProvider.Key.AUDIO_BITRATE_RATE_K))
                                     .orientation(settingsProvider.getInt(SettingsProvider.Key.ORIENTATION))
                                     .resolution(settingsProvider.getString(SettingsProvider.Key.RESOLUTION))
                                     .stopOnScreenOff(settingsProvider.getBoolean(SettingsProvider.Key.SCREEN_OFF_STOP))
                                     .useMediaProjection(!isPlatformBridge)
                                     .stopOnShake(settingsProvider.getBoolean(SettingsProvider.Key.SHAKE_STOP))
                                     .shutterSound(settingsProvider.getBoolean(SettingsProvider.Key.SHUTTER_SOUND))
                                     .path(SettingsProvider.get().createVideoFilePath())
                                     .showNotification(true)
                                     .showTouch(settingsProvider.getBoolean(SettingsProvider.Key.SHOW_TOUCH))
                                     .build(),
    
  3. 停止录制

    proxy.stop();
    
  4. 监听(sticky)

    proxy.watch(new IWatcher.Stub() {
             @Override
             public void onStart() throws RemoteException {
    
             }
    
             @Override
             public void onStop() throws RemoteException {
    
             }
    
             @Override
             public void onElapsedTimeChange(String s) throws RemoteException {
    
             }
         });
    
Android 开发经验分享
随手点击下面广告支持本站吧
 
Android 开发经验分享