[英]Design for recording and transmitting audio from Android
I have two Android devices (Phone A & Phone B) and a server with a MySQL database. 我有两个Android设备(电话A和电话B)和一个带有MySQL数据库的服务器。 I want to send an audio message using a microphone, from Phone A to Phone B, through the server. 我想使用麦克风通过服务器从电话A到电话B发送音频消息。
One idea is to: 一种想法是:
then play it with MediaPlayer 然后用MediaPlayer播放
you need to capture the audio on phone A, and send it as binary data to the server. 您需要捕获电话A上的音频,并将其作为二进制数据发送到服务器。 You can use a simple POST request to do so. 您可以使用简单的POST请求来执行此操作。
The server should store that to a file, not the database -- the database should only contain the filename and path, plus an id. 服务器应将其存储到文件中,而不是数据库中,数据库应仅包含文件名和路径以及ID。
Phone B polls / gets push notification about the file. 电话B轮询/获取有关文件的推送通知。 Server uses ID to get filename from database and uses passthru
to serve the file. 服务器使用ID从数据库获取文件名,并使用passthru
来提供文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.