Android :: Android: How To Initialize MediaRecorder Without A Valid Surface For Video Preview

Aug 9, 2009

I am building a camera app, where videos are continuously being captured and saved to the SD card. The videos are short (few minutes), and their length are preset with setMaxDuration().

The whole process works fine, while the main activity is in the foreground. But, when I go to another activity (e.g. settings), the video recording works in the background only until max duration is reached. The file is saved, but a new sequence can not be started
because prepare() fails, apparently because setPreviewDisplay() doesn't like not having a proper surface to attach to.

I tried to use a dummy Surface, a dummy SurfaceHolder, lockCanvas(), and various other tricks, but nothing works. Is there a way to initialize MediaRecorder without a valid surface?

Android :: Android: How to initialize MediaRecorder without a valid surface for video preview


Android :: MediaRecorder API : Preview Not Happening And Audio Sounds Muffled / Set It Up?

Aug 20, 2009

I am not able to see video preview. Here is is how I set up the MediaCorder, before I fire it up code...

View 2 Replies View Related

Android :: OpenGL On Top Of Camera Preview - Using Two Surface Views

Jul 19, 2009

I have openGL layered on top of camera view by using the 'workaround' specified at-http://groups.google.com/group/android-beginners/browse_thread/thread... and it works great.

However, has been mentioned before that surfaceviews were not designed to be layered ontop of each other- [url]

As you can notice in the code snippet thats mentioned in the first thread, to get openGL working on top of camera we are first setting the contentView to be the openGL view and then adding the camera (on top of it) instead of the other way around as one would expect it. I am assuming there's something strange going on in here as it has also been mentioned that Z-order is not supported on surface views- [url]

Now my question is will all devices have this behavior? Can I use this behavior in my app to get openGL layered on top of camera preview? Please answer this query, its so cool to have openGL over the camera preview! It opens up for some amazing stuff!

View 2 Replies View Related

Android :: Scaling - Animating Camera Preview Surface

Sep 20, 2010

I am using android.hardware.Camera to get a preview and display it on a custom SurfaceView that implements SurfaceHolder.Callback.

I am trying to zoom in to the camera preview surface by a specified scale (not using the camera's digital zoom) but I can't seem to find a correct way to do it. I also need to be able to zoom out and scale down the preview.

I was hoping to be able to do this using a ScaleAnimation but it doesn't seem to work on SurfaceView, nor the FrameLayout containing the SurfaceView.

I also tried setting the size of the SurfaceView using setLayoutParams but that doesn't seem to work too well on various hardware and it would be tough to animate smoothly.

How to achieve this effect? Right now I am starting to think I might have to implement this using GLSurfaceView but I'm very unsure.

View 2 Replies View Related

Android :: Overlay Images Onto Camera Preview Surface View

Aug 23, 2010

I have a SurfaceView that is being used to draw custom animations and I would like to overlay them onto a live-feed from the phone's camera. Currently, the SurfaceView that contains the animations has a white- background, but if I were to overlay them onto the phone's camera feed, they would have to be transparent. The camera and animation drawing cannot be done on the same SurfaceView. Is it possible to make a SurfaceView transparent? What is the best course to pursue the use of multiple views? My end goal is to essentially overlay the contents of another SurfaceView onto the Camera SurfaceView.

View 2 Replies View Related

Android :: Surface View Draw Images Overlay On Camera Preview

Aug 23, 2010

I have a SurfaceView that is being used to draw images, and I would like to overlay them onto a live-feed from the phone's camera. Currently, the SurfaceView that contains the images have a white-background, but if I were to overlay them onto the phone's camera feed, they would have to be transparent. The camera and animation drawing cannot be done on the same SurfaceView. What is the best course to pursue the use of multiple views that involve managing the camera and drawing images? Is it possible to make a SurfaceView transparent?

View 4 Replies View Related

Android :: Video With MediaRecorder

May 6, 2009

Does anyone know how to use the MediaRecorder to API to capture video?

I am writing an application where I want to be able to capture video. I am trying to use the MediaRecorder API in 1.5, which is supposed to support video capture. However, there are no examples in the documentation on how to use this API for video (only for audio, and that works perfect). Basically what I do is the following:

CODE:...............

This gives me the following error: E/CameraInput( 37): No surface is available for display E/MediaRecorder( 7609): prepare failed: -2147483648

OK, so I have to have a surface to preview the video? Could be useful I guess, but not something I really need.

Could I use the VideoView widget for this, or is that only for playback?

Or am I supposed to use a SurfaceView to preview the video? I saw someone use that to capture images, but they used android.hardware.Camera to open the camera and capture a frame, and did not use MediaRecorder.

HOw to capture video, or even better have some example code?

View 1 Replies View Related

Android :: How To Get The Video Stream From MediaRecorder

Jul 10, 2009

I want to get the stream and send it to server directly by using MediaRecorder.

Actually, I am able to record the video,and able to store it into sdcard. Now I want to it to stream (live stream) to server rather than storing it.

View 5 Replies View Related

Android :: MediaRecorder Buffers 1 Second Of Video

Aug 30, 2010

I'm using MediaRecorder.setOutputFile(FileDescriptor fd) over a UNIX socket, so that local code on the device can see the encoded stream in real time (for video streaming out).

What I observed is that the encoder doesn't write encoded frames continuously, when they are produced, but by "bursts", exactly one second apart. I tried both containers (THREE_GPP and MPEG_4) and all three available codecs (MPEG_4_SP, H263, H264), the behavior is always the same. This one-second period is notably unrelated to framerate or bitrate, so it is not flushing by size; rather, it seems to be flushing by time (possibly to mask SD card write overheads ? Bummer, I 'm not using the SD here !). Is it a known limitation ? Is there a known workaround ?

View 2 Replies View Related

Android :: PV MediaRecorder Native Video Recording Error

Aug 7, 2010

Dear PV engineer: I have try several days for this. We want to add video conference function in PV opencore, so we need to create video capture node in native mode, I try the following code to capture video, My code is like this:

CODE:......................

View 2 Replies View Related

Android :: How To Use MediaRecorder To Record Highest Quality Video

Jan 28, 2010

Is there a way to get the best quality of video recording possible using MediaRecorder? the camcorder app does a lot better in terms of quality.

View 5 Replies View Related

Android :: How To Change Video Orientation In MediaRecorder To Portrait

Oct 10, 2010

When I record video by MediaRecorder, it always records in landscape mode, regardless of real device orientation. How to force MediaRecorder/Camera use real orientation ?

View 1 Replies View Related

Android :: MediaRecorder Class To Record A Video - Exception

Jun 17, 2010

I try to use the MediaRecorder class to record a video but I get an exception : failed to get Camera parameters. Prepare failed.

Here's my code :

CODE:.....................

View 1 Replies View Related

Android :: How To Use MediaRecorder To Record Video Without Causing A Segmentation Fault

Nov 30, 2009

I'm trying to use android.media.MediaRecorder to record video, and no matter what I do the android runtime segmentation faults when I call prepare().

Here's an example:

CODE:....................

View 2 Replies View Related

Droid :: How To Create Blur Surface From Android.view.Surface?

Jan 22, 2009

How do I create blur surface from android.view.Surface?

View 2 Replies View Related

General :: Record Video Via MediaRecorder?

Apr 12, 2012

I have a question regarding the Android MediaRecorder -

My test device
HTC Desire HD
Firmware 2.3.5

I want to write an app, which records a video. This should be implementet via the MediaRecorder (not via Intents). On the Google-Developers site I found a "tutorial" [URL]

My problem:

I followed the whole tutorial. When I'm starting my application on my test device it throws an exception ("start failed") at recorder.start() if I set the quality to high (CamcorderProfile.QUALITY_HIGH). If I change the setting to QUALITY_LOW the app starts recording for 1-2 seconds. After that the screen freezes and my LogCat tracks the following errors:

media server died!
camera server died
ICamera died

I also get ERROR 100

View 2 Replies View Related

Android :: 1.5 Video API Not Working / No Preview

Jun 22, 2009

I have tried 1.5 video API. I could not make it work. It even can't do preview. Following is my code:
private boolean initializeVideo() { Log.v(TAG, "initializeVideo");
if(Common.mRecordedVideo!=null && Common.mRecordedVideo.exists ()) Common.mRecordedVideo.delete();
File sDir = Environment.getExternalStorageDirectory();
String baseDir = sDir + Common.BASE_DIR;
File sampleDir=new File(baseDir);
if(!sampleDir.canWrite()) // Workaround for broken sdcard support on the device.
sampleDir = new File("/sdcard/sdcard");
try { Common.mRecordedVideo = File.createTempFile(PREFIX, EXTENSION, sampleDir);
} catch(IOException e) { AlertDialog.Builder ab = new AlertDialog.Builder (VideoRecord.this);
ab.setTitle("Error"); ab.setMessage(" can't write audio data to storage");
ab.setIcon(R.drawable.error); ab.setNeutralButton("Close", new DialogInterface.OnClickListener()
{ public void onClick(DialogInterface dialog, int whichButton) { } } );
ab.show(); return false;
} Intent intent = getIntent(); releaseMediaRecorder();
if (mSurfaceHolder == null) { Log.v(TAG, "SurfaceHolder is null");
return false; } mMediaRecorder = new MediaRecorder();
mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mMediaRecorder.setVideoSource (MediaRecorder.VideoSource.CAMERA);
mMediaRecorder.setOutputFormat (MediaRecorder.OutputFormat.THREE_GPP);
mMediaRecorder.setMaxDuration(MAX_RECORDING_DURATION_MS);
mMediaRecorder.setOutputFile (Common.mRecordedVideo.getAbsolutePath());
// Use the same frame rate for both, since internally
// if the frame rate is too large, it can cause camera to become
// unstable. We need to fix the MediaRecorder to disable the support
// of setting frame rate for now.
mMediaRecorder.setVideoFrameRate(20);
mMediaRecorder.setVideoSize(352,288);
mMediaRecorder.setVideoEncoder (MediaRecorder.VideoEncoder.H263);
mMediaRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
try { mMediaRecorder.prepare();
} catch (IOException exception) { Log.e(TAG, "prepare failed for " );
releaseMediaRecorder(); // TODO: add more exception handling logic here
return false; } mMediaRecorderRecording = false;
return true; } private void startVideoRecording() {
Log.v(TAG, "startVideoRecording"); if (!mMediaRecorderRecording) {
// Check mMediaRecorder to see whether it is initialized or not.
if (mMediaRecorder == null && initializeVideo() == false ) {
Log.e(TAG, "Initialize video (MediaRecorder) failed."); return;
} try { mMediaRecorder.setOnErrorListener(this);
mMediaRecorder.setOnInfoListener(this);
mMediaRecorder.start();
// Recording is now started } catch (RuntimeException e) {
Log.e(TAG, "Could not start media recorder. ", e); return;
} mMediaRecorderRecording = true;
mRecordingStartTime = SystemClock.uptimeMillis();
updateRecordingIndicator(true);
mRecordingTimeView.setText("");
mRecordingTimeView.setVisibility(View.VISIBLE);
mHandler.sendEmptyMessage(UPDATE_RECORD_TIME);
setScreenTimeoutInfinite();
} }

View 2 Replies View Related

Android :: Video Capture With Preview Available?

Aug 20, 2009

Can anyone share or point me to working example of "video capture" with preview?

View 2 Replies View Related

Android :: Restart Video Preview After The SurfaceDestroyed()?

Jul 2, 2009

I have created a CapturePreview class and CameraManager class the following way:

CapturePreview:

CODE:...

The video preview works fine this way until the sub-activity starts in the main activity. When sub-activity starts the CaptureView.surfaceDestroyed(SurfaceHolder holder) is called and the video preview stops. Then when the sub-activity closes the CaptureView.surfaceCreated(SurfaceHolder holder) is executed, but the video preview doesn't start.

Does anyone know how to fix the problem in order to successfully restart video preview after surfaceDestroyed(SurfaceHolder holder) is executed?

View 2 Replies View Related

Android :: Video Recorder As Alternative To Camera Preview Filter?

May 9, 2009

A number of previous posts imply that attempts to apply bespoke image processing on a Camera preview are hamstrung by a buggy API and will in any event run extremely slowly due to the need to manually decode the preview buffer. Can anyone comment on whether it is possible to use the video recorder as an alternative means of achieving this?

View 2 Replies View Related

Android :: Using DispatchDraw(Canvas) To Obtain Subsection Of Video Preview

Jul 29, 2010

The following is the overriden dispatchDraw in a subclass of SurfaceView. I'm trying to change the parameters of the Surface(getting only a subsection of the video preview.

CODE:......

Why does the above code not alter the dimensions of the SurfaceView at all?

View 1 Replies View Related

Samsung EPIC 4G :: Short Video Preview - 4G By Engadget

Jun 29, 2010

Short video preview of the Epic 4G by Engadget. YouTube - Samsung Epic 4G preview

View 1 Replies View Related

HTC Droid Eris :: Preview 2.2 - Free Downloads And Streaming Video

May 22, 2010

Videos - Free video downloads and streaming video - CNET TV

View 2 Replies View Related

Android :: Url To App Example On Document Is Not Valid

Apr 4, 2010

The documentation shows that you can directly link to your app on Android Market place. But every HTTP url I attempted, I am getting a page not found error. I am wondering if there is something wrong with the documentation or is there a rules change where we can directly link to apps we created. if that is the case, why is this documentation still exist pointing to incorrect information?

View 2 Replies View Related

Android :: Valid Network Exists

Dec 23, 2009

I am struggling to find a way to determine if a valid network is available to an app. specifically, if there's a problem making a network connection, i would like to be determine if it's on the client (app) side, or a problem with the remote server. i happen to be attempting a URL connection (using http client) and the wide and varied possible exceptions don't seem like a reliable method. for example, when the network is down on the phone, i received "unknown host exception", which doesn't really indicate the root cause ... it's possible to get that exception with a valid network connection also. at other times i get other exceptions, such as socket exception. is there a way to ask the phone if it's network ready? the other option i thought was to ping a known good server to see if it responds ... with an IP address. kind of a heavy weight option and not foolproof.

View 2 Replies View Related

Android :: Upload A Valid APK ADC2

Aug 29, 2009

I'm keep getting "upload a valid APK" when i'm uploading my app in ADC2 site submission. I followed all istructions at http://developer.android.com/guide/publishing/preparing.html, then signed my application with private key (40 years due date) all with Eclipse (Android toolsExport signed application package). The apk work fine in my phone. What I doing wrong?

Other info: Cancelled all Log. references; this is my begin manifest file:

CODE:............

View 2 Replies View Related

Android :: Videos Not Valid For Streaming To Device

Sep 24, 2010

I switched to a Droid X yesterday (and am loving it) from the original Motorola Droid with QWERTY. My original Droid had the 2.2 Froyo update with the Flash 10.1 and I could watch all the movies on Iphonemovies.net on it. I got my Droid X and the Froyo update was available with the flash player which I installed but now when I go to Iphonemovies.net it is telling me "Sorry, this video is not valid for streaming to this device." Anyone else come across this? Is this a format thing that needs to be set/changed on the actual Droid X device or is it a problem on the website end where the Droid is so new it's not recognizing it. And yes, I have Flashplayer on it now.

View 4 Replies View Related

Android :: Droid Not Returning Valid DeviceID / Way To Fix?

Jun 14, 2010

I have an application that utilizes the phones DeviceID in various ways. I am now getting emails from users who have the HTC Droid Incredible phone that they are getting the error message I have added to the app that is showing the DeviceID being returned is not valid - which means it is either empty/null or the default ID used in the emulator. I require a valid DeviceID to use my app, and the permissions are all set fine in the XML. It works just fine on every other device, and now suddenly it seems to stop working on this phone. Anyone else having this issue? Anyone find out what is causing it? Does HTC now block this ID on this device?

View 8 Replies View Related

Android :: How To Initialize Media Recorder In Background?

Aug 5, 2009

I am building a camera app, where photos and videos are continuously being captured and saved to the SD card. The videos are short (few minutes), and their length are preset with setMaxDuration(). When Media Recorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED is reached, the video is saved, and a new sequence is initialized with something like: The whole process works fine, while the main activity is in the foreground. But, when I go to another activity (e.g. settings), the video recording works in the background only until max duration is reached. The file is saved, but a new sequence can not be started because prepare() fails. setPreviewDisplay() needs to be there, but it doesn't like not having a proper surface to attach to. I tried to use a dummy Surface, a dummy SurfaceHolder, or reuse the Camera with mMediaRecorder.set Camera(), but nothing works. Is there a way to initialize Media Recorder in the background?

View 2 Replies View Related

Android :: Initialize Preferences From XML In Main Activity

May 20, 2010

My problem is that when I start application and user didn't open my PreferenceActivity so when I retrieve them don't get any default values defined in my preference.xml file. Code...

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved