Hi,
I had implemented these three line of code in my project.
All these effects we can saw on sd card not in real time.
I want all these effects during video recording.Having code for easily uderstable for you.
So please again give me your help.
1//
2VideoTestActivity.java
3
4package com.videoTest;
5
6import java.io.File;
7
8import android.app.Activity;
9import android.content.Intent;
10import android.hardware.Camera;
11import android.net.Uri;
12import android.os.Bundle;
13import android.os.Environment;
14import android.provider.MediaStore;
15import android.view.View;
16import android.widget.Button;
17import android.widget.TextView;
18
19public class VideoTestActivity extends Activity {
20
21 private static final int REQUEST_VIDEO = 100;
22
23 Button captureButton;
24
25 TextView text;
26 File destination;
27 Camera camera;
28
29 @Override
30 public void onCreate(Bundle savedInstanceState) {
31 super.onCreate(savedInstanceState);
32 setContentView(R.layout.main);
33
34 captureButton = (Button)findViewById(R.id.capture);
35 captureButton.setOnClickListener(listener);
36
37 captureButton = (Button)findViewById(R.id.capture);
38 captureButton.setOnClickListener(listener);
39 text = (TextView)findViewById(R.id.file);
40
41
42
43 destination = new File(Environment.getExternalStorageDirectory(),"myVideo");
44 }
45
46 @Override
47 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
48 if(requestCode == REQUEST_VIDEO && resultCode == Activity.RESULT_OK) {
49 String location = data.getData().toString();
50 text.setText(location);
51 }
52 }
53
54 private View.OnClickListener listener = new View.OnClickListener() {
55 @Override
56 public void onClick(View v) {
57 /*Camera.Parameters parameters = camera.getParameters();
58 parameters.setColorEffect(Camera.Parameters.EFFECT_NEGATIVE);
59 camera.setParameters(parameters);*/
60 Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
61
62 intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(destination));
63 intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
64
65 // intent.filterHashCode();
66 startActivityForResult(intent, REQUEST_VIDEO);
67 intent.setType("*/*");
68 intent.setType("image/*");
69 intent.setType("video/*");
70 }
71 };
72}
73///
74main.xml
75<?xml version="1.0" encoding="utf-8"?>
76<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
77 android:orientation="vertical"
78 android:layout_width="fill_parent"
79 android:layout_height="fill_parent">
80 <Button
81 android:id="@+id/capture"
82 android:layout_width="fill_parent"
83 android:layout_height="wrap_content"
84 android:text="Take a Video"
85 />
86 <Button
87 android:id="@+id/Effects"
88 android:layout_width="fill_parent"
89 android:layout_height="wrap_content"
90 android:text="Effects"
91 android:visibility="gone"
92 />
93 <TextView
94 android:id="@+id/file"
95 android:layout_width="fill_parent"
96 android:layout_height="fill_parent"
97 />
98</LinearLayout>
Thanks,
— modified on May 10, 2012, 7:52:58 AM
Recommended editorial content
With your consent, external content is loaded here.
By clicking on the button above, you agree that external content may be displayed to you. Personal data may be transmitted to third-party providers in the process. You can find more information about this in our Privacy Policy.