solid-software / flutter_vlc_player

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

Resume stream after deep sleep (Flutter/iOS) #349

Open Juwei80 opened 2 years ago

Juwei80 commented 2 years ago

Hi all, does anyone have a solution to resume the live network stream when resuming the app (iOS) after a certain time? It seems after around 40 seconds the app gets moved in a deep sleep mode when not in use.

Actually I implement the controller, which just start when opening the app like:

  @override
  void initState() {
    super.initState();

    _videoPlayerController = VlcPlayerController.network(
      "rtsp://192.168.x.x/12",
      autoPlay: true,
      options: VlcPlayerOptions(),
    );
  }

and adding the player in my scaffold:

VlcPlayer(
                  controller: _videoPlayerController,
                  aspectRatio: 16 / 9,
                  placeholder: const Center(child: CircularProgressIndicator()),
                )

When homing the device and get back to the app after a view seconds, the stream proceeds to play.

If I wait much longer, a minute or so, the stream will stall and not continue.

Does anyone got an idea on how to fix that?

Best regards, Juergen

pinpong commented 1 year ago

I think the one of the problem is that a default life cycle observer is initialized.

I would suggest to leave that handling by the devs are using this lib @illia-romanenko In my case i show a rtsp and i won't pause the stream, i wan't stop it. If the stream is paused for a long time playing the stream again is not working.

pinpong commented 1 year ago

https://github.com/solid-software/flutter_vlc_player/pull/397