Android Open Source - video Video Capture






From Project

Back to project page video.

License

The source code is released under:

Apache License

If you think the Android project video 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 edu.cs4730.VideoCap2;
/*from w ww . ja  v a 2  s. c  om*/
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.util.Log;

public class VideoCapture extends Activity implements OnClickListener {
  boolean recording = false;
  CaptureSurface cameraView = null;
  String outputFile = "/sdcard/videoexample.mp4";
  private static final String Tag = "VideoCapture";
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    cameraView = (CaptureSurface) findViewById(R.id.CameraView);
    cameraView.setClickable(true);
    cameraView.setOnClickListener(this);
  }

  @Override
  public void onClick(View v) {
    if (recording) {
      Log.d(Tag,"Calling stopRecording in CaptureSurface");
      cameraView.stopRecording();
      recording = false;
      Log.d(Tag,"finished, now calling native viewer");

      Uri data = Uri.parse(outputFile);
      Intent intent = new Intent(android.content.Intent.ACTION_VIEW, data);
      intent.setDataAndType(data, "video/mp4");
      //This intent fails with a No activity found to handle intent.  This used to work and still does in 2.3.3, but fails above it.
      //no fix could be found that worked.  So, I'm leaving it commented out.
      //startActivity(intent);
      Log.d(Tag,"Native viewer should be playing, we are done.");
      finish();
    } else {
      recording = true;
      Log.d(Tag,"Calling startRecording in CaptureSurface");
      cameraView.startRecording();

    }


  }

}




Java Source Code List

edu.cs4730.PicCapture.PicCapture.java
edu.cs4730.PicCapture.PicCapture.java
edu.cs4730.VideoCap2.CaptureSurface.java
edu.cs4730.VideoCap2.VideoCapture.java
edu.cs4730.VideoCap.CaptureSurface.java
edu.cs4730.VideoCap.VideoCapture.java
edu.cs4730.VideoPlay.videoPlay.java
edu.cs4730.VideoPlay.videoPlay.java
edu.cs4730.piccapture2.CameraPreview.java
edu.cs4730.piccapture2.CameraPreview.java
edu.cs4730.piccapture2.MainActivity.java
edu.cs4730.piccapture2.MainActivity.java
edu.cs4730.piccapture3.MainActivity.java
edu.cs4730.piccapture3.MainActivity.java
edu.cs4730.videocapture3.MainActivity.java
edu.cs4730.videocapture3.MainActivity.java
edu.cs4730.videocapture.MainActivity.java
edu.cs4730.videocapture.MainActivity.java