AndroidRecording


Source link: https://github.com/steelkiwi/AndroidRecording

Android Recording Library

Android Recording library offers convenient tools for audio/video recording and playback.

For audio it uses:

  • AudioRecord to capture and save audio signal from microphone
  • MediaPlayer with MediaController to play recorded audio
  • custom Visualizer (like bar chart) to represent audio signal on screen while recording and during playback

For video it uses:

  • Camera and MediaRecorder to record a video of specified resolution
  • MediaPlayer with MediaController to play recorded video
  • custom SurfaceView with adjustable size to properly display Camera preview and recorded video (in portrait and landscape modes)

Record audio: how to use

  1. Setup VisualizerView

    <com.skd.androidrecording.visualizer.VisualizerView  android:id="@+id/visualizerView"  android:layout_width="fill_parent"  android:layout_height="100dp" > </com.skd.androidrecording.visualizer.VisualizerView>
    visualizerView = (VisualizerView) findViewById(R.id.visualizerView);
     setupVisualizer();
      ...  private void setupVisualizer() {
      Paint paint = new Paint();
      paint.setStrokeWidth(5f);
    
    //set bar width  paint.setAntiAlias(true);
      paint.setColor(Color.argb(200, 227, 69, 53));
     //set bar color  BarGraphRenderer barGraphRendererBottom = new BarGraphRenderer(2, paint, false);
      visualizerView.addRenderer(barGraphRendererBottom);
     
    }
    
 2. Start recording thread

```java
  private void startRecording() {

recordingThread = new AudioRecordingThread(fileName, new AudioRecordingHandler() {
 //pass file name where to store the recorded audio

 @Override

 public void onFftDataCapture(final byte[] bytes) {

  runOnUiThread(new Runnable() {

public void run() {

 if (visualizerView != null) {

  visualizerView.updateVisualizerFFT(bytes);
 //update VisualizerView with new audio portion

 
}

}

  
}
);

 
}

@Override

 public void onRecordSuccess() {

}

@Override

 public void onRecordingError() {

}

@Override

 public void onRecordSaveError() {

}

}
);

recordingThread.start();

  
}

  ```  3. When done, stop recording

```java
  private void stopRecording() {

if (recordingThread != null) {

 recordingThread.stopRecording();

 recordingThread = null;

}

  
}

  ```
Play audio: how to use ------------------------  1. Setup VisualizerView  2. Setup AudioPlaybackManager. It will attach MediaPlayer to a VisualizerView

```java
  playbackManager = new AudioPlaybackManager(this, visualizerView, playbackHandler);

  playbackManager.setupPlayback(fileName);
 //pass file name of the recorded audio
  ```
3. Use onscreen MediaController to play/pause/stop/rewind audio
Record video: how to use ------------------------  1. Setup custom SurfaceView (AdaptiveSurfaceView)

```xml
  <com.skd.androidrecording.video.AdaptiveSurfaceView

android:id="@+id/videoView"

android:layout_width="wrap_content"

android:layout_height="wrap_content" />
  ```
2. Setup RecordingManager

```java
  videoView = (AdaptiveSurfaceView) findViewById(R.id.videoView);

  recordingManager = new VideoRecordingManager(videoView, recordingHandler);
 //pass reference to custom SurfaceView
  ```
3. Choose desired video resolution and pass it to RecordingManager, it will adjust size of AdaptiveSurfaceView to properly display Camera output

```java
  recordingManager.setPreviewSize(videoSize);

  ```
4. To start recording use

```java
  recordingManager.startRecording(fileName, videoSize)
  ```
5. To stop recording use

```java
  recordingManager.stopRecording()
  ```
Play video: how to use ------------------------  1. Setup custom SurfaceView (AdaptiveSurfaceView)  2. Setup VideoPlaybackManager. It will attach MediaPlayer to a VisualizerView

```java
  playbackManager = new VideoPlaybackManager(this, videoView, playbackHandler);

  playbackManager.setupPlayback(fileName);
 //pass file name of the recorded video
  ```
3. Use onscreen MediaController to play/pause/stop/rewind video
====================================  For more details, please, see the demo project. 

Resources

A RecyclerView Adapter which allows you to have an Infinite scrolling list in your apps. This library offers you a custom adapter to use with any recycler view. You get a callback when the user is about to reach the bottom (or top, depending on your configuration), of the list, which you can use to load more data. You can also customize what the loading view at the bottom of the list looks like.

StayWoke essentially has two features:

  • Keep the screen awake while on specified activities using StayWoke.init(...)
  • Wake up the screen as soon as your app gets deployed on to the phone using WakeUp.init(...)

Banner slider is an easy to use library for implement image sliders in android apps.

EqualsVerifier can be used in Java unit tests to verify whether the contract for the equals and hashCode methods in a class is met.

A simple cache for android and java.

Shutterbug is an Android library that lets you fetch remote images and cache them. It is particularly suited for displaying remote images in lists or grids as it includes a convenience subclass of ImageView (FetchableImageView) that make implementation a one-liner.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes