justsoft / video_thumbnail

This plugin generates thumbnail from video file or URL. It returns image in memory or writes into a file. It offers rich options to control the image format, resolution and quality. Supports iOS and Android.
MIT License
183 stars 242 forks source link

release app not showing thumbnail #39

Open msarkrish opened 4 years ago

msarkrish commented 4 years ago

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

antonvinceguinto commented 4 years ago

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

msarkrish commented 4 years ago

@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.

antonvinceguinto commented 4 years ago

@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

msarkrish commented 4 years ago

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

Sunsiha commented 3 years ago

@msarkrish have u guys found any solution for this?

msarkrish commented 3 years ago

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

yfsanfeng commented 2 years ago

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