Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9177643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:22:23+00:00 2026-06-17T17:22:23+00:00

I want android.media.MediaRecorder. to record audio not into file, but into same variable, for

  • 0

I want android.media.MediaRecorder. to record audio not into file, but into same variable, for example char[ ] or byte[ ] or some other datta buffer structure. I want to send it to the remote server via Wi-Fi, can android.media.MediaRecorder provide this functionality?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T17:22:24+00:00Added an answer on June 17, 2026 at 5:22 pm

    What you can do here is utilize the ParcelFileDescriptor class.

    //make a pipe containing a read and a write parcelfd
    ParcelFileDescriptor[] fdPair = ParcelFileDescriptor.createPipe();
    
    //get a handle to your read and write fd objects.
    ParcelFileDescriptor readFD = fdPair[0];
    ParcelFileDescriptor writeFD = fdPair[1];
    
    //next set your mediaRecorder instance to output to the write side of this pipe.
    mediaRecorder.setOutputFile(writeFD.getFileDescriptor());
    
    //next create an input stream to read from the read side of the pipe.
    FileInputStream reader = new FileInputStream(readFD.getFileDescriptor());
    
    //now to fill up a buffer with data, we just do a simple read
    byte[] buffer = new byte[4096];//or w/e buffer size you want
    
    //fill up your buffer with data from the stream
    reader.read(buffer);// may want to do this in a separate thread
    

    and now you have a buffer full of audio data

    alternatively, you may want to write data directly to a socket from the recorder. this can also be achieved with the ParcelFileDescriptor class.

    //create a socket connection to another device
    Socket socket = new Socket("123.123.123.123",65535);//or w/e socket address you are using
    
    //wrap the socket with a parcel so you can get at its underlying File descriptor
    ParcelFileDescriptor socketWrapper = ParcelFileDescriptor.fromSocket(socket);
    
    //set your mediaRecorder instance to write to this file descriptor
    mediaRecorder.setOutputFile(socketWrapper.getFileDescriptor());
    

    now any time your media recorder has data to write it will automatically write it over the socket

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want install android on my computer but using the sdk it fails to
I want to access Android API classes outside an Android project . For example
When a user downloads a file using Android I want my custom activity to
Can I record more than one channel at the same time either using MediaRecorder
I know Visualizer to show some wave while playing audio using android Media Player.
I want to play a sound file with mediaplayer and viewpager, but it is
I use Intent intent = new Intent(android.media.action.IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(getSomePath()+temp.jpg))); //intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); startActivityForResult(intent, 0);
I currently use AudioRecord to record audio in from the mic of an Android
In my android application i want to copy the media images to another folder(in
I want to activate next and previous controls on Android Media controller in an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.