Issue
This Content is from Stack Overflow. Question asked by Powermaster Prime
I have my mobile app successfully displaying my images and videos on my page, but it seems to only show a blank container with play thumbnail for my videos.
GridView.builder(
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 2.0,
mainAxisSpacing: 2.0,
),
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: tickets[widget.indexEvent].videos.length,
itemBuilder: (context, i) {
return InkWell(
onTap: () {
},
child: Container(
width: MediaQuery.of(context).size.width * 0.8,
height: 220,
padding: const EdgeInsets.all(3.0),
child: ClipRRect(
/*borderRadius: BorderRadius.circular(12),*/
child: Stack(
children: [
Container(
width: 220,
height: 220,
color: colorPrimary,
child: ThumbnailImage(
videoUrl:
tickets[widget.indexEvent]
.videos[i],
),
),
Positioned(
bottom: 50,
right: 50,
child: Align(
alignment: Alignment.center,
child: InkWell(
onTap: () {
Get.to(
() => NetVideoPlayerScreen(
videoUrl:
tickets[widget.indexEvent]
.videos[i],
),
);
},
child: Container(
margin: const EdgeInsets.all(10),
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.white,
/* borderRadius:
BorderRadius.circular(12),*/
),
child: Icon(
Icons.play_arrow,
color: colorPrimary,
),
),
),
),
),
],
),
),
),
);
},
),
Sorry for the block of code, but this is the easiest way I feel like I could show some context. I thought my thumbnailImage()
function could use the video link to generate a thumbnail from the video, but apparently it doesn’t have that capability.
Is there a way for me to call a function in flutter’s video_player package to return a thumb image using my url? The documentation isn’t really helpful for me, and I can’t seem to find a way to just evoke it right here in the container code. Thanks!
Solution
This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.
This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.