MediaRecorder
来源:互联网 发布:yy音效软件下载 编辑:程序博客网 时间:2024/05/10 11:34
MediaRecorder
Used to record audio and video.用来音视频的录制与播放,状态图如下:
A common case of using MediaRecorder to record audio works as follows,使用流程如下:
// initial MediaRecorder recorder = new MediaRecorder(); // initialized recorder.setAudioSource(MediaRecorder.AudioSource.MIC); AudioSource DEFAULT Default audio source MIC Microphone audio source REMOTE_SUBMIX Audio source for a submix of audio streams to be presented remotely. VOICE_CALL Voice call uplink + downlink audio source VOICE_COMMUNICATION Microphone audio source tuned for voice communications such as VoIP VOICE_RECOGNITION Microphone audio source tuned for voice recognition if available, behaves like DEFAULT otherwise. // config recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); // 输出格式 AAC_ADTS AAC ADTS file format AMR_NB AMR NB file format AMR_WB AMR WB file format DEFAULT MPEG_4 MPEG4 media file format RAW_AMR This constant was deprecated in API level 16. Deprecated in favor of MediaRecorder.OutputFormat.AMR_NB THREE_GPP 3GPP media file format WEBM VP8/VORBIS data in a WEBM container recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); // 音频编码格式 AAC AAC Low Complexity (AAC-LC) audio codec AAC_ELD Enhanced Low Delay AAC (AAC-ELD) audio codec AMR_NB AMR (Narrowband) audio codec AMR_WB AMR (Wideband) audio codec DEFAULT HE_AAC High Efficiency AAC (HE-AAC) audio codec VORBIS Ogg Vorbis audio codec recorder.setOutputFile(PATH_NAME); // prepare recorder.prepare(); // recording recorder.start(); // Recording is now started ... recorder.stop(); recorder.reset(); // You can reuse the object by going back to setAudioSource() step recorder.release(); // Now the object cannot be reused
使用的时候最好根据上图的流程,不然会报一些异常:
public void setAudioEncoder (int audio_encoder)Added in API level 1Sets the audio encoder to be used for recording. If this method is not called, the output file will not contain an audio track. Call this after setOutputFormat() but before prepare().Parametersaudio_encoder the audio encoder to use.ThrowsIllegalStateException if it is called before setOutputFormat() or after prepare().要注意调用顺序
0 0
- MediaRecorder
- MediaRecorder
- MediaRecorder
- MediaRecorder
- MediaRecorder 学习
- 初始化MediaRecorder
- android---MediaRecorder
- 初始化MediaRecorder
- 初始化MediaRecorder
- MediaRecorder类
- mediarecorder分辨率
- Android MediaRecorder
- Android MediaRecorder
- MediaRecorder test
- MediaRecorder录音
- Mediarecorder录音
- MediaRecorder录音
- MediaRecorder MPEG4Writer
- KSVD
- ssh整合出现的问题
- Webservice - Demo : Hello + Name (客户端篇)
- 和小小婷一块儿学Python--Python初见面
- Servlet中jsp修改后浏览器页面没有变化——已解决
- MediaRecorder
- 《systemverilog验证》阅读笔记 -- 过程语句和子程序
- PIC单片机入门_PICC的指向RAM的指针
- 构建高并发高可用的电商平台架构实践
- 硬件设计の运算放大器の一
- POJ 3169 Layout 差分约束系统
- Reducers may not dispatch actions
- 基础练习 特殊回文数
- 玲珑oj 1046- chess play【水】