sarbagyastha / youtube_player_flutter

A Flutter plugin for inline playback or streaming of YouTube videos using the official iFrame Player API.
https://youtube.sarbagyastha.com.np
BSD 3-Clause "New" or "Revised" License
712 stars 826 forks source link

[BUG] Lack of SafeArea when video is in full screen #812

Open keithcwk opened 1 year ago

keithcwk commented 1 year ago

@sarbagyastha Hope you can look into this issue

Describe the bug A SafeArea widget should be used when the video is played in fullscreen, especially portrait videos. Attached some screenshots in the sections below to illustrate the issue. To resolve this, I would suggest wrapping the YoutubePlayer widget with a SafeArea widget when the player is in full screen

One thing to note however, is that, we might want to change the SafeArea params of left and right to be false, so that it does not compress the video at the sides when the video is played fullscreen horizontally

youtube_player.dart

 @override
  Widget build(BuildContext context) {
    Widget player = WebViewWidget(
      controller: _controller.webViewController,
      gestureRecognizers: widget.gestureRecognizers,
    );

    if (widget.enableFullScreenOnVerticalDrag) {
      player = GestureDetector(
        onVerticalDragUpdate: _fullscreenGesture,
        // suggested change here
        child: SafeArea(left: false, right : false, player),
      );
    }

    return OrientationBuilder(
      builder: (context, orientation) {
        return AspectRatio(
          aspectRatio: orientation == Orientation.landscape
              ? MediaQuery.of(context).size.aspectRatio
              : widget.aspectRatio,
          child: player,
        );
      },
    );
  }

To Reproduce

Expected behavior

Screenshots Without SafeArea With SafeArea
SafeArea with left and right true SafeArea with left and right false

Technical Details:

Additional context Add any other context about the problem here.

Sovann72 commented 1 year ago

hope this will get update!

motasimfuad commented 1 year ago

@sarbagyastha any update on this?

hasnainelahi commented 1 year ago

any update on this?

Jeffrey-R commented 8 months ago

Is there a reason to not apply a SafeArea wrapper yourself? It seems that some folks would want a true full screen mode.

ConnorDykes commented 3 months ago

If anyone needs a solution to this I adjusted the aspect ratio of the player and it made the video more visible return YoutubePlayerBuilder( player: YoutubePlayer( aspectRatio: 21 / 9, controller: _controller, ), builder: (context, player) {