title: How to minimize Full Screen Flutter Youtube Player on mobile back button press?
body: <p>When the flutter youtube player is full screen, and i pressing back button of mobile i want to minimize the youtube player so how can i do this?</p>
  <p>My Flutter Youtube Player code as below.</p>
  <pre><code>class _VideoPlayerState extends State&lt;VideoPlayer&gt; {
    late YoutubePlayerController _youtubePlayerController;
    late bool _isPlayerReady;
  
    @override
    void initState() {
      super.initState();
      _isPlayerReady = false;
      var url = widget.video.url;
      var videoUrl = YoutubePlayer.convertUrlToId(url!);
      _youtubePlayerController = YoutubePlayerController(
        initialVideoId: videoUrl!,
        flags: YoutubePlayerFlags(
          autoPlay: false,
          mute: false,
          disableDragSeek: false,
          loop: false,
          isLive: false,
          forceHD: false,
          hideControls: false,
        ),
      )..addListener(_listener);
    }
  
    void _listener() {
      if (_isPlayerReady &amp;&amp;
          mounted &amp;&amp;
          !_youtubePlayerController.value.isFullScreen) {}
    }
  
    @override
    void dispose() {
      _youtubePlayerController.dispose();
      SystemChrome.setPreferredOrientations([
        DeviceOrientation.portraitUp,
        DeviceOrientation.portraitDown,
        DeviceOrientation.landscapeLeft,
        DeviceOrientation.landscapeRight,
      ]);
      super.dispose();
    }
  
    @override
    Widget build(BuildContext context) {
      return Container(
        child: YoutubePlayer(
          controller: _youtubePlayerController,
          aspectRatio: 16 / 9,
          showVideoProgressIndicator: true,
          onReady: () {
            _isPlayerReady = true;
          },
        ),
      );
    }
  }
  </code></pre>
  <p>But when i pressed back button my app screen looks like as below.
  <a href="https://i.stack.imgur.com/oA1A7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oA1A7.jpg" alt="enter image description here" /></a></p>
  <p>so here i want to minimize youtube player when back button is pressed.</p>
  <p>First my app orientation in portrait then i play videos in full screen then pressed back button my app orientation is in landscape.</p>
  <p>So i want to just minimize the youtube player on back button press.</p>