video_thumbnail icon indicating copy to clipboard operation
video_thumbnail copied to clipboard

release app not showing thumbnail

Open msarkrish opened this issue 4 years ago • 7 comments

In my app, I'm listing all the videos from phone storage. In gridview i'm showing all the videos. I'm futurebuilder as a parent for video_thumbnail widget. In emulator it working correctly and showing all the videos with thumbnail but when i'm taking build and running in my phone, it shows only circular progress bar.

My Code:

import 'dart:io';
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:video_thumbnail/video_thumbnail.dart';

class VideoWithThumbnail extends StatefulWidget {
   final String filePath;

   VideoWithThumbnail({@required this.filePath});
  
   @override
   _VideoWithThumbnailState createState() => _VideoWithThumbnailState();
  }

 class _VideoWithThumbnailState extends State<VideoWithThumbnail> {
    Future futureThumbnail;
    void initState() {
      super.initState();
      futureThumbnail = getThumbnail();
     }

     @override
     Widget build(BuildContext context) {
       return FutureBuilder(
           future: futureThumbnail,
           builder: (context, snapshot) {
                if (ConnectionState.done == snapshot.connectionState) {
                   return Image.memory(snapshot.data);
                } else {
                   return CircularProgressIndicator();
                 }
              },
           );
      }

 Future<Uint8List> getThumbnail() async {
   Uint8List unit8List = await VideoThumbnail.thumbnailData(
    video: widget.filePath,
    imageFormat: ImageFormat.JPEG,
    maxWidth:
      128, // specify the width of the thumbnail, let the height auto-scaled to keep the source aspect ratio
     quality: 25,
    );
   return unit8List;
  }
}

Screenshot: thumbnail error

msarkrish avatar Aug 29 '20 19:08 msarkrish

I'm having the same issue RECENTLY. It was working fine before.

antonvinceguinto avatar Sep 01 '20 09:09 antonvinceguinto

@antonvinceguinto do you find any solution bro, I need to display all the videos from gallery, so i need to show thumbnails for all the videos. Help me bro.

msarkrish avatar Sep 01 '20 10:09 msarkrish

@antonvinceguinto do you find any solution bro, I need to display all the videos from gallery, so i need to show thumbnails for all the videos. Help me bro.

I don't I'm also looking for a solution

antonvinceguinto avatar Sep 01 '20 11:09 antonvinceguinto

@antonvinceguinto if you find any solution, please share brother.

msarkrish avatar Sep 02 '20 14:09 msarkrish

@msarkrish have u guys found any solution for this?

Sunsiha avatar Oct 20 '20 06:10 Sunsiha

@Sunsiha i solved that problem by using https://pub.dev/packages/photo_gallery this plugin.

msarkrish avatar Oct 20 '20 15:10 msarkrish

i solved that problem set application android:usesCleartextTraffic="true"

yfsanfeng avatar Oct 09 '21 09:10 yfsanfeng