video recording issue

by android_dev » Wed, 18 Nov 2009 01:33:02 GMT


Sponsored Links
 HI,
i am trying to record video and upload to web, i have given my best
effort but no luck, i am not sure if it is possible with android 1.6.
Please help me to figure out the solution. is it possible to do
that.its really urgent

--



video recording issue

by android_dev » Thu, 19 Nov 2009 08:42:12 GMT


 when i add video source and video encoder, it gives error in
recoreder.prepare() (prepare failed) while the same code is working
only for audio.
i am not finding what i am doing wrong.Please help

setContentView(R.layout.camera);
preview=(SurfaceView)findViewById(R.id.surface);
previewHolder=preview.getHolder();
previewHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
recorder = new MediaRecorder();
String url = "/sdcard/dcim/test.3gp";
camera = Camera.open();
Camera.Parameters parameters = camera.getParameters();
parameters.setPreviewSize(352, 288);
parameters.set("orientation", "portrait");
camera.setParameters(parameters);
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setOutputFile(url);
recorder.setVideoFrameRate(15);
recorder.setVideoSize(480, 320);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
recorder.prepare();
recorder.start();
Thread.sleep(100000);
recorder.stop();
recorder.release();

} catch (Exception e) {
e.getMessage();
}




--


Sponsored Links


video recording issue

by Greivin Lopez » Thu, 19 Nov 2009 22:38:58 GMT


 I think you don't have to open and set parameters for the camera when
recording video, at least it never work for me, try to remove this
code:
"camera = Camera.open();
Camera.Parameters parameters = camera.getParameters();
parameters.setPreviewSize(352, 288);
parameters.set("orientation", "portrait");
camera.setParameters(parameters);"

Also you need to be sure that you are setting the correct permissions
in the Manifest file, I suggest you these ones:

<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>

I see no other problems but as a matter of fact I was not able to use
the media recorder in a portrait layout... it just stay landscape. I
don't know if it was just me or what.

I hope you could fix your problem.

--



video recording issue

by WrVishnu » Sun, 29 Nov 2009 04:21:06 GMT


 Hi

Did u able to record a video in android emulator , could you please
help to share the code for recording the video

I am new to android development , from the snippet here i dont know
what package to import.

CAn u please send the source for the video record

BTW i am newbi to the android development

Thanks and Regards
Vish




--



Other Threads

1. Android pattern for waiting on event

What is the Android technique/pattern for effectively waiting on an
event in another thread?  Eg, waiting for an onClicked in a dialog?

(I'm sure someone's going to tell me "Don't do that!!", so let's skip
over that discussion entirely and instead discuss the ways of
synchronizing between threads, in particular (for starters, at least)
the main activity and dialogs.)

(Or, if "synchronizing" is the wrong concept, what is the right one?)

(PS:  The section on AlertDialogs in "Pro Android 2" appears to be
totally hosed -- I don't think the authors understood this concept
either.)

-- 

2. Two problems with SeekBars, one with ListViews, and one inside a PreferenceActivity

Hi,
I've identified a problem with a SeekBar being inside a ListView, and
a problem with a SeekBar being inside a Preference on Android 2.2. I'm
trying to figure out if I'm doing something wrong, or this is a
limitation/bug of Android.

The first problem with the ListView is that I am unable to use the
trackball/arrow keys to move the SeekBar when it is inside a ListView.
This seems to apply to all versions of Android 1.5-2.2. The following
simple example shows this:

public final class TestActivity extends ListActivity {

        public SeekBar makeSeekBar() {
                SeekBar s = new SeekBar(this);
                s.setMax(10);
                s.setKeyProgressIncrement(1);
                return s;
        }

        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                
                setListAdapter(new BaseAdapter() {

                        @Override
                        public int getCount() {
                                return 5;
                        }

                        @Override
                        public Object getItem(int position) {
                                return null;
                        }

                        @Override
                        public long getItemId(int position) {
                                return 0;
                        }

                        @Override
                        public View getView(int position, View convertView, 
ViewGroup parent) {
                                return makeSeekBar();
                        }
                });
        }
}

The previous example code creates a ListActivity with a simple
ListAdapter which displays 5 SeekBars. Each SeekBar seems to work
correctly when in touch mode, but I am unable to move the bar left of
right by using the arrow keys (in the emulator) or the trackball (on
my G1). If I instead make a Activity with a SeekBar in it, then the
arrow keys/track ball can easily move the SeekBar left and right. Is
this a limitation? or just an oversight? or am I missing something?


The second problem (with led me to the first problem), is I have a
custom Preference class called SeekBarPreference, which if you can't
guess displays a SeekBar on a PreferenceActivity. It doesn't display
the SeekBar in a popup dialog, but instead directly in the
PreferenceActivity[1]. This works great in touch mode, unless I use
Android 2.2. On Android 2.2 it seems every time I start to slide the
bar left or right, as soon as it moves one notch a onStopTrackingTouch
is received, and the bar no longer slides. So basically the SeekBar
will only move to where you click and no longer slides. Under Android
1.6-2.1 the slide behaviour worked fine!.

I did some debugging, and the call stack from the onStopTrackingTouch
is as follows:
        SeekBarPreference.onStopTrackingTouch(SeekBar) line: 110        
        SeekBar.onStopTrackingTouch() line: 115 
        SeekBar(AbsSeekBar).onTouchEvent(MotionEvent) line: 311 
        SeekBar(View).dispatchTouchEvent(MotionEvent) line: 3766        
        RelativeLayout(ViewGroup).dispatchTouchEvent(MotionEvent) line: 936     
        LinearLayout(ViewGroup).dispatchTouchEvent(MotionEvent) line: 936       
        LinearLayout(ViewGroup).dispatchDetachedFromWindow() line: 1148 
        ListView(ViewGroup).removeDetachedView(View, boolean) line: 2333        
        AbsListView.access$2700(AbsListView, View, boolean) line: 72    
        AbsListView$RecycleBin.addScrapView(View) line: 4068    
        ListView.layoutChildren() line: 1514    
        ListView(AbsListView).onLayout(boolean, int, int, int, int) line: 1147  
        ListView(View).layout(int, int, int, int) line: 7035    
        FrameLayout.onLayout(boolean, int, int, int, int) line: 333     
        FrameLayout(View).layout(int, int, int, int) line: 7035 
        PhoneWindow$DecorView(FrameLayout).onLayout(boolean, int, int, int,
int) line: 333
        PhoneWindow$DecorView(View).layout(int, int, int, int) line: 7035       
        ViewRoot.performTraversals() line: 1045 
        ViewRoot.handleMessage(Message) line: 1727      
        ViewRoot(Handler).dispatchMessage(Message) line: 99     

SeekBar in it (inside removeDetachedView) which calls
dispatchDetachedFromWindow and fires a MotionEvent.ACTION_CANCEL
event, causing the Tracking to stop.

I have not been able to figure out why the ListView is detaching the
SeekBar's view, and this does not seem to happen in my simple ListView
case. I will continue to debug the problem and generate a simple test
case others can use, but I thought I better ask.

thanks for any help on either problems
Andrew

[1] Shameless plug, but if anyone wants to see the SeekBarPreference
in action, download my new app "MusicGrid" and view the settings. As I
say the problem only appears on 2.2 phones.

-- 

3. Should Plurals and Quantity Strings be used?

4. TextView resets its location after an animation

5. How to access internal storage on htc incredible

6. Screen rotation and ProgressDialog

7. 绛斿: Android Linux kernel