为他人。使用视频播放器插件作为缩略图。这对那些库非常有效,并且也适用于ios。只需像创建item一样创建statefullWidget(如果要在列表中显示,请将该控件用作item)。请参见以下示例。
class _VideoItemState extends State<VideoItem> {VideoPlayerController _controller;@overridevoid initState() {super.initState();_controller = VideoPlayerController.network(widget.video.file.path) ..initialize().then((_) { setState(() {}); //when your thumbnail will show. });}@overridevoid dispose() {super.dispose();_controller.dispose();}@overrideWidget build(BuildContext context) {return ListTile( leading: _controller.value.initialized ? Container( width: 100.0, height: 56.0, child: VideoPlayer(_controller), ) : CircularProgressIndicator(), title: Text(widget.video.file.path.split('/').last), onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => VideoPlayerPage(videoUrl: widget.video.file.path), ), ); },); }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)