jhomlala / betterplayer

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

[Android 14 devices, when video start then App exit] #1316

Open fozlerabbi321 opened 1 month ago

fozlerabbi321 commented 1 month ago

History check Yes

Describe the bug This issue facing enable notification.

*Example code

BetterPlayerDataSource dataSource = BetterPlayerDataSource.network(
      widget.videoLink ?? '',
      videoFormat: BetterPlayerVideoFormat.hls,
      notificationConfiguration: const BetterPlayerNotificationConfiguration(
        showNotification: true,
        title: "Flutter App",
        author: "Some author",
        activityName: "MainActivity",
        imageUrl:"https://img.freepik.com/free-photo/painting-mountain-lake-with-mountain-background_188544-9126.jpg",
      ),
      cacheConfiguration: widget.liveStream ? null : const BetterPlayerCacheConfiguration(
        useCache: true,
        preCacheSize: 10 * 1024 * 1024,
        maxCacheSize: 10 * 1024 * 1024,
        maxCacheFileSize: 10 * 1024 * 1024,
        key: "testCacheKey",
      ),
      useAsmsTracks: true,
    );

Better Player version

Smartphone (please complete the following information):

E/AndroidRuntime(22497): java.lang.SecurityException: com.mahfil.app: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts E/AndroidRuntime(22497): at android.os.Parcel.createExceptionOrNull(Parcel.java:3057) E/AndroidRuntime(22497): at android.os.Parcel.createException(Parcel.java:3041) E/AndroidRuntime(22497): at android.os.Parcel.readException(Parcel.java:3024) E/AndroidRuntime(22497): at android.os.Parcel.readException(Parcel.java:2966) E/AndroidRuntime(22497): at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:5684) E/AndroidRuntime(22497): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1852) E/AndroidRuntime(22497): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1792) E/AndroidRuntime(22497): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1780) E/AndroidRuntime(22497): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:755) E/AndroidRuntime(22497): at com.google.android.exoplayer2.ui.PlayerNotificationManager.startOrUpdateNotification(PlayerNotificationManager.java:1165) E/AndroidRuntime(22497): at com.google.android.exoplayer2.ui.PlayerNotificationManager.handleMessage(PlayerNotificationManager.java:1415) E/AndroidRuntime(22497): at com.google.android.exoplayer2.ui.PlayerNotificationManager.$r8$lambda$hDN6RMWHvTCSAt_reWH1_HHmp5E(Unknown Source:0) E/AndroidRuntime(22497): at com.google.android.exoplayer2.ui.PlayerNotificationManager$$ExternalSyntheticLambda0.handleMessage(Unknown Source:2) E/AndroidRuntime(22497): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime(22497): at android.os.Looper.loopOnce(Looper.java:205) E/AndroidRuntime(22497): at android.os.Looper.loop(Looper.java:294) E/AndroidRuntime(22497): at android.app.ActivityThread.main(ActivityThread.java:8177) E/AndroidRuntime(22497): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(22497): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) E/AndroidRuntime(22497): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971) E/AndroidRuntime(22497): Caused by: android.os.RemoteException: Remote stack trace: E/AndroidRuntime(22497): at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:13927) E/AndroidRuntime(22497): at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2570) E/AndroidRuntime(22497): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2720) E/AndroidRuntime(22497): at android.os.Binder.execTransactInternal(Binder.java:1339) E/AndroidRuntime(22497): at android.os.Binder.execTransact(Binder.java:1275

isamuhiro commented 1 month ago

This behaviour started to appeer after I move the targetSdkVersion from 33 to 34. This change is required to upload apps to PlayStore.

fozlerabbi321 commented 1 month ago

I have currently resolved the issue by using the better_player_plus package.

OokanNumber1 commented 1 month ago

@isamuhiro it's a ForegroundService issue with API Level 34. You can check this for more insight.

wagnerfs7 commented 1 month ago

fozlerabbi321

@fozlerabbi321, could you tell me how your build.gradle and settings.gradle are doing? I'm using the latest version of Flutter, 3.24.0. I tried with 3.19.5, and I couldn't get it to work using better_player_plus. Testing on Samsung M10. (better_player_plus: ^1.0.7)

wagnerfs7 commented 1 month ago

fozlerabbi321

@fozlerabbi321, could you tell me how your build.gradle and settings.gradle are doing? I'm using the latest version of Flutter, 3.24.0. I tried with 3.19.5, and I couldn't get it to work using better_player_plus. Testing on Samsung M10. (better_player_plus: ^1.0.7)

Flutter 3.24.0 • Dart 3.5.0 better_player: ^0.0.84 Tested on Samsung M10 and Moto e play devices Worked correctly, but not Android 14. Information only.

wagnerfs7 commented 1 month ago

Flutter 3.24.0 • Dart 3.5.0 better_player: ^0.0.84 Tested devices: Samsung M10, Moto e play and Pixel 8 Pro (with Android 14 - Emulator) Worked correctly

image

Use gradle-8.8-all.zip