chewie icon indicating copy to clipboard operation
chewie copied to clipboard

How to use chewie package in miniplayer package

Open AhmadFalahian opened this issue 3 years ago • 1 comments

I have designed a video player that uses the chewie and miniplayer package When I try to zoom out, the movie stops playing, and when the page reopens, I get the message A ChewieController was used after being disposed. Of course, this is when I use the SizedBox widget above my video player My code is as follows:

class MiniPlayerWidget extends StatelessWidget {
  final MiniPlayerCtl miniPlayerCtl =
      Get.find<MiniPlayerCtl>(tag: Controllers.MiniPlayer);
  VideoPlayer? videoPlayer;

  MiniPlayerWidget({Key? key}) : super(key: key) {
    videoPlayer = VideoPlayer(
      url: miniPlayerCtl.url!,
      videoController: miniPlayerCtl.videoCtl,
    );
  }

  @override
  Widget build(BuildContext context) {
    return MiniplayerWillPopScope(
      onWillPop: () async {
        Get.back();
        return false;
      },
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Miniplayer(
            backgroundColor: Colors.black,
            valueNotifier: miniPlayerCtl.playerExpandProgress,
            minHeight: miniPlayerCtl.playerMinHeight,
            maxHeight: miniPlayerCtl.playerMaxHeight,
            controller: miniPlayerCtl.miniPlayerController,
            elevation: 4,
            curve: Curves.easeOut,
            builder: (height, percentage) {
              final bool isMini =
                  percentage < miniPlayerCtl.miniPlayerPercentageDeclaration;

              if (!isMini) {
                return videoPlayer!;
              }
              return SizedBox(width: 150,child: videoPlayer!);
            },
          ),
        ],
      ),
    );
  }
}

AhmadFalahian avatar May 21 '22 10:05 AhmadFalahian

@AhmadFalahian please provide a reproducible example project so that I may review and better diagnose this issue. Thanks.

This code needs to be changed to run it without using Get.

maherjaafar avatar Sep 04 '22 12:09 maherjaafar