solid-software / flutter_vlc_player

📺 Flutter VLC powered video player.
524 stars 253 forks source link

Player now stops when changing orientation #459

Closed LastxTemplar closed 11 months ago

LastxTemplar commented 11 months ago

Hi, I'm sorry I cannot tell you exactly which Flutter SDK I was previously using, but I have updated Flutter and am currently using the vlc plugin v.7.2.0 with Flutter SDK 3.16.5. I haven't touched the code since I last built my project, but now when I build the project, I noticed that when the orientation changes, the VlcPlayer stops and I am getting lots of these logs:

68 E/FrameEvents( 8260): updateAcquireFence: Did not find frame.

Does anyone know how I could fix this? Or where to even start looking? It seems like it happens because i've update my Flutter SDK, but I also don't want to go back to a previous version.

Thank you!

LastxTemplar commented 11 months ago

I found the issue in my case, seems like in the newer flutter version the Lifecycle Change is being called when the device changes orientation:

@override
  didChangeAppLifecycleState(AppLifecycleState state) async {
    inspect(state);
    super.didChangeAppLifecycleState(state);

    await videoPlayerController.value?.pause();
  }

I had the above code, which would pause the player if the app was minimised, this seems to be called now every time you rotate the screen.

I'll leave this here in case it helps anyone else.