flutter_vlc_player icon indicating copy to clipboard operation
flutter_vlc_player copied to clipboard

video doesnt loop

Open realimposter opened this issue 3 years ago • 6 comments

here's the code I'm using for the controller:

vidcontroller = VlcPlayerController.file( (snapshot.data as FileInfo).file, options: VlcPlayerOptions(video: VlcVideoOptions(['--loop'])), onInit: () async {await vidcontroller.setLooping(true);} );

It just plays to the end and then pauses. Am I setting this wrong?

realimposter avatar Mar 19 '21 23:03 realimposter

when you call setLooping method, we set the loop option of vlc. it might be an issue with vlc.

alr2413 avatar Mar 21 '21 10:03 alr2413

Any news on that ? Is there an example to use setLooping method ? When it should be called for vlc to set it correctly.

I use the following code, but it stops at the end of the video, maybe the player just doesn't "see" these settings because it's already initialized differently?:

_videoPlayerController = VlcPlayerController.file(
      file,
      hwAcc: HwAcc.FULL,
      autoPlay: false,
      options: VlcPlayerOptions(),
      onInit: () async {
        await _videoPlayerController.setLooping(true);
        await _videoPlayerController.play();
      },
    );

dariocavada avatar Apr 02 '21 06:04 dariocavada

This is what I've used as a workaround:

  @override
  void initState() {
    super.initState();
   
    var file = File("/localfilename");

    _videoPlayerController = VlcPlayerController.file(
      file,
      hwAcc: HwAcc.FULL,
      autoPlay: true,
      onInit: () async {
        await _videoPlayerController.startRendererScanning();
      },
      options: VlcPlayerOptions(),
    );

    _videoPlayerController.addListener(listener);
  }

  void listener() async {
    if (!mounted) return;
    if (_videoPlayerController.value.isEnded) {
      _videoPlayerController.stop();
      _videoPlayerController.play();
    }
  }

dariocavada avatar Apr 02 '21 09:04 dariocavada

Any updates on the Issue?

AhmedAbouelkher avatar Aug 08 '21 12:08 AhmedAbouelkher

Not Working....

vlcController = VlcPlayerController.network(
  widget.videoUrl,
  hwAcc: HwAcc.FULL,
  autoPlay: true,
  autoInitialize: true,
  options: VlcPlayerOptions(),
);
vlcController.addOnInitListener(initializePlayer);
Future<void> initializePlayer() async {
    vlcController.setLooping(true);
 }

onInit : is depricated in latest version the docs say use addOnInitListener but this way also not working. Anyone got the solution to loop the video.....????

saginbajracharya avatar Oct 08 '21 04:10 saginbajracharya

Yes, both not working.

TennisAndy avatar Jan 21 '22 02:01 TennisAndy