muslimtv / flutter_playout

AV Playout in Flutter
BSD 3-Clause "New" or "Revised" License
154 stars 93 forks source link

After tapping the audio play button my android app crashed. #14

Closed hemadri-divii closed 4 years ago

Batres35 commented 4 years ago

The same issue for me, any solution?

KhuramKhalid commented 4 years ago

Can you share some logs from the device? What's the exception you're seeing?

vvasc commented 4 years ago

Same problem here, on iOS works fine, but when I try on Android phones the app crashes. This may happens because I'm using an .m3u to listen audio.

vvasc commented 4 years ago

I test with .m3u8 and same problem occur

KhuramKhalid commented 4 years ago

What's the exception you see?

KhuramKhalid commented 4 years ago

One reason for an app crash could be that the notification icon (ic_notification_icon) isn't setup for Android project. That definitely causes apps to crash on Android.

vvasc commented 4 years ago

@KhuramKhalid Even with ic_notification_icon the app crash. In example provided in package the same problem occur on Android. Could you provide an example to solve that?

I'm using to configure my notification_icon in Android Manifest:

         <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/ic_notification_icon"/>

Thank you for fast answer and to maintain this repo

KhuramKhalid commented 4 years ago

That config looks good so notification icon isn't an issue. Would it be possible for you to share your m3u8 url? We're using this player with our video on demand app which also includes live streaming and all assets are HLS (m3u8) and they all work fine. So not sure what the issue is. Will have to dig deeper. Also if possible, please share device logs from Android Studio when the app crashes.

vvasc commented 4 years ago

My url is https://s18.maxcast.com.br:8010/autodj.m3u

vvasc commented 4 years ago

Using an external Android device I've a strange behaviour, without crash, but also without the audio playing and override error function i got:

"MEDIA_ERROR_UNKNOWN: Unspecified media player error"

With iOS, using emulator or external devices everything works properly

KhuramKhalid commented 4 years ago

My url is https://s18.maxcast.com.br:8010/autodj.m3u

Sorry I wasn't able to look at it earlier and now it seems the service is offline. Please let me know when it's up and I'll have a look.

KhuramKhalid commented 4 years ago

Ok so I was able to play it with the sample app. Firstly use this url https://s18.maxcast.com.br:8010/autodj instead of .m3u. Secondly, it take about 30 seconds after pressing play button for the audio to start. Not sure why that delay is, probably some config issue on server side.

vvasc commented 4 years ago

@KhuramKhalid Thank you for help me, it work now and I'll look my server

KhuramKhalid commented 4 years ago

@vvasc you've welcome. @hemadri-divii @Batres35 are you still having this issue?

Batres35 commented 4 years ago

One reason for an app crash could be that the notification icon (ic_notification_icon) isn't setup for Android project. That definitely causes apps to crash on Android.

i'm gonna try this and then i tell you, thanks for your answer.

Batres35 commented 4 years ago

When i play the audio the app crashes and i get this error on Android Studio:

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.app.app, PID: 26629 java.lang.IllegalArgumentException: Invalid notification (no valid small icon): Notification(channel=NotificationBarController pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x0 color=0x00000000 category=transport actions=1 number=0 vis=PUBLIC semFlags=0x0 semPriority=0 semMissedCount=0) at android.app.NotificationManager.notifyAsUser(NotificationManager.java:333) at android.app.NotificationManager.notify(NotificationManager.java:297) at android.app.NotificationManager.notify(NotificationManager.java:281) at tv.mta.flutter_playout.audio.AudioServiceBinder.updateNotification(AudioServiceBinder.java:551) at tv.mta.flutter_playout.audio.AudioServiceBinder.updatePlaybackState(AudioServiceBinder.java:496) at tv.mta.flutter_playout.audio.AudioServiceBinder.onPrepared(AudioServiceBinder.java:322) at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:4120) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:7000) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

I've set this value in AndroidManifest.xml but it still without work:

meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_launcher"

I'm using the package "flutter_launcher_icons: ^0.7.4" for generate the icons of my app, can this be the problem?

Captura de Pantalla 2020-02-18 a la(s) 12 46 17

KhuramKhalid commented 4 years ago

When i play the audio the app crashes and i get this error on Android Studio:

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.app.app, PID: 26629 java.lang.IllegalArgumentException: Invalid notification (no valid small icon): Notification(channel=NotificationBarController pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x0 color=0x00000000 category=transport actions=1 number=0 vis=PUBLIC semFlags=0x0 semPriority=0 semMissedCount=0) at android.app.NotificationManager.notifyAsUser(NotificationManager.java:333) at android.app.NotificationManager.notify(NotificationManager.java:297) at android.app.NotificationManager.notify(NotificationManager.java:281) at tv.mta.flutter_playout.audio.AudioServiceBinder.updateNotification(AudioServiceBinder.java:551) at tv.mta.flutter_playout.audio.AudioServiceBinder.updatePlaybackState(AudioServiceBinder.java:496) at tv.mta.flutter_playout.audio.AudioServiceBinder.onPrepared(AudioServiceBinder.java:322) at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:4120) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:7000) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

I've set this value in AndroidManifest.xml but it still without work:

meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_launcher"

I'm using the package "flutter_launcher_icons: ^0.7.4" for generate the icons of my app, can this be the problem?

Captura de Pantalla 2020-02-18 a la(s) 12 46 17

Yes so the issue here is definitely the icon. What you can do is just manually create a notification icon and call it ic_notification_icon. That should resolve the issue.

Batres35 commented 4 years ago

When i play the audio the app crashes and i get this error on Android Studio:

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.app.app, PID: 26629 java.lang.IllegalArgumentException: Invalid notification (no valid small icon): Notification(channel=NotificationBarController pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x0 color=0x00000000 category=transport actions=1 number=0 vis=PUBLIC semFlags=0x0 semPriority=0 semMissedCount=0) at android.app.NotificationManager.notifyAsUser(NotificationManager.java:333) at android.app.NotificationManager.notify(NotificationManager.java:297) at android.app.NotificationManager.notify(NotificationManager.java:281) at tv.mta.flutter_playout.audio.AudioServiceBinder.updateNotification(AudioServiceBinder.java:551) at tv.mta.flutter_playout.audio.AudioServiceBinder.updatePlaybackState(AudioServiceBinder.java:496) at tv.mta.flutter_playout.audio.AudioServiceBinder.onPrepared(AudioServiceBinder.java:322) at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:4120) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:7000) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

I've set this value in AndroidManifest.xml but it still without work:

meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_launcher"

I'm using the package "flutter_launcher_icons: ^0.7.4" for generate the icons of my app, can this be the problem? Captura de Pantalla 2020-02-18 a la(s) 12 46 17

Yes so the issue here is definitely the icon. What you can do is just manually create a notification icon and call it ic_notification_icon. That should resolve the issue.

Yeah, thats was the problem, thanks a lot!