पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

पैकेज विवरणv4.0.0+4

flutter_ringtone_player

सिस्टम के डिफ़ॉल्ट रिंगटोन, अलार्म और सूचनाओं के लिए एक सरल प्लेयर

AndroidiOS
30-दिन डाउनलोड
2.6 हज़ार
लाइक
287
Pub अंक
150

पैकेज इंस्टॉल करें

flutter pub add flutter_ringtone_player

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

एक हल्का फ्लटर पैकेज जो एंड्रॉइड और आईओएस डिवाइस पर सिस्टम के डिफ़ॉल्ट रिंगटोन, अलार्म और सूचनाओं के प्लेबैक की अनुमति देता है। यह बाहरी फ़ाइल हैंडलिंग के बिना निर्मित ध्वनि संसाधनों को एक्सेस और प्लेबैक करने के लिए एक सरल API प्रदान करता है। याद दिलाने, चेतावनी या सूचना ध्वनियों जैसे डिवाइस-विशिष्ट ऑडियो संकेतों को ट्रिगर करने की आवश्यकता वाले ऐप्स के लिए आदर्श है। पैकेज मूल आउटपुट ऑडियो प्रणालियों के साथ बिना किसी बाधा के एकीकृत है और दोनों प्लेटफॉर्म के साथ न्यूनतम कॉन्फ़िगरेशन के साथ समर्थन करता है।

उपयोग

  • रिमाइंडर ऐप्स में सिस्टम रिंगटोन्स को प्ले करना
  • टास्क मैनेजमेंट टूल्स में अलार्म आवाज़ को ट्रिगर करना
  • संदेश ऐप में नोटिफिकेशन टोन की पुनरावृत्ति
  • उपयोगिता ऐप में डिवाइस एलर्ट ध्वनियों का नकली उत्पादन
  • घंटी के बजाने के साथ साइलेंट मोड फॉलबैक को सक्षम करना

मुख्य विशेषताएँ

  • सिस्टम के डिफ़ॉल्ट रिंगटोन्स तक पहुंच
  • Android और iOS के लिए समर्थन
  • न्यूनतम सेटअप और एकीकरण
  • क्रॉस-प्लेटफॉर्म संगतता
  • सरल प्लेबैक नियंत्रण API

इनके लिए उपयुक्त

  • याद देने या चेतावनी एप्लिकेशन बनाने वाले डेवलपर्स
  • मूल सूचना ध्वनियों की आवश्यकता वाले ऐप
  • उपकरण ऑडियो प्रतिक्रिया की आवश्यकता वाले उपयोगी टूल
  • Android और iOS दोनों के लिए मोबाइल ऐप्स

विचार योग्य बातें

  • उचित प्लेटफॉर्म की अनुमतियाँ आवश्यक हैं
  • प्रणाली द्वारा प्रदान किए गए ध्वनि संसाधनों तक सीमित
  • कस्टम रिंगटोन फ़ाइल्स का समर्थन नहीं है
  • Android और iOS के बीच व्यवहार में थोड़ा अंतर हो सकता है
  • मूल सिस्टम ऑडियो की उपलब्धता पर निर्भर करता है

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

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,
);

श्रेणियाँ

निर्भरताएँ

निर्भरता सूची 2 आइटम

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट