video recording : out of memory error

All your problems with Audio, Video and Images.

video recording : out of memory error

Postby mitutitu » Thu Jun 25, 2009 6:03 am

Hello,
Someone please help me. I've an application which records video but the problem is a runtimeException. which shows out of memory.
my code is here :
preview.java:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. public class Preview extends SurfaceView implements SurfaceHolder.Callback {
  3.  
  4.         SurfaceHolder mHolder;
  5.  
  6.         Camera mCamera;
  7.  
  8.         Context context;
  9.  
  10.         MediaRecorder recorder = new MediaRecorder();
  11.  
  12.  
  13.  
  14.         Preview(Context context) {
  15.  
  16.                 super(context);
  17.  
  18.  
  19.  
  20.                 // Install a SurfaceHolder.Callback so we get notified when the
  21.  
  22.                 // underlying surface is created and destroyed.
  23.  
  24.                 mHolder = getHolder();
  25.  
  26.                 mHolder.addCallback(this);
  27.  
  28.                 mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  29.  
  30.                 recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
  31.  
  32.                 recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
  33.  
  34.                 recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
  35.  
  36.                 recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
  37.  
  38.                 recorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
  39.  
  40.                 recorder.setVideoSize(480, 320);
  41.  
  42.                 recorder.setVideoFrameRate(15);
  43.  
  44.                 recorder.setMaxDuration(10000);
  45.  
  46.         }
  47.  
  48.  
  49.  
  50.         public void surfaceCreated(SurfaceHolder holder) {
  51.  
  52.                 // The Surface has been created, acquire the camera and tell it where
  53.  
  54.                 // to draw.
  55.  
  56.                 mCamera = Camera.open();
  57.  
  58.                 try {
  59.  
  60.                         mCamera.setPreviewDisplay(holder);
  61.  
  62.                 } catch (IOException e) {
  63.  
  64.                         // TODO Auto-generated catch block
  65.  
  66.                         e.printStackTrace();
  67.  
  68.                 }
  69.  
  70.                 try {
  71.  
  72.  
  73.  
  74.                         recorder.setOutputFile("/sdcard/DCIM/100ANDRO/test.mp4");
  75.  
  76.                         recorder.setPreviewDisplay(mHolder.getSurface());
  77.  
  78.                 } catch (Exception e) {
  79.  
  80.                         e.printStackTrace();
  81.  
  82.                 }
  83.  
  84.  
  85.  
  86.                 Log.d("Has Entered here:", "Starting video");
  87.  
  88.                 if (recorder != null) {
  89.  
  90.                         try {
  91.  
  92.  
  93.  
  94.                                 recorder.prepare();
  95.  
  96.                                 recorder.start();
  97.  
  98.                         } catch (IllegalStateException e) {
  99.  
  100.                                 // TODO Auto-generated catch block
  101.  
  102.                                 e.printStackTrace();
  103.  
  104.                         } catch (IOException e) {
  105.  
  106.                                 // TODO Auto-generated catch block
  107.  
  108.                                 e.printStackTrace();
  109.  
  110.                         } catch (Exception ex) {
  111.  
  112.                                 ex.printStackTrace();
  113.  
  114.                         }
  115.  
  116.                 }
  117.  
  118.         }
  119.  
  120.  
  121.  
  122.         public void surfaceDestroyed(SurfaceHolder holder) {
  123.  
  124.                 // Surface will be destroyed when we return, so stop the preview.
  125.  
  126.                 // Because the CameraDevice object is not a shared resource, it's very
  127.  
  128.                 // important to release it when the activity is paused.
  129.  
  130.                 Log.d("Stopping preview", "in preview class");
  131.  
  132.                 mCamera.stopPreview();
  133.  
  134.                 mCamera = null;
  135.  
  136.         }
  137.  
  138.  
  139.  
  140.         public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
  141.  
  142.                 // Now that the size is known, set up the camera parameters and begin
  143.  
  144.                 // the preview.
  145.  
  146.                 Camera.Parameters parameters = mCamera.getParameters();
  147.  
  148.                 // Camera.par
  149.  
  150.                 parameters.setPreviewSize(w, h);
  151.  
  152.                 mCamera.setParameters(parameters);
  153.  
  154.                 mCamera.startPreview();
  155.  
  156.         }
  157.  
  158.  
  159.  
  160.         public void saveAndStop() {
  161.  
  162.  
  163.  
  164.                 if (recorder != null) {
  165.  
  166.                         recorder.stop();
  167.  
  168.                         recorder.reset();
  169.  
  170.                         recorder.release();
  171.  
  172.                 }
  173.  
  174.         }
  175.  
  176. }
  177.  
  178.  
  179.  
  180.  
Parsed in 0.040 seconds, using GeSHi 1.0.8.4


and the activity file is:
Capture.java:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. public class Capture extends Activity {
  3.  
  4.         private Preview mPreview;
  5.  
  6.         SurfaceView sv;
  7.  
  8.         SurfaceHolder holder;
  9.  
  10.  
  11.  
  12.         /** Called when the activity is first created. */
  13.  
  14.         @Override
  15.  
  16.         public void onCreate(Bundle savedInstanceState) {
  17.  
  18.                 super.onCreate(savedInstanceState);
  19.  
  20.  
  21.  
  22.                 mPreview = new Preview(this);
  23.  
  24.                 setContentView(mPreview);
  25.  
  26.  
  27.  
  28.         }
  29.  
  30.  
  31.  
  32.         @Override
  33.  
  34.         public boolean onCreateOptionsMenu(Menu menu) {
  35.  
  36.                 MenuItem capture = menu.add("Capture");
  37.  
  38.                 MenuItem save = menu.add("Save");
  39.  
  40.                 return super.onCreateOptionsMenu(menu);
  41.  
  42.         }
  43.  
  44.  
  45.  
  46.         public boolean onOptionsItemSelected(MenuItem item) {
  47.  
  48.                 if (item.getTitle().equals("Capture")) {
  49.  
  50.  
  51.  
  52.                         try {
  53.  
  54.                                 // Recording is now started
  55.  
  56.                                 mPreview.recorder.start();
  57.  
  58.  
  59.  
  60.                         } catch (Exception e) {
  61.  
  62.                                 e.printStackTrace();
  63.  
  64.                                 Log.d("Has not finished here:", "Starting video");
  65.  
  66.                         }
  67.  
  68.  
  69.  
  70.                 } else if (item.getTitle().equals("Save")) {
  71.  
  72.                         mPreview.saveAndStop();
  73.  
  74.                 }
  75.  
  76.                 return true;
  77.  
  78.         }
  79.  
  80.  
  81.  
  82. }
  83.  
  84.  
  85.  
  86.  
Parsed in 0.034 seconds, using GeSHi 1.0.8.4


so if anyone can give me the solution I'd be grateful.

thanks,
mitu
User avatar
mitutitu
Senior Developer
Senior Developer
 
Posts: 113
Joined: Tue Jun 09, 2009 7:40 am
Location: St. John's, NL, Canada

Top

Postby Jonpro » Thu Jul 23, 2009 8:34 pm

Make sure you have the camera permission enabled. You can do this by adding

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <uses-permission android:name="android.permission.CAMERA"></uses-permission>
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


to your manifest file.
Jonpro
Freshman
Freshman
 
Posts: 6
Joined: Thu Jul 23, 2009 8:29 pm

Postby mitutitu » Fri Jul 24, 2009 5:11 am

hello,
I've done all possible things regarding out of memory exception. But still no hope. And Camera permission is existing there from the beginning.
I think problem is something else. If anybody can help me out. :(

thanks,
mitu
User avatar
mitutitu
Senior Developer
Senior Developer
 
Posts: 113
Joined: Tue Jun 09, 2009 7:40 am
Location: St. John's, NL, Canada

Postby Jonpro » Fri Jul 24, 2009 5:31 am

CamcorderPreview.java:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class CamcorderPreview extends SurfaceView implements
  2.  
  3.                 SurfaceHolder.Callback {
  4.  
  5.  
  6.  
  7.         MediaRecorder recorder;
  8.  
  9.         SurfaceHolder holder;
  10.  
  11.  
  12.  
  13.         public CamcorderPreview(Context context, AttributeSet attrs) {
  14.  
  15.                 super(context, attrs);
  16.  
  17.                 holder = getHolder();
  18.  
  19.                 holder.addCallback(this);
  20.  
  21.                 holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  22.  
  23.                 recorder = new MediaRecorder();
  24.  
  25.                 recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
  26.  
  27.                 recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
  28.  
  29.                 recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
  30.  
  31.                 recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
  32.  
  33.                 recorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
  34.  
  35.                 // recorder.setVideoSize(480, 320);
  36.  
  37.                 // recorder.setVideoFrameRate(15);
  38.  
  39.                 // recorder.setMaxDuration(10000);
  40.  
  41.         }
  42.  
  43.  
  44.  
  45.         @Override
  46.  
  47.         public void surfaceChanged(SurfaceHolder holder, int format, int width,
  48.  
  49.                         int height) {
  50.  
  51.         }
  52.  
  53.  
  54.  
  55.         @Override
  56.  
  57.         public void surfaceCreated(SurfaceHolder holder) {
  58.  
  59.                 recorder.setOutputFile("/sdcard/test.mp4");
  60.  
  61.                 recorder.setPreviewDisplay(holder.getSurface());
  62.  
  63.                 if (recorder != null) {
  64.  
  65.                         try {
  66.  
  67.                                 recorder.prepare();
  68.  
  69.                         } catch (IllegalStateException e) {
  70.  
  71.                                 Log.e("IllegalStateException", e.toString());
  72.  
  73.                         } catch (IOException e) {
  74.  
  75.                                 Log.e("IOException", e.toString());
  76.  
  77.                         }
  78.  
  79.                 }
  80.  
  81.         }
  82.  
  83.  
  84.  
  85.         @Override
  86.  
  87.         public void surfaceDestroyed(SurfaceHolder holder) {
  88.  
  89.         }
  90.  
  91.  
  92.  
  93.         public MediaRecorder getRecorder() {
  94.  
  95.                 return recorder;
  96.  
  97.         }
  98.  
  99.  
  100.  
  101. }
Parsed in 0.039 seconds, using GeSHi 1.0.8.4


CamcorderActivity.java:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class CamcorderActivity extends Activity {
  2.  
  3.         private CamcorderPreview camcorderPreview;
  4.  
  5.         private boolean recording = false;
  6.  
  7.  
  8.  
  9.         /** Called when the activity is first created. */
  10.  
  11.         @Override
  12.  
  13.         public void onCreate(Bundle savedInstanceState) {
  14.  
  15.                 super.onCreate(savedInstanceState);
  16.  
  17.                 requestWindowFeature(Window.FEATURE_NO_TITLE);
  18.  
  19.                 setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  20.  
  21.                 setContentView(R.layout.camcorder_preview);
  22.  
  23.  
  24.  
  25.                 camcorderPreview = (CamcorderPreview) findViewById(R.id.camcorder_preview);
  26.  
  27.  
  28.  
  29.                 camcorderPreview.setOnTouchListener(new OnTouchListener() {
  30.  
  31.                         @Override
  32.  
  33.                         public boolean onTouch(View view, MotionEvent event) {
  34.  
  35.                                 if (event.getAction() == MotionEvent.ACTION_DOWN) {
  36.  
  37.                                         if (recording) {
  38.  
  39.                                                 camcorderPreview.getRecorder().stop();
  40.  
  41.                                                 camcorderPreview.getRecorder().release();
  42.  
  43.                                                 finish();
  44.  
  45.                                         } else {
  46.  
  47.                                                 recording = true;
  48.  
  49.                                                 camcorderPreview.getRecorder().start();
  50.  
  51.                                         }
  52.  
  53.                                         return true;
  54.  
  55.                                 }
  56.  
  57.                                 return false;
  58.  
  59.                         }
  60.  
  61.                 });
  62.  
  63.         }
  64.  
  65. }
Parsed in 0.038 seconds, using GeSHi 1.0.8.4


camcorder_preview.xml:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2.  
  3. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  4.  
  5.         android:orientation="vertical" android:layout_width="fill_parent"
  6.  
  7.         android:layout_height="fill_parent">
  8.  
  9.         <CamcorderPreview android:id="@+id/camcorder_preview"
  10.  
  11.                 android:layout_width="fill_parent" android:layout_height="fill_parent"
  12.  
  13.                 android:enabled="false" android:focusable="true" android:clickable="true" />
  14.  
  15. </LinearLayout>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


You tap the screen once to start recording and again to stop. Not the best system as this is just my first pass at it, but it works fine. The file is saved on the SD card as test.mp4.
Jonpro
Freshman
Freshman
 
Posts: 6
Joined: Thu Jul 23, 2009 8:29 pm

Runtime error: canot find the CamcorderPreview class

Postby sduvur » Fri Aug 21, 2009 8:14 pm

The sample compiled okay. But I am seeing a runtime error:

E/AndroidRuntime( 7264): Caused by: java.lang.ClassNotFoundException: android.view.CamcorderPreview in loader dalvik.system.PathClassLoader@430c6578

While Android platform allows developer to override a basic View like SurfaceView and use it, do I have to do something to tell it where to find it? Since it is in my application I expected that it would be found automatically.

Any suggestions to fix this?
sduvur
Freshman
Freshman
 
Posts: 2
Joined: Fri Aug 21, 2009 8:07 pm

Postby Jonpro » Fri Aug 21, 2009 8:21 pm

I probably should have mentioned this in my original post. In the xml file, you need to edit the line that starts like this:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <CamcorderPreview android:id="@+id/camcorder_preview"
Parsed in 0.000 seconds, using GeSHi 1.0.8.4

You need to specify the full package hierarchy for Camcorder Preview so it looks something like this:
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <com.example.android.CamcorderPreview android:id="@+id/camcorder_preview"
Parsed in 0.000 seconds, using GeSHi 1.0.8.4

Hope this helps!
Jonpro
Freshman
Freshman
 
Posts: 6
Joined: Thu Jul 23, 2009 8:29 pm

Top

yes, fully qualified name was needed

Postby sduvur » Fri Aug 21, 2009 9:08 pm

Yup, that did it. I also realized there was no way for Android to figure this out by itself, without a complete name.

BTW, eclipse UI editor seems to not do much even if full path to the extended SurfaceView class is provided!
I guess that is a bug they will eventually fix.

Thanks for your prompt help!
sduvur
Freshman
Freshman
 
Posts: 2
Joined: Fri Aug 21, 2009 8:07 pm

Postby manemannen » Tue Sep 01, 2009 9:43 am

Jonpro, I followed your example to the point but end up with some problems when trying to create the save file. So, the prepare method fails.

Tried both on the emulator with a mounted sdcard and on a ADP1.

E/MediaRecorder( 788): prepare failed: -2147483648
E/IOException( 788): java.io.IOException: prepare failed.

Listing the sdcard I get:

# ls -l /sdcard
----rw-rw- system system 0 2009-09-01 10:40 test.mp4

so the file is created but prepare fails anyway...

any ideas?
manemannen
Freshman
Freshman
 
Posts: 4
Joined: Tue Sep 01, 2009 9:33 am

Postby Arthur » Thu Oct 01, 2009 12:10 am

Thanks to the CamcorderPreview example that JonPro posted I have managed to record video, but I have to comment out the following lines:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
Parsed in 0.035 seconds, using GeSHi 1.0.8.4

and
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


If I don't I get a Runtime exception of
Code: Select all
java.lang.RuntimeException: setAudioSource failed.
. This is on the HTC Magic Android phone. After commenting out these lines I can record video, but there is no audio.

Is anyone else experiencing trouble recording audio? I can't find any audio or microphone permission settings (are there any?). I've also tried changing MediaRecorder.AudioSource.MIC to MediaRecorder.AudioSource.DEFAULT but that didn't make any difference.
Arthur
Freshman
Freshman
 
Posts: 3
Joined: Thu Oct 01, 2009 12:01 am
Location: UK

Postby Arthur » Thu Oct 01, 2009 12:21 am

Still no audio on the video, but at least no exceptions are being thrown. I did need to add the following permission:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <uses-permission android:name="android.permission.RECORD_AUDIO"></uses-permission>
Parsed in 0.000 seconds, using GeSHi 1.0.8.4
Arthur
Freshman
Freshman
 
Posts: 3
Joined: Thu Oct 01, 2009 12:01 am
Location: UK

Postby Arthur » Thu Oct 01, 2009 12:31 am

Sorry for all of these posts. Now its all working!

Audio was coming through due to the media player I was using. Seems Totem and VLC fail to play the audio but MPlayer manages it.
Arthur
Freshman
Freshman
 
Posts: 3
Joined: Thu Oct 01, 2009 12:01 am
Location: UK

Postby wrvishnu » Wed Nov 25, 2009 5:01 pm

I have used the above sample when i run the application in emulator i am getting the below mentioned error

Erorr
the application camera record (process org.cam.demo) has stopped unexpeccedly) please try again

Below are the code infomration , it would be gr8 if some one could help to fix this issue , i am totally new to android and java development.
CamcorderActivity.java
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. package Org.cam.Demo;
  3.  
  4.  
  5.  
  6. import android.app.Activity;
  7.  
  8. import android.content.pm.ActivityInfo;
  9.  
  10. import android.os.Bundle;
  11.  
  12. import android.view.MotionEvent;
  13.  
  14. import android.view.View;
  15.  
  16. import android.view.Window;
  17.  
  18. import android.view.View.OnTouchListener;
  19.  
  20.  
  21.  
  22. public class CamcorderActivity extends Activity {
  23.  
  24.      private CamcorderPreview camcorderPreview;
  25.  
  26.      private boolean recording = false;
  27.  
  28.  
  29.  
  30.      /** Called when the activity is first created. */
  31.  
  32.      
  33.  
  34.      public void onCreate(Bundle savedInstanceState) {
  35.  
  36.           super.onCreate(savedInstanceState);
  37.  
  38.           requestWindowFeature(Window.FEATURE_NO_TITLE);
  39.  
  40.           setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  41.  
  42.           setContentView(R.layout.main);
  43.  
  44.  
  45.  
  46.           camcorderPreview = (CamcorderPreview) findViewById(R.id.camcorder_preview);
  47.  
  48.  
  49.  
  50.           camcorderPreview.setOnTouchListener(new OnTouchListener() {
  51.  
  52.              
  53.  
  54.                public boolean onTouch(View view, MotionEvent event) {
  55.  
  56.                     if (event.getAction() == MotionEvent.ACTION_DOWN) {
  57.  
  58.                          if (recording) {
  59.  
  60.                               camcorderPreview.getRecorder().stop();
  61.  
  62.                               camcorderPreview.getRecorder().release();
  63.  
  64.                               finish();
  65.  
  66.                          } else {
  67.  
  68.                               recording = true;
  69.  
  70.                               camcorderPreview.getRecorder().start();
  71.  
  72.                          }
  73.  
  74.                          return true;
  75.  
  76.                     }
  77.  
  78.                     return false;
  79.  
  80.                }
  81.  
  82.           });
  83.  
  84.      }
  85.  
  86. }
  87.  
  88.  
Parsed in 0.042 seconds, using GeSHi 1.0.8.4


CamcorderPreview.java
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. package Org.cam.Demo;
  3.  
  4.  
  5.  
  6. import java.io.IOException;
  7.  
  8.  
  9.  
  10. import android.content.Context;
  11.  
  12. import android.media.MediaRecorder;
  13.  
  14. import android.util.AttributeSet;
  15.  
  16. import android.util.Log;
  17.  
  18. import android.view.SurfaceHolder;
  19.  
  20. import android.view.SurfaceView;
  21.  
  22.  
  23.  
  24. public class CamcorderPreview extends SurfaceView implements
  25.  
  26.           SurfaceHolder.Callback {
  27.  
  28.  
  29.  
  30.      MediaRecorder recorder;
  31.  
  32.      SurfaceHolder holder;
  33.  
  34.  
  35.  
  36.      public CamcorderPreview(Context context, AttributeSet attrs) {
  37.  
  38.           super(context, attrs);
  39.  
  40.           holder = getHolder();
  41.  
  42.           holder.addCallback(this);
  43.  
  44.           holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
  45.  
  46.           recorder = new MediaRecorder();
  47.  
  48.           recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
  49.  
  50.           recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
  51.  
  52.           recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
  53.  
  54.           recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
  55.  
  56.           recorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
  57.  
  58.           // recorder.setVideoSize(480, 320);
  59.  
  60.           // recorder.setVideoFrameRate(15);
  61.  
  62.           // recorder.setMaxDuration(10000);
  63.  
  64.      }
  65.  
  66.  
  67.  
  68.      @Override
  69.  
  70.      public void surfaceChanged(SurfaceHolder holder, int format, int width,
  71.  
  72.                int height) {
  73.  
  74.      }
  75.  
  76.  
  77.  
  78.      @Override
  79.  
  80.      public void surfaceCreated(SurfaceHolder holder) {
  81.  
  82.           recorder.setOutputFile("/sdcard/test.mp4");
  83.  
  84.           recorder.setPreviewDisplay(holder.getSurface());
  85.  
  86.           if (recorder != null) {
  87.  
  88.                try {
  89.  
  90.                     recorder.prepare();
  91.  
  92.                } catch (IllegalStateException e) {
  93.  
  94.                     Log.e("IllegalStateException", e.toString());
  95.  
  96.                } catch (IOException e) {
  97.  
  98.                     Log.e("IOException", e.toString());
  99.  
  100.                }
  101.  
  102.           }
  103.  
  104.      }
  105.  
  106.  
  107.  
  108.      @Override
  109.  
  110.      public void surfaceDestroyed(SurfaceHolder holder) {
  111.  
  112.      }
  113.  
  114.  
  115.  
  116.      public MediaRecorder getRecorder() {
  117.  
  118.           return recorder;
  119.  
  120.      }
  121.  
  122.  
  123.  
  124. }
  125.  
  126.  
Parsed in 0.044 seconds, using GeSHi 1.0.8.4


main.xml
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3.  
  4. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  5.  
  6. android:orientation="vertical"
  7.  
  8. android:layout_width="fill_parent"
  9.  
  10. android:layout_height="fill_parent"
  11.  
  12. >
  13.  
  14. <Button android:id="@+id/startPlayerBtn"
  15.  
  16. android:layout_width="fill_parent"
  17.  
  18. android:layout_height="wrap_content"
  19.  
  20. android:text="Start Playing Audio"
  21.  
  22. />
  23.  
  24. <Button android:id="@+id/restartPlayerBtn"
  25.  
  26. android:layout_width="fill_parent"
  27.  
  28. android:layout_height="wrap_content"
  29.  
  30. android:text="Restart Player"
  31.  
  32. />
  33.  
  34. <Button android:id="@+id/pausePlayerBtn"
  35.  
  36. android:layout_width="fill_parent"
  37.  
  38. android:layout_height="wrap_content"
  39.  
  40. android:text="Pause Player"
  41.  
  42. />
  43.  
  44. </LinearLayout>
  45.  
  46.  
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


AndroidManifest.xml
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3.  
  4. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  5.  
  6.      package="Org.cam.Demo"
  7.  
  8.      android:versionCode="1"
  9.  
  10.      android:versionName="1.0">
  11.  
  12.     <application android:icon="@drawable/icon" android:label="@string/app_name">
  13.  
  14.         <activity android:name="CamcorderActivity"
  15.  
  16.                  android:label="@string/app_name">
  17.  
  18.             <intent-filter>
  19.  
  20.                 <action android:name="android.intent.action.MAIN" />
  21.  
  22.                 <category android:name="android.intent.category.LAUNCHER" />
  23.  
  24.             </intent-filter>
  25.  
  26.         </activity>
  27.  
  28.  
  29.  
  30.     </application>
  31.  
  32.     <uses-permission android:name="android.permission.CAMERA"></uses-permission>
  33.  
  34.     <uses-sdk android:minSdkVersion="5" />
  35.  
  36.  
  37.  
  38. </manifest>
  39.  
  40.  
Parsed in 0.004 seconds, using GeSHi 1.0.8.4
wrvishnu
Freshman
Freshman
 
Posts: 5
Joined: Tue Nov 24, 2009 1:13 pm

Postby wrvishnu » Wed Nov 25, 2009 5:03 pm

Am attaching the log file for the issue mentioned in previous reply
Attachments
log.txt
(5.83 KiB) Downloaded 143 times
wrvishnu
Freshman
Freshman
 
Posts: 5
Joined: Tue Nov 24, 2009 1:13 pm

Postby fidelio » Tue Jan 12, 2010 10:46 pm

wrvishnu wrote:Am attaching the log file for the issue mentioned in previous reply

Hi, i'm new to this forum and also to android development, although it really pick my interest. I wish to understand correctly if it is posible to record with the emulator, or are these codes above tested with the phone itself?
I'm trying to work on a project that has to do with capturing an event, storing it locally and uploading the file to a server through wlan.
Your explanation will be of great help.
fidelio
Freshman
Freshman
 
Posts: 3
Joined: Tue Jan 12, 2010 10:41 am
Location: Finland

Postby fidelio » Fri Feb 19, 2010 8:07 pm

Can any one help me out, the code in question could record only video, the sound is not coming out . I tride it with HTC.
Is it also posible to put buttons start and stop on the screen?

Arthur How did you solve the issue of the sound?

quick response to this two questions will be appricaited.
fidelio
Freshman
Freshman
 
Posts: 3
Joined: Tue Jan 12, 2010 10:41 am
Location: Finland

Top
Next

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 13 guests