betterplayer icon indicating copy to clipboard operation
betterplayer copied to clipboard

[BUG] Incompatible with video_player: ^2.4.5

Open mdpe-ir opened this issue 2 years ago • 7 comments

After updating project dependencies. BettetPlayer doesn't work anymore.

I/ExoPlayerImpl( 7316): Init f6c2363 [ExoPlayerLib/2.18.0] [generic_x86_arm, sdk_gphone_x86, Google, 30]
E/MethodChannel#better_player_channel( 7316): Failed to handle method call
E/MethodChannel#better_player_channel( 7316): java.lang.NullPointerException: MediaSource.Factory#setDrmSessionManagerProvider no longer handles null by instantiating a new DefaultDrmSessionManagerProvider. Explicitly construct and pass an instance in order to retain the old behavior.
E/MethodChannel#better_player_channel( 7316): 	at com.google.android.exoplayer2.util.Assertions.checkNotNull(Assertions.java:174)
E/MethodChannel#better_player_channel( 7316): 	at com.google.android.exoplayer2.source.hls.HlsMediaSource$Factory.setDrmSessionManagerProvider(HlsMediaSource.java:296)
E/MethodChannel#better_player_channel( 7316): 	at com.jhomlala.better_player.BetterPlayer.buildMediaSource(BetterPlayer.kt:424)
E/MethodChannel#better_player_channel( 7316): 	at com.jhomlala.better_player.BetterPlayer.setDataSource(BetterPlayer.kt:196)
E/MethodChannel#better_player_channel( 7316): 	at com.jhomlala.better_player.BetterPlayerPlugin.setDataSource(BetterPlayerPlugin.kt:277)
E/MethodChannel#better_player_channel( 7316): 	at com.jhomlala.better_player.BetterPlayerPlugin.onMethodCall(BetterPlayerPlugin.kt:151)
E/MethodChannel#better_player_channel( 7316): 	at com.jhomlala.better_player.BetterPlayerPlugin.onMethodCall(BetterPlayerPlugin.kt:138)
E/MethodChannel#better_player_channel( 7316): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/MethodChannel#better_player_channel( 7316): 	at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#better_player_channel( 7316): 	at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/MethodChannel#better_player_channel( 7316): 	at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#better_player_channel( 7316): 	at android.os.Handler.handleCallback(Handler.java:938)
E/MethodChannel#better_player_channel( 7316): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#better_player_channel( 7316): 	at android.os.Looper.loop(Looper.java:223)
E/MethodChannel#better_player_channel( 7316): 	at android.app.ActivityThread.main(ActivityThread.java:7656)
E/MethodChannel#better_player_channel( 7316): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#better_player_channel( 7316): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/MethodChannel#better_player_channel( 7316): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Flutter Version : 3.0.5 Test on: Emulator Android 12 x86_64 and Samsung A5 Android 8

mdpe-ir avatar Jul 23 '22 11:07 mdpe-ir

After debugging, I realized that this is because of the ExoPlayer version

https://github.com/flutter/plugins/blob/main/packages/video_player/video_player_android/android/build.gradle#L46

mdpe-ir avatar Jul 23 '22 12:07 mdpe-ir

Just happened to me too. @jhomlala Please update exoplayer version :)

naamapps avatar Jul 23 '22 13:07 naamapps

Also experiencing the same issue... Is there a fix?

tuvia avatar Jul 24 '22 03:07 tuvia

Also experiencing the same issue... Is there a fix?

I temporarily solved it with this method:

  • change video player version to => video_player: ^2.4.4
  • edit pubspec.lock and make this changes =>
  video_player:
    dependency: "direct main"
    description:
      name: video_player
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.4.4"
  video_player_android:
    dependency: transitive
    description:
      name: video_player_android
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.3.7"
  video_player_avfoundation:
    dependency: transitive
    description:
      name: video_player_avfoundation
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.3.5"
  video_player_platform_interface:
    dependency: transitive
    description:
      name: video_player_platform_interface
      url: "https://pub.dartlang.org"
    source: hosted
    version: "5.1.3"
  video_player_web:
    dependency: transitive
    description:
      name: video_player_web
      url: "https://pub.dartlang.org"
    source: hosted
    version: "2.0.12"

mdpe-ir avatar Jul 24 '22 10:07 mdpe-ir

Same here

juzejunior avatar Jul 28 '22 15:07 juzejunior

Here is a PR for the issue: https://github.com/jhomlala/betterplayer/pull/1059

matthewrice345 avatar Jul 29 '22 16:07 matthewrice345

Here is a PR for the issue: #1059

that's solved the problem thank you @matthewrice345

kingyyy avatar Jul 30 '22 01:07 kingyyy

Still present bug, but @matthewrice345 saved the day, thanks !

tomekit avatar Jan 25 '23 19:01 tomekit

@jhomlala any chance this can be merged?

JonasJW avatar Feb 07 '23 19:02 JonasJW

This is how I solved it. Just put in your pubspec.yaml

better_player: git: url: https://github.com/tintran-dev/betterplayer.git video_player: any

Regards!

On Tue, Feb 7, 2023, 4:39 PM JonasJW @.***> wrote:

@jhomlala https://github.com/jhomlala any chance this can be merged?

— Reply to this email directly, view it on GitHub https://github.com/jhomlala/betterplayer/issues/1057#issuecomment-1421342379, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABALFG2C3OCDHMFJGU5EZSLWWKQGLANCNFSM54N4QKOA . You are receiving this because you commented.Message ID: @.***>

tuvia avatar Feb 07 '23 23:02 tuvia

@tuvia what are the differences to @matthewrice345 PR?

JonasJW avatar Feb 08 '23 08:02 JonasJW

I'm not really sure... Googling for a solution just found this and thought it could be useful for other people.

Thank you so much for your efforts in making betterplayer!

On Wed, Feb 8, 2023, 5:37 AM JonasJW @.***> wrote:

@tuvia https://github.com/tuvia what are the differences to @matthewrice345 https://github.com/matthewrice345 PR?

— Reply to this email directly, view it on GitHub https://github.com/jhomlala/betterplayer/issues/1057#issuecomment-1422226346, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABALFG3FNARZATBELSCNJ23WWNLLHANCNFSM54N4QKOA . You are receiving this because you were mentioned.Message ID: @.***>

tuvia avatar Feb 08 '23 16:02 tuvia