---
title: RecorderManager - 获取全局唯一的录音管理器
---

## RecorderManager

### 功能描述

获取全局唯一的录音管理器

### 体验 Demo

<div style="display: flex; flex-direction: row; align-items: center; padding: 16px; background: #f9f9f9; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.05);">
    <img src="https://github.com/Tuya-Community/tuya-miniapp-demo/raw/master/qrCode/recorder.png?raw=true" style="width: 100px; height: 100px; border-radius: 8px; border: 1px solid #e8e8e8; box-shadow: 0 2px 4px rgba(0,0,0,0.1);"/>
    <div style="margin-left: 24px;">
        <div style="color: #262626; font-size: 16px; font-weight: 600; margin-bottom: 12px;">智能生活App扫码进行体验</div>
        <a href="https://github.com/Tuya-Community/tuya-miniapp-demo/tree/master/recorderManager" style="font-size: 14px; color: #1890ff; text-decoration: none; display: inline-flex; align-items: center;">
            <span>Demo下载地址</span>
            <span style="margin-left: 4px;">→</span>
        </a>
    </div>
</div>

### 常见问题

#### Q: encodeBitRate 编码码率如何设置？

A: 不同采样率对应的编码码率范围如下:

| 采样率  | 编码码率范围     |
| ------- | ---------------- |
| 8000Hz  | 16000~48000 bps  |
| 11025Hz | 16000~48000 bps  |
| 12000Hz | 24000~64000 bps  |
| 16000Hz | 24000~96000 bps  |
| 22050Hz | 32000~128000 bps |
| 24000Hz | 32000~128000 bps |
| 32000Hz | 48000~192000 bps |
| 44100Hz | 64000~320000 bps |
| 48000Hz | 64000~320000 bps |

注意:

1. 设置不合法的采样率或编码码率组合会导致录音失败,请严格按照上表范围设置
2. 建议使用较高的采样率和编码码率以获得更好的音质
3. 较高的编码码率会产生较大的文件体积,请根据实际需求选择合适的参数

#### Q：audioSource 指定录音的输入源如何设置？

A：audioSource 用于指定录音的输入源，支持以下取值：

iOS 平台:

- auto: 自动选择输入源(默认值)
- buildInMic: 手机内置麦克风
- headsetMic: 有线耳机麦克风

Android 平台:

- auto: 自动选择输入源(默认值)
- mic: 麦克风(手机麦克风或耳机麦克风)
- camcorder: 适用于音视频录制
- voice_communication: 适用于实时通话
- voice_recognition: 适用于语音识别

使用建议:

1. 建议使用默认值 auto,可以自动适配各种场景
2. 不同设备和系统版本对输入源的支持可能存在差异
3. 在开发测试时需要充分验证目标设备的兼容性
