Android Open Source - AndroidRecording Audio Playback Activity






From Project

Back to project page AndroidRecording.

License

The source code is released under:

Apache License

If you think the Android project AndroidRecording listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.skd.androidrecordingtest;
/*from w ww  . j a va 2s. co  m*/
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.MotionEvent;

import com.skd.androidrecording.audio.AudioPlaybackManager;
import com.skd.androidrecording.video.PlaybackHandler;
import com.skd.androidrecording.visualizer.VisualizerView;
import com.skd.androidrecording.visualizer.renderer.BarGraphRenderer;

public class AudioPlaybackActivity extends Activity {
  public static String FileNameArg = "arg_filename";
  
  private static String fileName = null;
  
  private VisualizerView visualizerView;
  
  private AudioPlaybackManager playbackManager;
  
  private PlaybackHandler playbackHandler = new PlaybackHandler() {
    @Override
    public void onPreparePlayback() {
      runOnUiThread (new Runnable() {
          public void run() {
            playbackManager.showMediaController();
          }
        });
    }
  };
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.audio_play);
  
    Intent i = getIntent();
    if ((i != null) && (i.getExtras() != null)) {
      fileName = i.getExtras().getString(FileNameArg);
    }
    
    visualizerView = (VisualizerView) findViewById(R.id.visualizerView);
    setupVisualizer();
    
    playbackManager = new AudioPlaybackManager(this, visualizerView, playbackHandler);
    playbackManager.setupPlayback(fileName);
  }
  
  @Override
  public boolean onTouchEvent(MotionEvent event) {
    playbackManager.showMediaController();
      return false;
  }
  
  @Override
  protected void onPause() {
    super.onPause();
    
    playbackManager.pause();
    playbackManager.hideMediaController();
  }
  
  @Override
  protected void onDestroy() {
    playbackManager.dispose();
    playbackHandler = null;
    
    super.onDestroy();
  }
  
  private void setupVisualizer() {
    Paint paint = new Paint();
        paint.setStrokeWidth(5f);
        paint.setAntiAlias(true);
        paint.setColor(Color.argb(200, 227, 69, 53));
        BarGraphRenderer barGraphRendererBottom = new BarGraphRenderer(2, paint, false);
        visualizerView.addRenderer(barGraphRendererBottom);
  }
}




Java Source Code List

com.skd.androidrecording.audio.AudioPlaybackManager.java
com.skd.androidrecording.audio.AudioRecordingHandler.java
com.skd.androidrecording.audio.AudioRecordingThread.java
com.skd.androidrecording.fft.Complex.java
com.skd.androidrecording.fft.FFT.java
com.skd.androidrecording.video.AdaptiveSurfaceView.java
com.skd.androidrecording.video.CameraHelper.java
com.skd.androidrecording.video.CameraManager.java
com.skd.androidrecording.video.MediaPlayerManager.java
com.skd.androidrecording.video.MediaRecorderManager.java
com.skd.androidrecording.video.PlaybackHandler.java
com.skd.androidrecording.video.VideoPlaybackManager.java
com.skd.androidrecording.video.VideoRecordingHandler.java
com.skd.androidrecording.video.VideoRecordingManager.java
com.skd.androidrecording.visualizer.AudioData.java
com.skd.androidrecording.visualizer.FFTData.java
com.skd.androidrecording.visualizer.VisualizerView.java
com.skd.androidrecording.visualizer.renderer.BarGraphRenderer.java
com.skd.androidrecording.visualizer.renderer.Renderer.java
com.skd.androidrecordingtest.AudioPlaybackActivity.java
com.skd.androidrecordingtest.AudioRecordingActivity.java
com.skd.androidrecordingtest.MainActivity.java
com.skd.androidrecordingtest.SizeAdapter.java
com.skd.androidrecordingtest.VideoPlaybackActivity.java
com.skd.androidrecordingtest.VideoRecordingActivity.java
com.skd.androidrecordingtest.utils.NotificationUtils.java
com.skd.androidrecordingtest.utils.StorageUtils.java