Skip to content

chewie/video_player flutter The getter '_duration' was called on null #54961

@nummonnic

Description

@nummonnic

I use video_player 0.10.4+1 and chewie 0.9.8 but when i run the application my video can not play and always loading like this. And This is my code. I already imoport video_player and chewie.

class ChewieListItem extends StatefulWidget{

@override
_ChewieListItemState createState() => _ChewieListItemState();
}

class _ChewieListItemState extends State<ChewieListItem>{
 String urlVideo = 'assets/vi1.mp4';
 VideoPlayerController videoPlayerController;
 ChewieController _chewieController;

@override
void initState(){
super.initState();
videoPlayerController = VideoPlayerController.asset(urlVideo)..initialize();
_chewieController = ChewieController(
  videoPlayerController: videoPlayerController,
  aspectRatio: 3 / 2,
  autoInitialize: true,
  autoPlay: false,
);
}

@override
void dispose(){
super.dispose();
videoPlayerController.dispose();
_chewieController.dispose();
}

@override
Widget build(BuildContext context){
return Padding(
  padding: const EdgeInsets.all(2.0),
  child: Chewie(
    controller: _chewieController,
  ),
);
}


}

And this is my code for import the above file.

void activityVideo(BuildContext context){
var alertDialog = AlertDialog(
title: Text("videoclip"),
content: Container(
height: 200,
width: 300,
child: ChewieListItem()),
 }

This is my error
I/flutter (21154): The following NoSuchMethodError was thrown while handling a gesture:
I/flutter (21154): The getter '_duration' was called on null.
I/flutter (21154): Receiver: null
I/flutter (21154): Tried calling: _duration

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions