Android Apps | Techbirds | Page 2

Steps to record video are

mCamera = mPreview.getCamera(); //get Camera Intance mRecorder = new MediaRecorder(); //step1 mCamera.unlock(); mRecorder.setCamera(mCamera); //step2 mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); //step 3 //mRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH)); mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); mRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT); //step4 mRecorder.setOutputFile(getOutputFile(MEDIA_TYPE_VIDEO).toString()); //step 5 mRecorder.setPreviewDisplay(mPreview.getMyHolder().getSurface()); try { //step 6 mRecorder.prepare(); Thread.sleep(1000); mRecorder.start(); Toast.makeText(CameraPreview.this, “Recording Started”, Toast.LENGTH_LONG); } catch (Exception e) { releaseRecorder(); Toast.makeText(CameraPreview.this, “Recording error couldn’t start”, Toast.LENGTH_LONG); }

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

mCamera = mPreview.getCamera(); //get Camera Intance

mRecorder = new MediaRecorder();

//step1

mCamera.unlock();

mRecorder.setCamera(mCamera);

                //step2

mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);

mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);

                //step 3

//mRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));

mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);

mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

mRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);

                //step4

mRecorder.setOutputFile(getOutputFile(MEDIA_TYPE_VIDEO).toString());

                //step 5

mRecorder.setPreviewDisplay(mPreview.getMyHolder().getSurface());

try {

        //step 6

    mRecorder.prepare();

    Thread.sleep(1000);

    mRecorder.start();

    Toast.makeText(CameraPreview.this, “Recording Started”, Toast.LENGTH_LONG);

} catch (Exception e) {

    releaseRecorder();

    Toast.makeText(CameraPreview.this, “Recording error couldn’t start”, Toast.LENGTH_LONG);

}

  683 total views, no views today

683 total views, no views today

There are two ways to get the instance of current visible item in view Pager. 1. First way is: Step1: get the position of viewpager using int item = mViewpager.getCurrentItem(); Step2: find the tag of fragment using item which you added at the time of fragment add or replace String tag = “”; if(item ==

Read More →

12,317 total views, 1 views today

Below is the code for recording a voice through mic and saving it in sdcard :   //Code for saving recording private void startRecording(){ mRecorder = new MediaRecorder(); File sampleDir = Environment.getExternalStorageDirectory(); try { audiofile = File.createTempFile(“sound”, “.3gp”, sampleDir); } catch (Exception e) { // TODO: handle exception Log.e(“Path Error”, “Error in making directory”); }

Read More →

916 total views, no views today

As everyone knows that every person has different voice. It all because of different frequency rate of different people. So we can change voice by changing frequency rate. In android to change frequency we use “Soundpool“.   The SoundPool class manages and plays audio resources for applications. A SoundPool is a collection of samples that

Read More →

2,680 total views, 2 views today

Hi, As we all knows Nokia has launched its first Android phone NokiaX.The apps having google map,google in app billing and GCM push notification will not run on NokiaX as NokiaX does not support “Google play services”. So developers need to setup environment for the development of nokiaX apps.Following are the steps: Environment SetUp 1.download

Read More →

893 total views, no views today