youtube_player_flutter
youtube_player_flutter copied to clipboard
[BUG] full-screen option not working on ios
Describe the bug Hi, The option to toggle full-screen is not working on ios device. As soon as I click on the toggle option nothing happens.
Technical Details:
- Device: iPhone11promax (simulator)
- Flutter version: 1.22.6
- package version: 7.0.0+7
** CODE **
This isthe code for the player wrapper:
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:youtube_player_flutter/youtube_player_flutter.dart';
class PlayYT extends StatefulWidget {
final String ytLink;
const PlayYT(this.ytLink, {Key key}) : super(key: key);
static Route route(String ytLink) {
return CupertinoPageRoute<void>(
builder: (BuildContext _) => PlayYT(ytLink),
);
}
@override
_PlayYTState createState() => _PlayYTState();
}
class _PlayYTState extends State<PlayYT> {
YoutubePlayerController _youtubeController;
@override
void initState() {
super.initState();
_youtubeController = YoutubePlayerController(
initialVideoId: widget.ytLink,
flags: YoutubePlayerFlags(
autoPlay: true,
forceHD: true,
hideControls: false,
hideThumbnail: false,
),
);
}
@override
void dispose() {
_youtubeController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
print('YOOOO');
return _buildContentAndroid;
}
get _buildContentAndroid => WillPopScope(
onWillPop: () {
_youtubeController.pause();
// SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
Navigator.of(context).pop();
return Future<bool>.value(true);
},
child: YoutubePlayerBuilder(
onEnterFullScreen: () {
print('>>>>>onEnterFullScreen called!!');
},
onExitFullScreen: () {
print('>>>>>onFullScreen called!!');
},
player: YoutubePlayer(
controller: _youtubeController,
showVideoProgressIndicator: true,
topActions: <Widget>[
const SizedBox(width: 16.0),
IconButton(
icon: const Icon(
Icons.close,
color: Colors.white,
size: 25.0,
),
onPressed: () {
_youtubeController.pause();
Navigator.of(context).pop();
},
),
const SizedBox(width: 16.0),
Expanded(
child: Text(
_youtubeController.metadata.title,
style: const TextStyle(
color: Colors.white,
fontSize: 18.0,
),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
),
],
onEnded: (data) {
Navigator.of(context).pop();
},
),
builder: (context, player) => Scaffold(
backgroundColor: Colors.black,
body: Center(
child: FittedBox(
fit: BoxFit.fitWidth,
child: player,
),
),
),
),
);
}
Any news?
any news? x2
Same issue running flutter 3.3.4 and 8.1.0 on iOS. It a show stopper..
In my case, the full screen mode was not working because I didn't have the available device orientations correctly configured in Info.plist
You have to edit the UISupportedInterfaceOrientations variable in app -> Runner -> Info.plist
Answer based on https://github.com/flutter/flutter/issues/119473#issuecomment-1415631020