mediarecorder

Android 音频

人盡茶涼 提交于 2019-12-10 10:53:11
文章目录 AudioRecorder与MediaRecorder的比较 AudioRecorder 构造参数 AudioTrack 代码解析 1. 创建一个AudioRecorder对象及初始化 2. 启动录音 3. 录音线程 4. 获取录音裸数据 5. 给数据加header,转换成wav格式 6. 停止录音 MediaRecorder workflow Error/Info Listener usually method AudioRecorder与MediaRecorder的比较 以下内容来自博客:https://www.cnblogs.com/Amandaliu/archive/2013/02/04/2891604.html 若有侵权,立即删除 1. AudioRecord 主要是实现边录边播(AudioRecord+AudioTrack)以及对音频的实时处理(如会说话的汤姆猫、语音) 优点:语音的实时处理,可以用代码实现各种音频的封装 缺点:输出是PCM语音数据,如果保存成音频文件,是不能够被播放器播放的,所以必须先写代码实现数据编码以及压缩 示例: 使用AudioRecord类录音,并实现WAV格式封装。录音20s,输出的音频文件大概为3.5M左右(已写测试代码) 2、MediaRecorder 已经集成了录音、编码、压缩等,支持少量的录音音频格式,大概有.aac(API

how to mute the “beep” by MediaRecorder.start()?

那年仲夏 提交于 2019-12-10 03:36:35
问题 I have tried all methods mentioned in the following links How to shut off the sound MediaRecorder plays when the state changes Need to shut off the sound MediaRecorder plays when the state changes but none of them work. Anyone knows how to achieve that ? 回答1: Though I am too late to answer it. It may still help peoples who all are googling the same problem. Before starting media recorder add following two lines of code .. Its gonna mute phones sound.. //mute phone AudioManager audioManager =

Recording audio from external source in an android application

痞子三分冷 提交于 2019-12-09 06:41:26
I saw there was a similar question here: Is it possible to record from the external mic when recording video in Android? However, the question was never really answered and android documentation does not clearly state how this is done. This person in this thread states that it is possible, but does not say how. Real-time audio capture and playback from an external mic It would make sense for you to make the selection in the "setAudioSource" section, but none of the options are for external sources. MediaRecorder recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource

Voice Call recording in android using MediaRecorder

大兔子大兔子 提交于 2019-12-09 03:21:40
问题 I have a problem in recording a call I have made a service and called a BroadcastReceiver to get the call state. In TelephonyManager.EXTRA_STATE_OFFHOOK when the call is received. I am using following code to record the call recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT); recorder.setOutputFile(audiofile.getAbsolutePath()); try { recorder.prepare(); recorder

Recording audio from external source in an android application

六月ゝ 毕业季﹏ 提交于 2019-12-08 08:52:37
问题 I saw there was a similar question here: Is it possible to record from the external mic when recording video in Android? However, the question was never really answered and android documentation does not clearly state how this is done. This person in this thread states that it is possible, but does not say how. Real-time audio capture and playback from an external mic It would make sense for you to make the selection in the "setAudioSource" section, but none of the options are for external

Samsung Galaxy SIII mediaRecorder() issues. (Corrupt Video)

时光怂恿深爱的人放手 提交于 2019-12-08 06:40:25
问题 I have a problem with the Samsung Galaxy SIII. In the app we are creating, we use a mediaRecorder to record a video of the user using the front camera. I have looked thoroughly in the documentation and all over forums and I have seen a few similar posts for the SII or crashes in general, but those fixes unfortunately did not work for us. The process that the camera records is as follows --> There is a function (code will be provided) that checks each devices compatible camera resolutions,

MediaRecorder throw “java.lang.RuntimeException: start failed: -2147483648” when trying to record audio on LG G Watch

天涯浪子 提交于 2019-12-07 22:10:35
问题 I am trying to record audio in my app on a LG G Watch. The following code throws RuntimeException with message "start failed: -2147483648" at the statement "recorder.start();". Wondering what I'm doing wrong here. I have tried a lot of different set of parameters, for example for AudioSource: recorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT); //-and- recorder.setAudioSource(MediaRecorder.AudioSource.MIC); Also for OutputFormat I have tried recorder.setOutputFormat(MediaRecorder

Using MediaRecorder and NoiseSuppressor in Android

北城以北 提交于 2019-12-07 18:06:24
I'm starting off a project experimenting with the Android microphone using code like this: mRecorder = new MediaRecorder(); mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); mRecorder.setOutputFile(mFileName); mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); After that, a prepare() and start() to begin recording mic audio. Trouble is, I'm trying to also add in some audio processing effects like NoiseSuppressor. The API docs state that NoiseSuppressor is done with this: NoiseSuppressor create (int audioSession)

Record Video To Byte Array Without Writing To File

天涯浪子 提交于 2019-12-07 11:04:18
问题 I'm implementing a custom video camera using the Google Developer API Guide; it uses the MediaRecorder class to create and manage all the settings/operations of the video camera. Save for the fact that it's taking way too long to write the file to the phone (after recording, it'll be about 5 minutes before I even get to see the file under Gallery ), it's working as it should. But I don't want a file: I need the raw byte array the recording produces, before it's dumped into a file. Does

MediaRecorder - How to play chunk/blob of video while recording?

丶灬走出姿态 提交于 2019-12-07 02:17:05
问题 I currently have a MediaStream which is being recorded using MediaRecorder . At the end of the recording after recorder.stop() , it produce a Blob and I am able to play that video back. My goal is to play not the entire video at the end, but play a chunk while recording . For the moment, a chunk is not playable while recording is not ended. How can i do that using javascript? The final objective is to send a chunk by websocket that is playable even if recording is in action. I am not able to