Open freewheelnat opened 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
Technical Details: Issue observed frequently on following devices:
Issue observed rarely on following device:
Xiaomi Mi 10T, Android 10
Code youtube_player_iframe: ^2.2.2
class VideoPlayerViewYouTubeImpl extends StatefulWidget { const VideoPlayerViewYouTubeImpl({ Key? key, required this.videoId, required this.errorView, required this.loadingView, }) : super(key: key); final String videoId; final Widget errorView; final Widget loadingView; @override _VideoPlayerViewYouTubeImplState createState() => _VideoPlayerViewYouTubeImplState(); }
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), ); } }, ), ), ], ), ), ); } }
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
+1 Same behavior here
Sam behavior here.
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
Technical Details: Issue observed frequently on following devices:
Issue observed rarely on following device:
Xiaomi Mi 10T, Android 10
Code youtube_player_iframe: ^2.2.2
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), ); } }, ), ), ], ), ), ); } }