rafaelsetragni / awesome_notifications

A complete solution to create Local Notifications and Push Notifications, throught Firebase or another services, using Flutter.
https://discord.awesome-notifications.carda.me
Apache License 2.0
756 stars 327 forks source link

customSound or soundSource not working on file .mp3 #812

Closed Sebuahhobi closed 1 year ago

Sebuahhobi commented 1 year ago

1 - Describe the bug

customSound or soundSource not working in asset://assets/ or resource://raw/ play .mp3

2 - Provide us as much information as possible

pubspec.yaml cupertino_icons: ^1.0.2 rubber: ^1.0.1 sliding_up_panel: ^2.0.0+1 flutter_custom_clippers: ^2.0.0 font_awesome_flutter: ^10.4.0 intl: ^0.17.0 encrypt: ^5.0.1 permission_handler: ^10.2.0 http: ^0.13.5 flutter_dotenv: ^5.0.2 qr_code_scanner: ^1.0.1 speech_to_text: ^6.1.1 get: ^4.6.5 hexcolor: ^2.0.4 flutter_secure_storage: ^8.0.0 flutter_native_timezone: ^2.0.0 flutter_chat_bubble: ^2.0.2 cached_network_image: ^3.2.3 device_info_plus: ^9.0.0 url_launcher: ^6.1.11 flutter_contacts: ^1.1.6 sqflite: ^2.2.8+4 path_provider: ^2.0.15 marquee: ^2.2.3 google_fonts: ^4.0.4 adhan_dart: ^1.0.8 geolocator: ^9.0.2 shared_preferences: ^2.1.2 hijri: ^3.0.0 flutter_blue_plus: ^1.5.2 bluetooth_print: ^4.3.0 firebase_messaging: ^14.6.3 firebase_core: ^2.14.0 awesome_notifications: ^0.7.4+1 timezone: ^0.9.2

Flutter doctor [flutter] flutter doctor -v [√] Flutter (Channel stable, 3.10.5, on Microsoft Windows [Version 10.0.19045.3086], locale en-ID) • Flutter version 3.10.5 on channel stable at C:\Flutter\SDK\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 796c8ef792 (4 weeks ago), 2023-06-13 15:51:02 -0700 • Engine revision 45f6e00911 • Dart version 3.0.5 • DevTools version 2.23.1

[√] Windows Version (Installed version of Windows is version 10 or higher)

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\Sebuahhobi\AppData\Local\Android\sdk • Platform android-33, build-tools 30.0.3 • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619) ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[√] Chrome - develop for the web • Chrome at C:\Users\Sebuahhobi\AppData\Local\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.0.5) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.0.32112.339 • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2022.1) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619)

[√] VS Code (version 1.80.0) • VS Code at C:\Users\Sebuahhobi\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.68.0

[√] VS Code, 64-bit edition (version 1.68.1) • VS Code at C:\Program Files\Microsoft VS Code • Flutter extension version 3.68.0

[√] Connected device (4 available) • Redmi Note 8 (mobile) • 172.16.43.128:5555 • android-arm64 • Android 11 (API 30) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.3086] • Chrome (web) • chrome • web-javascript • Google Chrome 114.0.5735.199 • Edge (web) • edge • web-javascript • Microsoft Edge 114.0.1823.67

[√] Network resources • All expected network resources are available.

! Doctor found issues in 1 category. exit code 0

class AwesomeNotificationController {
  Future<void> init() async {
    await AwesomeNotifications().initialize(
      '',
      [
        NotificationChannel(
          channelGroupKey: "Notifikasi",
          channelKey: 'notifikasi',
          channelName: 'Notifikasi',
          channelDescription: 'Menampilkan notifikasi',
          defaultColor: const Color(0xFF9D50DD),
          ledColor: Colors.white,
          playSound: true,
          // soundSource: 'resource://raw/birds',
          soundSource: 'asset://assets/audio/birds.mp3',
          importance: NotificationImportance.High,
          enableVibration: true,
          defaultPrivacy: NotificationPrivacy.Public,
          // defaultRingtoneType: DefaultRingtoneType.Ringtone,
        ),

      ],
  }
...

3 - How To Reproduce the Error

Exception has occurred. PlatformException (PlatformException(INVALID_ARGUMENTS, Audio media is not valid, arguments.invalid.channel.sound, null))

4 - Expected behavior

A clear and concise description of what you expected to happen.

5 - Screenshots

image image

6 - Additional context

Add any other context about the problem here.

github-actions[bot] commented 1 year ago

This issue was automatically closed due inactivity, but can be reopened at any time.

Muhammed-Ayad commented 11 months ago

@Sebuahhobi did you found some solution ?

dvxgit-jalonzo commented 10 months ago

did you resolve the issue ?

Muhammed-Ayad commented 10 months ago

@dvxgit-jalonzo yes

Parthakbari15 commented 10 months ago

i got the problem to set the custom sound on my notification .

me.carda.awesome_notifications.notifications.exceptions.AwesomeNotificationException: Audio media is not valid W/System.err(10447): at me.carda.awesome_notifications.notifications.models.NotificationChannelModel.validate(NotificationChannelModel.java:286) W/System.err(10447): at me.carda.awesome_notifications.notifications.managers.ChannelManager.saveChannel(ChannelManager.java:136) W/System.err(10447): at me.carda.awesome_notifications.AwesomeNotificationsPlugin.setChannels(AwesomeNotificationsPlugin.java:1145) W/System.err(10447): at me.carda.awesome_notifications.AwesomeNotificationsPlugin.setDefaultConfigurations(AwesomeNotificationsPlugin.java:1088) W/System.err(10447): at me.carda.awesome_notifications.AwesomeNotificationsPlugin.channelMethodInitialize(AwesomeNotificationsPlugin.java:1070) W/System.err(10447): at me.carda.awesome_notifications.AwesomeNotificationsPlugin.onMethodCall(AwesomeNotificationsPlugin.java:438) W/System.err(10447): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258) W/System.err(10447): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295) W/System.err(10447): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322) W/System.err(10447): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12) W/System.err(10447): at android.os.Handler.handleCallback(Handler.java:942) W/System.err(10447): at android.os.Handler.dispatchMessage(Handler.java:99) W/System.err(10447): at android.os.Looper.loopOnce(Looper.java:240) W/System.err(10447): at android.os.Looper.loop(Looper.java:351) W/System.err(10447): at android.app.ActivityThread.main(ActivityThread.java:8423) W/System.err(10447): at java.lang.reflect.Method.invoke(Native Method) W/System.err(10447): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584) W/System.err(10447): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013) W/AlarmService(10447): Attempted to start a duplicate background isolate. Returning... E/flutter (10447): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(initialize, Audio media is not valid, me.carda.awesome_notifications.notifications.exceptions.AwesomeNotificationException: Audio media is not valid E/flutter (10447): at me.carda.awesome_notifications.notifications.models.NotificationChannelModel.validate(NotificationChannelModel.java:286)

Parthakbari15 commented 10 months ago

NotificationChannel( channelKey: 'scheduled_notification', channelName: 'Scheduled scheduled_notification', channelDescription: 'Channel for scheduled notifications', defaultColor: Colors.red, ledColor: Colors.red, playSound: true, soundSource: 'asset://assets/mp3/bellNinjaTune.mp3', enableLights: true, enableVibration: true),

       this is the my Notification channel 
Sebuahhobi commented 10 months ago

@Sebuahhobi did you found some solution ?

No

Sebuahhobi commented 10 months ago

did you resolve the issue ?

No, now i'm use default notification

user-matth commented 8 months ago

did someone find the solution?

ryanheitner commented 7 months ago

Try changing the mp3 file if you look at the github example file and try the power rangers file included in the sample app it works. I had this issue with an mp3 I converted to m4a and it was fine