flutter_vlc_player
flutter_vlc_player copied to clipboard
Unhandled Exception: LateInitializationError: Field '_viewId@862035241' has not been initialized. E/flutter (23559): #0 VlcPlayerController._viewId (package:flutter_vlc_player/src/vlc_player_controller.dar
I am trying load durations videos for which I am fetching http url stored in firebase database inside Listview.builder but facing this issue, I have tried accessing vlcplayervalue wherein isIntialized says false, I am not able to why playingstate still says initializing
This is my code:-
class VideoTitles extends StatefulWidget { const VideoTitles({ Key? key, required this.url, required this.title, }) : super(key: key); final String url; final String title;
@override State<VideoTitles> createState() => _VideoTitlesState(); }
class _VideoTitlesState extends State<VideoTitles> { VlcPlayerController? _videoPlayerController;
@override void initState() { super.initState(); _videoPlayerController = VlcPlayerController.network( widget.url, ); }
@override void dispose() async { super.dispose(); await _videoPlayerController!.dispose(); }
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: _videoPlayerController!.initialize(),
builder: (BuildContext context, AsyncSnapshot
I get the same error when i try to initialize a VlcPlayerController
Me too, it only works with autoInitialize: true
In order to initialize the video Controller, first the Video Widget must be built with the controller along with dataSource. if u try to call initialize method in FutureBuilder since the Video widget is not built yet u will get an error. Solution 1. Remove FutureBuilder directly provide the controller to the video widget after setting URL (DataSource) to the controller in initState and setting the autoInitialize to true. Solution 2. Set autoInitialize to false during controller initialization in initState and call the controller.initialize after the build method is built(use WidgetsBinding.instance.addPostFrameCallback to wait for build method to complete then wait for half sec then call controller.initialize method)
Almost a year & a month and no solution ??