jhomlala / betterplayer

Better video player for Flutter, with multiple configuration options. Solving typical use cases!
Apache License 2.0
932 stars 1.04k forks source link

Fixes for android notification #1198

Open geriby23 opened 1 year ago

geriby23 commented 1 year ago

We had an issue, where click on push notification in better player was not working, and app was not opened after click on notification. The reason for it was that we have flavors for the app(qa, uat, dev, prod) So package in our case has sufixes. Also another issue why it was not working in our app, was because we have different packages in src folder and gradle file. It's because project previously was written on android and than it was changed to flutter. So we had to have old package to be able to replace old project. So in this fork, I have added packageName field to the NotificationsConfig. So for example:

notificationConfiguration: BetterPlayerNotificationConfiguration( showNotification: true, title: widget.title, imageUrl: widget.logoUrl, packageName: locator().packageName, <-- here we will specify what package we have currently, for example: com.something.qa or com.something.uat activityName: "io.example.something.MainActivity", <- so now we should place full path to the mainActivity file. ),

  I think it would be more flexible for users to specify packages they need.

  Also we have spotted a crash in  method_channel_video_player.dart in MethodChannelVideoPlayer.getAbsolutePosition at line 222:21 within better_player
  For live stream it was throwing sometimes exception:
  RangeError (millisecondsSinceEpoch): Invalid value: Not in inclusive range -8640000000000000..8640000000000000: 9223372036854774434

  This was handled as well in this fork.