Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enableFullScreen LateInitializationError #202

Open
yce01 opened this issue May 3, 2024 · 0 comments
Open

enableFullScreen LateInitializationError #202

yce01 opened this issue May 3, 2024 · 0 comments

Comments

@yce01
Copy link

yce01 commented May 3, 2024

I initialized the controller

late final PodPlayerController fullVideoController;

@override void initState() { super.initState(); fullVideoController = PodPlayerController( playVideoFrom: PlayVideoFrom.youtube('https://youtu.be/$url', videoPlayerOptions: VideoPlayerOptions(allowBackgroundPlayback: true)), podPlayerConfig: const PodPlayerConfig( videoQualityPriority: [1080, 720, 360], autoPlay: true, isLooping: true, wakelockEnabled: true, )) ..initialise(); }

and then when I click a button,
I want it to play in full screen.

ElevatedButton( onPressed: () { fullVideoController.enableFullScreen(); }, style: ElevatedButton.styleFrom( backgroundColor: const Color(0xff00A6CC), visualDensity: VisualDensity.compact, padding: const EdgeInsets.symmetric(horizontal: 10), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)), ), child: Text(tr('play_video'), style: const TextStyle(color: Colors.white)), ),

However, this is spitting out a LateInitializationError
I/flutter (27513): ----------------FIREBASE CRASHLYTICS----------------
I/flutter (27513): LateInitializationError: Field 'mainContext' has not been initialized.
I/flutter (27513): #0 _PodBaseController.mainContext (package:pod_player/src/controllers/pod_base_controller.dart)
I/flutter (27513): #1 _PodVideoController._enableFullScreenView (package:pod_player/src/controllers/pod_video_controller.dart:230:9)
I/flutter (27513): #2 _PodVideoController.enableFullScreen (package:pod_player/src/controllers/pod_video_controller.dart:179:7)
I/flutter (27513):
I/flutter (27513): ----------------------------------------------------

How can I solve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant