2

I'm new with flutter and currently using better_player: ^0.0.81 package.

Is there anyway to stop the video using a controller? Here is my code below

late BetterPlayerController _betterPlayerController;

Function

_betterPlayerController = BetterPlayerController(
  const BetterPlayerConfiguration(
    autoPlay: true,
    fit: BoxFit.contain,
    controlsConfiguration: BetterPlayerControlsConfiguration(
      enableOverflowMenu: false,
      showControlsOnInitialize: false,
      enableRetry: true,
      showControls: true,
    ),
  ),
  betterPlayerDataSource: BetterPlayerDataSource.file(videoPath),
);

Widget

  AspectRatio(
       aspectRatio: 16 / 9,
       child: BetterPlayer(
                controller: _betterPlayerController,
       ),
   )
Koala
  • 352
  • 2
  • 7
  • 18

1 Answers1

0

If you mean pause and play, then just call it by using the controller.

eg: _betterPlayerController.pause();  or  _betterPlayerController.play();
Aswanath C K
  • 171
  • 11