summaryrefslogtreecommitdiff
path: root/src/com/example/rotorm
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/example/rotorm')
-rw-r--r--src/com/example/rotorm/CameraActivity.java51
1 files changed, 36 insertions, 15 deletions
diff --git a/src/com/example/rotorm/CameraActivity.java b/src/com/example/rotorm/CameraActivity.java
index 7f30a21..84e84fa 100644
--- a/src/com/example/rotorm/CameraActivity.java
+++ b/src/com/example/rotorm/CameraActivity.java
@@ -4,6 +4,8 @@ import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.List;
+
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -35,6 +37,8 @@ private MediaRecorder mMediaRecorder;
private Button captureButton;
private boolean isRecording = false;
+private String filename="";
+
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -42,6 +46,7 @@ public void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.main);
// Create an instance of Camera.
mCamera = getCameraInstance();
+
// Create preview view and set it as the content of our activity.
mPreview = new Preview(this, mCamera);
//int i = R.id.preview;
@@ -64,7 +69,7 @@ public void onCreate(Bundle savedInstanceState) {
mMediaRecorder.stop(); // stop the recording
releaseMediaRecorder(); // release the MediaRecorder object
mCamera.lock(); // take camera access back from MediaRecorder
-
+ Log.i("recorded "+filename, "END");
// inform the user that recording has stopped
setCaptureButtonText("Capture");
isRecording = false;
@@ -73,6 +78,7 @@ public void onCreate(Bundle savedInstanceState) {
if (prepareVideoRecorder()) {
// Camera is available and unlocked, MediaRecorder is prepared,
// now you can start recording
+ Log.i("starting to record", "BEGIN");
mMediaRecorder.start();
// inform the user that recording has started
@@ -120,13 +126,13 @@ private static File getOutputMediaFile(int type){
// To be safe, you should check that the SDCard is mounted
// using Environment.getExternalStorageState() before doing this.
File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(
- Environment.DIRECTORY_PICTURES), "MyCameraApp");
+ Environment.DIRECTORY_PICTURES), "RotorM");
// This location works best if you want the created images to be shared
// between applications and persist after your app has been uninstalled.
// Create the storage directory if it does not exist
if (! mediaStorageDir.exists()){
if (! mediaStorageDir.mkdirs()){
- Log.d("MyCameraApp", "failed to create directory");
+ Log.d("RotorM", "failed to create directory");
return null;
}
}
@@ -152,12 +158,22 @@ private boolean prepareVideoRecorder(){
mCamera.unlock();
mMediaRecorder.setCamera(mCamera);
// Step 2: Set sources
- mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
+
+ //mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
- mMediaRecorder.setVideoSize(720, 480);
+
+ mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
+ mMediaRecorder.setVideoSize(720,480);
+ mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
+
+ //List<Camera.Size> sizes = mCamera.getSupportedVideoSizes();
+ //mCamera.setSize(720,480);
+ //android.hardware.Camera.Parameters params=mCamera.getParameters(); //how to get in?
+ //mMediaRecorder.setVideoSize(720, 480);
// Step 3: Set a CamcorderProfile (requires API Level 8 or higher)
- mMediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));
+ //mMediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));
// Step 4: Set output file
+ filename=getOutputMediaFile(MEDIA_TYPE_VIDEO).toString(); //temporary
mMediaRecorder.setOutputFile(getOutputMediaFile(MEDIA_TYPE_VIDEO).toString());
// Step 5: Set the preview output
mMediaRecorder.setPreviewDisplay(mPreview.getHolder().getSurface());
@@ -177,18 +193,23 @@ private boolean prepareVideoRecorder(){
}
+private void getSupportedVideoSizes() {
+ // TODO Auto-generated method stub
+
+}
+
@Override
public void onClick(View v) {
- /*
+
Log.i("onClick", "BEGIN");
- if(!recording) {
- recording = startRecording();
- } else {
- stopRecording();
- recording = false;
- }
- Log.i("onClick", "END");
- */
+ //if(!recording) {
+ // recording = startRecording();
+ //} else {
+ // stopRecording();
+ // recording = false;
+ //}
+ //Log.i("onClick", "END");
+
}
@Override