パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v3.7.1

volume_controller

複数のプラットフォーム向けのFlutter音量プラグインで、システム音量を制御します。

AndroidiOSmacOSWindowsLinux
30日間ダウンロード
18.7万
いいね数
132
Pub ポイント
160

パッケージをインストール

flutter pub add volume_controller

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

volume_controller パッケージは、Android、iOS、macOS、Windows、Linux のすべてのプラットフォームでシステム音量を制御できるクロスプラットフォームの Flutter プラグインです。音量レベルの調整、ミュート、照会を簡単な API で行えるため、メディアアプリ、オーディオツール、またはシステムレベルのオーディオ制御が必要なあらゆるアプリに最適です。プラグインはプラットフォーム固有の実装を抽象化しており、デバイス間で一貫した動作を保証します。ストリームベースの音量モニタリングと直接的な音量操作の両方をサポートしています。統合のしやすさを重視して開発されており、既存の Flutter プロジェクトにスムーズに組み込むことができます。

用途

  • メディアプレイヤーの音量制御
  • オーディオアプリシステム統合
  • アクセシビリティツール
  • オーディオ機能の自動テスト
  • システム全体のボリューム調整

主な機能

  • クロスプラットフォーム対応(Android、iOS、macOS、Windows、Linux)
  • 音量レベルの調整とミュート
  • ストリームを介したリアルタイムのボリュームモニタリング
  • シンプルで一貫性のある API
  • ネイティブ音量コントロールのプラットフォーム抽象

適している対象

  • 音声中心のアプリを開発する開発者
  • システム音量アクセスが必要なアプリ
  • マルチプラットフォームオーディオユーティリティ
  • OS間でのオーディオ動作のテスト

注意事項

  • 適切なプラットフォーム権限が必要です
  • OSによって動作がわずかに異なる場合があります
  • システム音量(アプリ固有ではない)に限定
  • 低レベルのオーディオ処理には適していません
  • 一部のプラットフォームではユーザーの許可が必要になる場合があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Volume Controller

pub package license

Control and observe the system volume on Android, iOS, macOS, Windows, and Linux.

Requirements

  • Flutter >=3.44.0
  • Dart ^3.12.0

The iOS plugin uses the scene lifecycle APIs introduced for Flutter plugins in Flutter 3.38.

Supported Platforms

Platform Supported
Android ✅
iOS ✅
macOS ✅
Windows ✅
Linux ✅

Notes

  • iOS volume control must be tested on a real device. The simulator does not support system volume control.
  • showSystemUI is supported on Android and iOS only.
  • Mute is not volume 0 on every platform:
    • Windows, macOS, Linux: system mute. Volume can stay non-zero while muted.
    • Android API 23+: STREAM_MUSIC mute (isStreamMute / ADJUST_MUTE).
    • Android API 21–22: mute sets volume to 0 and unmute restores the previous volume saved by the plugin.
    • iOS: there is no public system media mute API. isMuted() is volume == 0. setMute(true) sets volume to 0; setMute(false) restores the previous volume saved by the plugin. iOS 26 AVAudioSession.setOutputMuted is not used, because it mutes this app's audio session rather than the system volume.

Variables

ShowSystemUI

Show or hide the volume system UI. The default value is true. Supported on iOS and Android only.

VolumeController.instance.showSystemUI = true;

Functions

GetVolume

Get the current system volume.

double volume = await VolumeController.instance.getVolume();
SetVolume

Set the system volume. The input should be in the range 0.0 to 1.0.

await VolumeController.instance.setVolume(double volume);
AddListener

Add a listener to monitor system volume changes.

  • fetchInitialVolume: Send the current volume immediately. Defaults to true.
VolumeController.instance.addListener((volume) {
  // Do something with the volume
}, fetchInitialVolume: true);
RemoveListener

Remove the volume listener.

await VolumeController.instance.removeListener();
IsMuted

Check whether the system is muted.

bool isMuted = await VolumeController.instance.isMuted();
SetMute

Mute or unmute the system volume.

await VolumeController.instance.setMute(bool mute);

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト