Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to display the video after selecting it with the help of an image picker.

videoscreen:
List<File> _video = [];
  @override
  Widget build(BuildContext context) {
    return Scaffold(

      body: Column(children: [
        ElevatedButton(
            onPressed: () {
              chooseVideo();
              print(_video);
            },
            child: const Text(
              'choose',
              style: TextStyle(color: Colors.black),
            )),
        Expanded(
          child: ListView.builder(
              shrinkWrap: true,
              itemCount: _video.length,
              itemBuilder: (ctx, index) {
                INvideoPlayerController =
                    VideoPlayerController.file(_video[index])
                      ..setLooping(true)
                      ..initialize()
                          .then((value) => INvideoPlayerController!.play());
                print(_video);
                return _video.isEmpty
                    ? Container()
                    :
                    

                    AspectRatio(
                        aspectRatio: INvideoPlayerController!.value.aspectRatio,
                        child: VideoPlayer(INvideoPlayerController!),
                      );
                
              }),
        ),
      ]),
    );


The video is getting selected and getting adding to the list but not getting displayed. I am getting no errors. in my debug console(no build error[which are in red]) but getting out of memory error but app is still building.

What I have tried:

I tried changing index but that gave range error
Posted
Comments
wseng 2-Apr-22 12:45pm    
what is setLooping for?
Kavya Bhargava 2-Apr-22 13:47pm    
So that video keeps looping
wseng 4-Apr-22 13:19pm    
Can try to remove it and see whether video is displayed?
Kavya Bhargava 5-Apr-22 7:46am    
I tried but video still not displaying

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900