hardik koladiya
hardik koladiya

Reputation: 134

How to Pick Multiple Video From Gallery in Flutter

EveryOne I want to pick multiple video from gallery and show in my flutter app but I am unable to do this.

Upvotes: 1

Views: 2870

Answers (2)

Amanat Singh
Amanat Singh

Reputation: 1

The following doesn't allow picking from gallery:

final result = await FilePicker.platform.pickFiles(
    allowMultiple: true,
    type: FileType.custom,
    allowedExtensions: ['mp4'],
    withData: false,
    withReadStream: true,
    allowCompression: false,
  );

If we use allowedExtensions: ['mp4'] and type: FileType.custom then picked videos are not from galley. If we want to pick from gallery use type: FileType.video only as follows:

final result = await FilePicker.platform.pickFiles(
    allowMultiple: true,
    type: FileType.video,
    withData: false,
    withReadStream: true,
    allowCompression: false,
  );

Upvotes: 0

You can use file_picker, it has option to pick/upload multiple files i.e

FilePickerResult? result = await FilePicker.platform.pickFiles(allowMultiple: true);

as well as Multiple files with extension filter i.e

FilePickerResult? result = await FilePicker.platform.pickFiles(
  type: FileType.custom,
  allowedExtensions: ['jpg', 'pdf', 'doc'],
);

Upvotes: 2

Related Questions