패키지, 저장소 및 앱 카테고리 검색

GitHub 저장소inway/flutter_ringtone_player

flutter_ringtone_player

링톤, 알람 및 알림 사운드를 재생하는 간단한 플러터 플러그인

flutter_ringtone_player 프로젝트 이미지
스타
102
포크
108
최근 푸시(UTC)
2025. 11. 21.
프로젝트 상태
활성

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

flutter_ringtone_player

A simple ringtone, alarm & notification player plugin.

pub package flutter

Usage

Add following import to your code:

import 'package:flutter_ringtone_player/flutter_ringtone_player.dart';

Then simply call this to play system default notification sound:

FlutterRingtonePlayer().playNotification();

There's also this generic method allowing you to specify in detail what kind of ringtone should be played:

FlutterRingtonePlayer().play(
  android: AndroidSounds.notification,
  ios: IosSounds.glass,
  looping: true, // Android only - API >= 28
  volume: 0.1, // Android only - API >= 28
  asAlarm: false, // Android only - all APIs
);

Also you can specify a custom ringtone from assets, or provide direct path to file that works for both Android and iOS:

FlutterRingtonePlayer().play(fromAsset: "assets/ringtone.wav");  
FlutterRingtonePlayer().play(fromFile: "assets/ringtone.wav");  

You can specify a platform specific ringtone and it will override the one from assets:

FlutterRingtonePlayer().play(  
 fromAsset: "assets/ringtone.wav", // will be the sound on Android
 ios: IosSounds.glass 			   // will be the sound on iOS
 );  
.play() optional attributes
Attribute Description
bool looping Enables looping of ringtone. Requires FlutterRingtonePlayer().stop(); to stop ringing.
double volume Sets ringtone volume in range 0 to 1.0.
bool asAlarm Allows to ignore device's silent/vibration mode and play given sound anyway.

To stop looped ringtone please use:

FlutterRingtonePlayer().stop();

Above works only on Android, and please note that by default Alarm & Ringtone sounds are looped.

Default sounds

Method Android iOS
playAlarm RingtoneManager.TYPE_ALARM IosSounds.alarm
playNotification RingtoneManager.TYPE_NOTIFICATION IosSounds.triTone
playRingtone RingtoneManager.TYPE_RINGTONE IosSounds.electronic
Note on iOS sounds

If you want to use any other sound on iOS you can always specify a valid Sound ID and manually construct [IosSound]:

FlutterRingtonePlayer().play(
  android: AndroidSounds.notification,
  ios: const IosSound(1023),
  looping: true,
  volume: 0.1,
);
InWay.pro GitHub avatar
GitHub 작성자

InWay.pro ↗

언어DartJavaObjective-CSwiftRubyDockerfileKotlin

분류

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 5 개

  • flutter{"sdk":"flutter"}
  • path_provider^2.1.1
  • plugin_platform_interface^2.1.7
  • flutter_test개발 의존성{"sdk":"flutter"}
  • flutter_lints개발 의존성>=3.0.1 <6.0.0

프로젝트에 맞는 저장소를 선택하려면?

사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.

  1. 이름, 작성자 또는 설명으로 검색하고 기술 주제로 범위를 좁힙니다.
  2. 스타, 포크, 최근 푸시를 함께 비교하세요. 스타는 관심의 지표이며 품질을 보장하지 않습니다.
  3. 사용하기 전에 GitHub에서 README, 라이선스, Issues를 확인하세요.

출처 및 관리

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗