简体   繁体   中英

Design for recording and transmitting audio from Android

I have two Android devices (Phone A & Phone B) and a server with a MySQL database. I want to send an audio message using a microphone, from Phone A to Phone B, through the server.

One idea is to:

  • use the microphone from the Phone A
  • record audio to a file in SD card
  • get bytes of this file and send to server as a simple text message
  • the server stores this data in the database
  • Phone B will poll server and receive this data
  • then write the bytes to a new file
  • then play it with MediaPlayer

    1. Is this correct?
    2. Does bytes have special characters ?

you need to capture the audio on phone A, and send it as binary data to the server. You can use a simple POST request to do so.

The server should store that to a file, not the database -- the database should only contain the filename and path, plus an id.

Phone B polls / gets push notification about the file. Server uses ID to get filename from database and uses passthru to serve the file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM