in Education by
Hi does anybody knows how to record video in android and for example above the recording screen at the bottom show current time and date JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Here is code that record video in surface view and store in sdcard and for date and time by This package com.po; import java.io.IOException; import android.app.Activity; import android.content.Intent; import android.content.pm.ActivityInfo; import android.media.CamcorderProfile; import android.media.MediaRecorder; import android.os.Bundle; import android.util.Log; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.view.WindowManager; import android.widget.Button; public class VideoRD extends Activity implements OnClickListener, SurfaceHolder.Callback { MediaRecorder recorder; SurfaceHolder holder; boolean recording = false; public static final String TAG = "VIDEOCAPTURE"; String str_getValue ; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); Intent i1 = getIntent(); str_getValue = i1.getStringExtra("videoImagename"); recorder = new MediaRecorder(); initRecorder(); setContentView(R.layout.surface); SurfaceView cameraView = (SurfaceView) findViewById(R.id.CameraView); holder = cameraView.getHolder(); holder.addCallback(this); holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); cameraView.setClickable(true); cameraView.setOnClickListener(this); final Button button = (Button) findViewById(R.id.button1); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click if (recording) { try { recorder.stop(); recorder.release(); recording = false; Log.v(TAG, "Recording Stopped"); initRecorder(); prepareRecorder(); } catch (Exception e) { // TODO: handle exception } } else { try { recording = true; recorder.start(); button.setText("stop"); } catch (Exception e) { // TODO: handle exception } } } }); } private void initRecorder() { try { recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT); // recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); CamcorderProfile cpHigh = CamcorderProfile .get(CamcorderProfile.QUALITY_HIGH); recorder.setProfile(cpHigh); recorder.setOutputFile("/sdcard/audiometer/video/"+str_getValue+""); recorder.setMaxDuration(1200000000); // 50 seconds recorder.setMaxFileSize(22000000); // Approximately 5 megabytes } catch (Exception e) { // TODO: handle exception } } private void prepareRecorder() { try { recorder.setPreviewDisplay(holder.getSurface()); try { recorder.prepare(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (IllegalStateException e) { e.printStackTrace(); } catch (Exception e) { // TODO: handle exception } } public void onClick(View v) { /* * if (recording) { recorder.stop(); recorder.release(); recording = * false; Log.v(TAG, "Recording Stopped"); initRecorder(); * prepareRecorder(); } else { recording = true; recorder.start(); } */ } public void surfaceCreated(SurfaceHolder holder) { prepareRecorder(); } public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } public void surfaceDestroyed(SurfaceHolder holder) { finish(); } }

Related questions

0 votes
    __________ provides a snapshot of threats over time, encouraging the maintenance of up-to-date ... monitoring Threat analysis Vulnerability Scanning Endpoint activity monitoring...
asked Oct 25, 2020 in Technology by JackTerrance
0 votes
    Which of the following systems record changes to a file over time? (a) Record Control (b) Version ... questions and answers pdf, Data Science interview questions for beginners...
asked Oct 29, 2021 in Education by JackTerrance
0 votes
    There are record-once versions of the compact disk and digital video disk, which can be written only once ... Media in portion Storage and File Structures of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    I am adding new record in grid like below var newRow = Ext.create(gridModel); rowEditPlugin.cancelEdit(); ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 12, 2022 in Education by JackTerrance
0 votes
    When using a UISplitViewController in portrait mode on an iPad I am given a fullscreen view of my detail ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 1, 2022 in Education by JackTerrance
0 votes
    For a first order reaction, show that the time required for 99% completion is twice the time required for the ... 90% of reaction. Select the correct answer from above options...
asked Jan 4, 2022 in Education by JackTerrance
0 votes
    I have a table in which data is been logged in 'yy/MM/dd HH:mm:ss' format and my regional ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 8, 2022 in Education by JackTerrance
0 votes
    Im trying to insert the current date and a specific time into a table this is my query INSERT INTO ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    Im trying to insert the current date and a specific time into a table this is my query INSERT INTO ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    Which of the following contains both date and time? (a) java.io.date (b) java.sql.date (c) java.util.date ... Beans & JDBC of Java Select the correct answer from above options...
asked Feb 22, 2022 in Education by JackTerrance
0 votes
    4. Date and Time are supported as Data Type in Calc. 5. When using functions and formulas in LibreOffice Calo, it ... and send me fast Select the correct answer from above options...
asked Dec 17, 2021 in Education by JackTerrance
0 votes
    Which of the following contains both date and time? (a) java.io.date (b) java.sql.date (c) java ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    What will be the syntax to find current date and time in format "YYYY-MM-DD"?...
asked Dec 18, 2020 in Technology by JackTerrance
0 votes
    How do you find current date and time in Oracle?...
asked Dec 18, 2020 in Technology by JackTerrance
...