Git Product home page Git Product logo

recordablesurfaceview's Introduction

RecordableSurfaceView

RecordableSurfaceView is a lightweight library designed to bring MP4 recording of an OpenGL renderer on Android to your app with ease.

  • Functionally a drop-in replacement for GLSurfaceView
  • Full lifecycle callbacks in a View tree.
  • Minimal effort to implement.

How to get set up

  1. Add RecordableSurfaceview to your project
implementation 'com.uncorkedstudios.android:recordable-surfaceview:1.5.0'
  1. Add the following permissions to your Manifest (and request them!)
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
  1. in your main GL Activity or top-level renderer, implement
public class SomeActivity extends Activity implements RecordableSurfaceView.RendererCallbacks
  1. Set the callbacks on the RecordableSurfaceView and init the recording stack:
mSurfaceView.setRendererCallbacks(this);
mSurfaceView.doSetup();

How to record:

  • Ensure you've called doSetup and requested (and have been granted!) permissions.
  • Init the recording itself by creating a File object for output, and calling initRecorder on the surface. You will also need to supply the dimensions of the output movie file, and optionally implement the callbacks provided by the MediaRecorder
  • Call startRecording when looking to capture, and stopRecording when done.
  • NOTE the underlying MediaRecorder still abides by the lifecycle state machine as defined by the MediaRecorder in Android. In order to record again aftering calling stopRecording you will need to re-init by calling initRecorder again.

See also:

MediaRecorder

MediaRecorder.OnErrorListener

MediaRecorder.OnInfoListener

TODO:

  • expose configuration options of media recorder

License

Apache 2.0

recordablesurfaceview's People

Contributors

charlesvestal avatar katmitchell avatar spacelenny avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.