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

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

Open fozlerabbi321 opened 4 months ago

fozlerabbi321 commented 4 months 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 4 months 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 4 months ago

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

OokanNumber1 commented 3 months ago

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

wagnerfs7 commented 3 months 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 3 months 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 3 months 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

harmeet-sidhu commented 2 months ago

Is there any solution to this problem besides using other packages?

pedraohenrique commented 2 months ago

+1

pedraohenrique commented 2 months ago

Ok guys, I was able to work this out by upgrading betterplayer from exoplayer2 to media3 ui. It wasn't that easy. I'm thinking of push a PR as soon as I get the Google Play thumbs up.

mthanhha commented 4 weeks ago

Is there any solution to this problem besides using other packages?

+1

Raj-impetrosys commented 3 weeks ago

E/AndroidRuntime(18862): FATAL EXCEPTION: main E/AndroidRuntime(18862): Process: com.soundchatradio.broadlink, PID: 18862 E/AndroidRuntime(18862): java.lang.SecurityException: com.soundchatradio.broadlink: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts E/AndroidRuntime(18862): at android.os.Parcel.createExceptionOrNull(Parcel.java:3087) E/AndroidRuntime(18862): at android.os.Parcel.createException(Parcel.java:3071) E/AndroidRuntime(18862): at android.os.Parcel.readException(Parcel.java:3054) E/AndroidRuntime(18862): at android.os.Parcel.readException(Parcel.java:2996) E/AndroidRuntime(18862): at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:5684) E/AndroidRuntime(18862): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1868) E/AndroidRuntime(18862): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1804) E/AndroidRuntime(18862): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1792) E/AndroidRuntime(18862): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:765) E/AndroidRuntime(18862): at w9.e.A(Unknown Source:40) E/AndroidRuntime(18862): at w9.e.p(Unknown Source:36) E/AndroidRuntime(18862): at w9.e.a(Unknown Source:0) E/AndroidRuntime(18862): at w9.d.handleMessage(Unknown Source:2) E/AndroidRuntime(18862): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime(18862): at android.os.Looper.loopOnce(Looper.java:257) E/AndroidRuntime(18862): at android.os.Looper.loop(Looper.java:368) E/AndroidRuntime(18862): at android.app.ActivityThread.main(ActivityThread.java:8848) E/AndroidRuntime(18862): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(18862): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572) E/AndroidRuntime(18862): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049) E/AndroidRuntime(18862): Caused by: android.os.RemoteException: Remote stack trace: E/AndroidRuntime(18862): at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:14983) E/AndroidRuntime(18862): at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2570) E/AndroidRuntime(18862): at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3034) E/AndroidRuntime(18862): at android.os.Binder.execTransactInternal(Binder.java:1387) E/AndroidRuntime(18862): at android.os.Binder.execTransact(Binder.java:1299) E/AndroidRuntime(18862):

Raj-impetrosys commented 3 weeks ago

Android 14 API 34 getting crashed while start playing video

Screenshot 2024-11-04 at 11 24 46 AM