8000 GitHub - playtestcloud/mic_info: Mic Info Plugin is a Flutter plugin that allows you to detect and retrieve information about connected microphones on Android and iOS. It supports built-in, wired, and Bluetooth microphones. Integrate it easily by adding it to your pubspec.yaml and get detailed microphone information for enhanced audio management in your app.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Mic Info Plugin is a Flutter plugin that allows you to detect and retrieve information about connected microphones on Android and iOS. It supports built-in, wired, and Bluetooth microphones. Integrate it easily by adding it to your pubspec.yaml and get detailed microphone information for enhanced audio management in your app.

License

Notifications You must be signed in to change notification settings

playtestcloud/mic_info

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mic Info Plugin

The Mic Info Plugin allows Flutter applications to retrieve information about connected microphones on Android and iOS devices, including default, wired, and Bluetooth microphones.

Features

  • Built-in Microphone Detection: Retrieve the default microphones available on the device.
  • Wired and USB Microphone Detection: Detect wired headsets, including USB connector microphones.
  • Bluetooth Microphone Detection: Identify and list Bluetooth microphones for hands-free audio input.
  • Cross-Platform Support: Works seamlessly on both Android and iOS.

Platforms Supported

  • Android: API Level 23 (Android 6.0) and above.
  • iOS: iOS 10.0 and above.

Installation

Add the following to your pubspec.yaml file:

dependencies:
  mic_info: ^0.0.1  # Use the latest version

Run the following command to install the package:

flutter pub get

Usage

Import the Plugin

To use this plugin, import it in your Dart file:

import 'package:mic_info/mic_info.dart';

Example: Retrieving Microphone Information

You can retrieve information about the default, wired, and Bluetooth microphones using the following methods:

import 'package:mic_info/mic_info.dart';
import 'package:mic_info/model/mic_info_model.dart';

void getMicrophoneInfo() async {
  final micInfo = MicInfo();

  // Retrieve Default Microphone
  List<Device> defaultMicrophones = await micInfo.getDefaultMicrophone();
  print("Default Microphones: $defaultMicrophones");

  // Retrieve Wired Microphone
  List<Device> wiredMicrophones = await micInfo.getWiredMicrophone();
  print("Wired Microphones: $wiredMicrophones");

  // Retrieve Bluetooth Microphone
  List<Device> bluetoothMicrophones = await micInfo.getBluetoothMicrophone();
  print("Bluetooth Microphones: $bluetoothMicrophones");
}

Device Model

The information about each microphone is returned as a list of Device objects:

class Device {
  String productName;
  String id;

  Device({required this.productName, required this.id});

  @override
  String toString() {
    return 'Device(productName: $productName, id: $id)';
  }
}

Each device contains:

  • productName: The name of the microphone.
  • id: The unique identifier of the microphone.

Permissions

Ensure that you have the appropriate permissions for accessing the microphone on both Android and iOS.

Android

Add the following permission in your AndroidManifest.xml file:

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

iOS

In the ios/Runner/Info.plist file, add:

<key>NSMicrophoneUsageDescription</key>
<string>This app needs access to your microphone.</string>

Platform-Specific Implementation

Android

This plugin uses AudioManager and AudioDeviceInfo to detect connected microphones on Android devices.

iOS

For iOS, the plugin uses AVAudioSession to retrieve microphone information, including Bluetooth and wired devices.

Troubleshooting

-Ensure that the app has permission to use the microphone. -Check that the connected microphones are supported by your device.

Contributions

Contributions are welcome! Please feel free to submit pull requests or open issues.

About

Mic Info Plugin is a Flutter plugin that allows you to detect and retrieve information about connected microphones on Android and iOS. It supports built-in, wired, and Bluetooth microphones. Integrate it easily by adding it to your pubspec.yaml and get detailed microphone information for enhanced audio management in your app.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 42.7%
  • Swift 27.4%
  • Kotlin 25.3%
  • Ruby 4.5%
  • Objective-C 0.1%
0