搜索分类、插件与代码仓

插件详情v1.0.2

audio_recorder

一个用于录制音频的 Flutter 插件。

近 30 天下载
1030
喜欢数
79
Pub 分数
15

安装插件

flutter pub add audio_recorder

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个用于在移动应用程序中启用音频录制功能的 Flutter 插件。它提供了一个简单的接口,用于在支持的平台上启动、停止和管理音频录制。该插件非常适合需要语音笔记、播客创作或基于语音交互的应用程序。它与 Flutter 生态系统无缝集成,并支持常见的音频格式。开发者可以通过插件返回的文件路径访问录制的文件。

适合场景

  • 语音备忘录应用
  • 播客录制工具
  • 语音转文本集成
  • 交互式语音功能
  • 音频记录

主要特点

  • 简单的开始/停止录制 API
  • 录制音频的文件路径返回
  • 跨平台音频捕获
  • 支持常见音频格式
  • 与 Flutter 的轻松集成

适合对象

  • 移动应用开发者
  • 支持语音的应用程序
  • 教育工具
  • 内容创作应用
  • 无障碍功能

使用建议

  • 在 Android 和 iOS 上需要运行时权限
  • 仅限设备支持的音频格式
  • 无内置音频播放
  • 可能需要特定于平台的配置
  • 文件管理责任由开发者承担

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Audio recorder

pub package Build Status Coverage Status

Record audio and store it locally

Usage

To use this plugin, add audio_recorder as a dependency in your pubspec.yaml file.

Android

Make sure you add the following permissions to your Android Manifest

<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
iOS

Make sure you add the following key to Info.plist for iOS

<key>NSMicrophoneUsageDescription</key>
<string>Record audio for playback</string>

Example

// Import package
import 'package:audio_recorder/audio_recorder.dart';

// Check permissions before starting
bool hasPermissions = await AudioRecorder.hasPermissions;

// Get the state of the recorder
bool isRecording = await AudioRecorder.isRecording;

// Start recording
await AudioRecorder.start(path: _controller.text, audioOutputFormat: AudioOutputFormat.AAC);

// Stop recording
Recording recording = await AudioRecorder.stop();
print("Path : ${recording.path},  Format : ${recording.audioOutputFormat},  Duration : ${recording.duration},  Extension : ${recording.extension},");

Encoding format

For now, the plugin only use the AAC compression to encode audio. You can specify the extension of the output audio file in the file path that you give to the start method. The recognized extensions are :

  • .m4a
  • .mp4
  • .aac

If the file path does not finish with these extensions, the ".m4a" extension is added by default.

Exceptions

The start method raise an exception if :

  • A file already exists at the given file path
  • The parent directory of the file path does not exist

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

所属分类

依赖

依赖清单 2 项

源码仓库

使用此插件的项目

暂无相关数据。