• Stars
    star
    418
  • Rank 103,620 (Top 3 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created about 11 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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.

More Repositories

1

cropiwa

πŸ“ Configurable Custom Crop widget for Android
Java
2,228
star
2

IncrementProductView

Interesting concept of products incrementation
Java
259
star
3

SeparateShapesView

Simple custom ViewGroup with two shapes inside and simple scale animation
Java
248
star
4

SlidingSquareLoaderView

Marvelous sliding square loader view
Kotlin
179
star
5

Getting-started-with-Kotlin

πŸš€ How to use Kotlin with popular Android libraries
Kotlin
145
star
6

BadgeHolderView

ViewGroup for browse badge view with count of some products
Java
66
star
7

DotsLoaderView

Simple dots loader view
Java
66
star
8

aiohttp_test_chat

Simple aiohttp test chat
Python
58
star
9

django-skd-smoke

This package is intended for simplification of smoke tests creation
Python
48
star
10

libGDX-Path-Editor

libGDX Path Editor lets you easily create complex pathes your game characters can move along.
Java
44
star
11

locust-bokeh-load-test

Python
41
star
12

IndicatorView

Configurable view for ViewPager
Java
40
star
13

jwt-python-tutorial

Example repo for JWT in Python tutorial
Python
25
star
14

VideoFramingDemo

This is a simple demo which works with Android's MediaMetadataRetriever class to extract frames from video file
Java
22
star
15

ListView-Swipe-to-Delete

ListView Swipe to Delete is an Android library which offers a list view navigation mode similar to Any.do application
Java
20
star
16

CenteredContentButton

Centered Content Button is Android library which contains button-like and toggle button-like components with centered content - icon and/or text.
Java
16
star
17

ErrorLayout

Simple layout to show custom error toast with animation
Java
13
star
18

collection_in_kotlin

πŸ“– Collections in Kotlin for Android developers
Kotlin
13
star
19

SketchView

SketchView library provides a custom implementation of a canvas on which user can draw via gestures
Java
13
star
20

django-skd-tools

Python
11
star
21

PullRefreshLayout

Simple custom view pull to refresh
Java
9
star
22

SKLocalizable

Localization add-on for native iOS components
Swift
8
star
23

django-template

Python
8
star
24

django-singleton-tutorial

Example repo for Singleton model in Django tutorial. http://steelkiwi.com/blog/practical-application-singleton-design-pattern/
Python
7
star
25

ErrorParser

Simple JSON parser for Android
Java
7
star
26

django_aiohttp_websockets

Example Django-project with Websocket's chat written using aioHTTP and aioRedis
Python
6
star
27

Android-Image-Worker-Library

Android library that helps you downloading and storing images.
Java
6
star
28

SKExtensions

Common used Extensions in Swift
Swift
5
star
29

NavigationTools

Java
4
star
30

emacs.d

Emacs configuration for working with Python
Emacs Lisp
4
star
31

SoundCloudAuthentificator

Swift
3
star
32

django-steelkiwi-project

project template
Python
3
star
33

hunting-kiwi

πŸ”« Simple ERP system for HR managers
JavaScript
2
star
34

exchange_rates

Crypto currencies exchange rates flutter redux sample project for uamobile 2019
Dart
2
star
35

ErrorParse-ios

Parser class for error text retrieving
Swift
2
star
36

js-helpers

JavaScript
2
star
37

angular1-boilerplate

Boilerplate for Angular 1 on es6-modules
JavaScript
2
star
38

spa-battle

Small SPA implemented with most popular front-end frameworks
HTML
2
star
39

SKChart

Swift
1
star
40

AppDelegate-Firebase

Example of using Firebase PushMessages in iOS
Swift
1
star
41

django-knowledge

Python
1
star