youtube_player_flutter: ^7.0.0+6 not enabling full Screen on iOS

1.8k Views Asked by At

Hello friends i am using youtube plugin youtube_player_flutter: ^7.0.0+6 for playing youtube videos the problem is thats its working fine on android device but on ios device its not enable full sacreen mode i test it on ios real device but not working while on android its working perfect here is my code please check it tell me if any developer can help me ?

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:youtube_player_flutter/youtube_player_flutter.dart';
class Video extends StatefulWidget {

  String  videoURL;
  String  title;
  String des;

  @override
  VideoState createState() => VideoState();

  Video(this.videoURL,this.title,this.des,);
}

class VideoState extends State<Video> {

  YoutubePlayerController _controller;



  @override
  void initState() {
    _controller = YoutubePlayerController(
        initialVideoId: YoutubePlayer.convertUrlToId(widget.videoURL),
        flags:YoutubePlayerFlags(


        )
    );

    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Container(
          child: YoutubePlayerBuilder(
            player: YoutubePlayer(
              controller: _controller,
              aspectRatio: 16 / 9,
              showVideoProgressIndicator: true,
            ),
            builder: (context, player) {
              return Column(
                children: <Widget>[
                  player,
                  SingleChildScrollView(
                    physics: AlwaysScrollableScrollPhysics(),
                    child: Container(
                        child: Padding(
                          padding: EdgeInsets.all(10),
                          child: Column(
                            children: <Widget>[
                              Text(widget.title.toUpperCase(),style: TextStyle(
                                fontFamily: 'TT NORMS',
                                fontSize: 20,
                                fontWeight: FontWeight.w100
                              ),

                              ),
                              Text(widget.des,style: TextStyle(

                              ),

                              )
                            ],
                          ),
                        ),
                    ),
                  ),
                ],
              );
            },
          ),
        ));
  }
}
1

There are 1 best solutions below

0
On

Hi youtube_player_flutter fullscreen doesn't works for ios platform.

You can use youtube_player_iframe (https://pub.dev/packages/youtube_player_iframe)

On your code you can use _iframe if platform.IsIos and _youtube if platform.IsAndroid (it's what I did and it worked for me).

Hope it wil help you