fluttercommunity / chewie

The video player for Flutter with a heart of gold
MIT License
1.93k stars 990 forks source link

Zoom not working in fullscreen #811

Open EpiSayLaCata opened 7 months ago

EpiSayLaCata commented 7 months ago

Hello there,

I'm using chewie for my video player and I run into a problem and it's to not be able to zoom in fullscreen.

Here is the code :

Future<void> _initController() async {
    // We get the file from the cache.
    final file = await _cacheManager.getSingleFile(mediaUrl);

    // We create the video player controller.
    _controller = VideoPlayerController.file(
      file,
      videoPlayerOptions: VideoPlayerOptions(
        mixWithOthers: true,
      ),
    )..addListener(_controllerListener);
    final controller = _controller;

    if (controller != null) {
      await controller.initialize();
      _chewieController = ChewieController(
        allowedScreenSleep: false,
        allowMuting: false,
        allowPlaybackSpeedChanging: false,
        aspectRatio: 4 / 3,
        autoInitialize: true,
        autoPlay: true,
        deviceOrientationsAfterFullScreen: [
          DeviceOrientation.portraitUp,
        ],
        deviceOrientationsOnEnterFullScreen: [
          DeviceOrientation.portraitUp,
          DeviceOrientation.landscapeLeft,
          DeviceOrientation.landscapeRight,
        ],
        hideControlsTimer: const Duration(seconds: 2),
        looping: true,
        maxScale: 4.0,
        showControlsOnInitialize: false,
        showOptions: false,
        showControls: widget.mediaControls,
        videoPlayerController: controller,
        // zoomAndPan: true, NOT WORKING 
      );
    }
}

And here is how I do the zoom :

return _AspectRatio(
    child: chewieController != null &&
            chewieController.videoPlayerController.value.isInitialized
        ? InteractiveViewer(
            minScale: 0.5,
            maxScale: 4.0,
            child: Chewie(
              controller: chewieController,
            ),
          )
        : const Center(
            child: InfiniteSpinner(),
          ),
  );

i'm not sure if it's meant to be done like that but the zoomAndPan is not working at all inside the ChewieController.

Is there something I've done wrong or do you know something about it ?

Thank you,

maherjaafar commented 7 months ago

Which Platform. iOS, Android or both?

EpiSayLaCata commented 7 months ago

Both