youtube_player_flutter
youtube_player_flutter copied to clipboard
[BUG] Youtube stop playing video when change to Full Screen mode
When i am playing youtube in portrait mode then change it to full screen (landscape) mode, the video get paused instead of continue playing the video.
How To Reproduce
- Play video in portrait mode
- Click full screen button during playing video
- Video stopped
Expected behavior
- Play video in portrait mode
- Click full screen button during playing video
- Video continuing from previous state
+1
+1
It is not a bug really.
Add this to the initialization code:
youtubePlayerController.onEnterFullscreen = () {
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]);
};
youtubePlayerController.onExitFullscreen = () {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
Future.delayed(const Duration(seconds: 1), () {
youtubePlayerController.play();
});
Future.delayed(const Duration(seconds: 5), () {
SystemChrome.setPreferredOrientations(DeviceOrientation.values);
});
};
It is not a bug really.
Add this to the initialization code:
youtubePlayerController.onEnterFullscreen = () { SystemChrome.setPreferredOrientations([ DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight, ]); }; youtubePlayerController.onExitFullscreen = () { SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); Future.delayed(const Duration(seconds: 1), () { youtubePlayerController.play(); }); Future.delayed(const Duration(seconds: 5), () { SystemChrome.setPreferredOrientations(DeviceOrientation.values); }); };
I tried on my end. When enter the full screen mode, video is replayed from the beginning. How could video played from the previous state? Should I add some listener or how could I implement that?
facing the same issue. I am guessing a callback is not being returned properly
Well...
It is not a bug really.
Add this to the initialization code:
youtubePlayerController.onEnterFullscreen = () { SystemChrome.setPreferredOrientations([ DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight, ]); }; youtubePlayerController.onExitFullscreen = () { SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); Future.delayed(const Duration(seconds: 1), () { youtubePlayerController.play(); }); Future.delayed(const Duration(seconds: 5), () { SystemChrome.setPreferredOrientations(DeviceOrientation.values); }); };
You're sure, what isn't bug? Cause i want continue playing video from the same moment when i open full-screen and vice versa.
But if video is canceled and i change my orientation, it's start again.
Not an expected behavior. So?..
Is this fixed yet? Any workaround?
I am facing the same issue.
when i change to landscape the video gets stopped and when i try to play the video, its start from the begining.
its written in the docs
For FullScreen Support
If fullscreen support is required, wrap your player with YoutubePlayerBuilder
YoutubePlayerBuilder(
player: YoutubePlayer(
controller: _controller,
),
builder: (context, player){
return Column(
children: [
// some widgets
player,
//some other widgets
],
);
),
),
I have tried this. it work seamlessly and video keep playing
its written in the docs
For FullScreen Support If fullscreen support is required, wrap your player with YoutubePlayerBuilder YoutubePlayerBuilder( player: YoutubePlayer( controller: _controller, ), builder: (context, player){ return Column( children: [ // some widgets player, //some other widgets ], ); ), ),
I have tried this. it work seamlessly and video keep playing
I am using this and it works when going to full screen, it keeps playing on the same moment. However, when I exit full screen it stops playing, and the controller returns to the initialVideo. Any clue on how to solve this?