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
708 stars 820 forks source link

[BUG] Performance issue on Android when using full screen mode #597

Open freewheelnat opened 2 years ago

freewheelnat commented 2 years ago

Describe the bug Performance issue on Android when using full screen mode.

We have observed 3 issues:

To Reproduce Switch between normal mode and full screen mode on Android device several times.

Expected behavior The video is full screen when selecting full screen. The video is showing when exiting full screen

Screenshot BrokenVideoInFullScreen

Technical Details: Issue observed frequently on following devices:

Issue observed rarely on following device:

class _VideoPlayerViewYouTubeImplState extends State { late YoutubePlayerController _controller;

@override void initState() { super.initState(); _controller = YoutubePlayerController( initialVideoId: widget.videoId, params: const YoutubePlayerParams( showFullscreenButton: true, privacyEnhanced: true, strictRelatedVideos: true, useHybridComposition: false, ), ); _controller.onEnterFullscreen = () { SystemChrome.setPreferredOrientations([ DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight, ]); }; }

@override void dispose() { _controller.close(); super.dispose(); }

@override Widget build(BuildContext context) { const player = YoutubePlayerIFrame(gestureRecognizers: {}); return YoutubePlayerControllerProvider( // Passing controller to widgets below. controller: _controller, child: Scaffold( body: Stack( children: [ player, Positioned.fill( child: YoutubeValueBuilder( controller: _controller, builder: (context, value) { if (value.hasError) { return widget.errorView; } else { return AnimatedCrossFade( firstChild: const SizedBox.shrink(), secondChild: widget.loadingView, crossFadeState: value.isReady ? CrossFadeState.showFirst : CrossFadeState.showSecond, duration: const Duration(milliseconds: 300), ); } }, ), ), ], ), ), ); } }

ducNN93 commented 2 years ago

yes this happened on my android device too, enter fullscreen several time then the video player show like the picture below My device : Nokia 7.2 Android: 11

1643218357312

jsanz1209 commented 2 years ago

+1 Same behavior here

alexaung commented 2 years ago

Sam behavior here.