MediaRecorder buffering

by RFuente » Thu, 21 Oct 2010 19:22:34 GMT

Sponsored Links
 Hi everyone!

I've been working with MediaRecorder for a while and still keep up
discovering funny things about this class. I have two instances: one
of them records video and the other one records audio (why I don't
implement this with just one instance will be long to explain xD).

At the same time I am sending stored data via UDP to a remote machine
(running Java). The thing is that audio data is being received in
bursts and I've managed to find this is due to the way MediaRecorder
stores data. Do you know if it always behaves in the same way? At the
moment, data is being stored into the SD card, has any of you tried
writing into internal storage or maybe directly into a socket file

I know mine is not the best approach but it's still under development
(Android 1.6).

If anyone could give a hand it would be very much appreciated. Thanks.


Other Threads

1. Large Scrollable Image Help

Hi all, I'm having trouble displaying an oversized scrolling image. I
accomplished this originally by creating the custom class below to
replace the standard ImageView. My original large image was a png that
was a little over 1000x1000 in resolution and about 722kb in size. For
that image, the class below worked flawlessley. But now I need to do
the same thing with a MUCH larger image and I'm wondering if this is
not the best way to go about it. My new image is about 5000x5000 and
I've produced varying versions from png's that were up to 6MB to jpg's
that were 1.5MB. All of these images cause my app to crash instantly
without any changes to the code (besides referencing the larger
image). The important thing I need to do is be able to scroll and
zoom, and I'm starting to think the only way I'm going to get this
working is to slice my image up and create some sort of scrolling
GridView inside an AbsoluteLayout, that only loads the slices that are
displayed on screen. This is a bit more work than I was hoping to put
into this app, but can anyone give me any advice on which direction I
should be heading?

Below is my ScrollingImageView class for reference. It works
flawlessly if the image is not too big, so feel free to use it however
you'd like.

Thanks in advance,

import android.content.Context;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.GestureDetector.OnGestureListener;
import android.widget.AbsoluteLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;

public class ScrollingImageView extends AbsoluteLayout implements
OnGestureListener {

        private GestureDetector mGestureDetector;
        private ImageView mImageView;

        public ScrollingImageView(Context context, int imageResId, int
imageWidth, int imageHeight) {

                mImageView = new ImageView(context);
                this.addView(mImageView, new 

                mGestureDetector = new GestureDetector(this);


        public boolean onDown(MotionEvent e) {
                return false;

        public boolean onFling(MotionEvent e1, MotionEvent e2, float
                        float velocityY) {
                // TODO Auto-generated method stub
                return false;

        public void onLongPress(MotionEvent e) {

        public boolean onScroll(MotionEvent e1, MotionEvent e2, float
                        float distanceY) {
             int scrollWidth = mImageView.getWidth() - this.getWidth();
             if ((this.getScrollX() >= 0) && (this.getScrollX() <=
scrollWidth) && (scrollWidth > 0)) {
                 int moveX = (int)distanceX;
                 if (((moveX + this.getScrollX()) >= 0) && ((Math.abs(moveX)
+ Math.abs(this.getScrollX())) <= scrollWidth)) {
                     this.scrollBy(moveX, 0);
                 else {
                     if (distanceX >= 0) {
                         this.scrollBy(scrollWidth - Math.max(Math.abs
(moveX), Math.abs(this.getScrollX())), 0);
                     else {
                         this.scrollBy(-Math.min(Math.abs(moveX), Math.abs
(this.getScrollX())), 0);

             int scrollHeight = mImageView.getHeight() - this.getHeight();
             if ((this.getScrollY() >= 0) && (this.getScrollY() <=
scrollHeight) && (scrollHeight > 0)) {
                 int moveY = (int)distanceY;
                 if (((moveY + this.getScrollY()) >= 0) && ((Math.abs(moveY)
+ Math.abs(this.getScrollY())) <= scrollHeight)) {
                     this.scrollBy(0, moveY);
                 else {
                     if (distanceY >= 0) {
                         this.scrollBy(0, scrollHeight - Math.max(Math.abs
(moveY), Math.abs(this.getScrollY())));
                     else {
                         this.scrollBy(0, -Math.min(Math.abs(moveY), Math.abs
             return true;

        public void onShowPress(MotionEvent e) {
                // TODO Auto-generated method stub


        public boolean onSingleTapUp(MotionEvent e) {
                // TODO Auto-generated method stub
                return false;

        public boolean dispatchTouchEvent(MotionEvent ev) {
             return true;

        public void zoomIn() {
                int h = mImageView.getHeight();
                int w = mImageView.getWidth();
                h *= 2;
                w *= 2;
                this.addView(mImageView, new LinearLayout.LayoutParams(w, h));
        public void zoomOut() {
                this.scrollTo(0, 0);
                int h = mImageView.getHeight();
                int w = mImageView.getWidth();
                h /= 2;
                w /= 2;
                this.addView(mImageView, new LinearLayout.LayoutParams(w, h));



2. .apk install fails: package conflict

I'm testing an app I'm developing and asked a friend to install on
their device. I wanted to make it as easy as possible for them to help
me out so I put the .apk up on my website for them to download to the
phone (rather than making them download the SDK and use adb to
install). The install of the downloaded .apk fails, complaining of a
package conflict.

I have since gotten my hands on the phone briefly and I verified that:
* they have selected "allow unsigned apps" in settings
* there is no package with the same (or similar) name in data/data
* installing via adb works with not a peep
* when I download the .apk to my phone the app installs fine

Any ideas what's up? It would be really nice to make it as easy as
possible to distribute to people who might be willing to do me the
favor of testing.

Thanks for any help,


3. Freedom cuts both ways (Cupcake coming in April? Where is the SDK?)

4. Receiving SMS Messages in 1.0?

5. All SYMBIAN based end devices accept Java language Applications :: Need Clarifications

6. All SYMBIAN based end devices accept Java language Applications :: Need Clarifications

7. Process is not ending ?