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
710 stars 823 forks source link

Landscape overflow issue #558

Open Gurvinder963 opened 3 years ago

Gurvinder963 commented 3 years ago

I am using youtube player iframe . its working well on tapping full screen button . but when i rotate the device video screen overflow , its cuts from bottom and top .

applicationsweb commented 3 years ago

Same issue, follow

Lootwig commented 2 years ago

In another similar issue, the problem is fixed by wrapping the Scaffold in a YoutubePlayerBuilder

Gurvinder963 commented 2 years ago

@Lootwig have u own tried it?

charleston10 commented 1 year ago

I solve the problem rendering only VideoPlayer when isFullScreen mode

....
@override
  Widget build(BuildContext context) {
    if (isFullScreen) {
      return _buildPlayer();
    }

    return Scaffold(
      appBar: AppBar(
        elevation: 2,
        backgroundColor: Theme.of(context).scaffoldBackgroundColor,
        title: Text(widget.video.title, style: TextStyle(color: Colors.black87)),
        leading: IconButton(
          icon: Icon(
            Icons.close,
            color: Colors.black87,
          ),
          onPressed: () {
            Navigator.pop(context);
          },
        ),
      ),
      body: Container(
        child: Column(
          children: [_buildPlayer(), _buildControls(), _buildDetails()],
        ),
      ),
    );
  }
  ...

  Widget _buildPlayer() {
    return YoutubePlayerBuilder(
        onEnterFullScreen: () {
          setState(() {
            isFullScreen = true;
          });
        },
        onExitFullScreen: () {
          setState(() {
            isFullScreen = false;
          });
        },
        player: YoutubePlayer(
          controller: _controller,
        ),
        builder: (context, player) {
          return player;
        });
  }