로컬 비디오 파일 또는 비디오 URL에서 썸네일 이미지를 생성하는 플러터 플러그인입니다. Android, iOS, Web 플랫폼을 지원하며, 개발자가 비디오에서 대표 프레임을 추출하여 미리보기, 갤러리, 미디어 표시에 활용할 수 있도록 합니다. 플러그인은 플랫폼별 구현을 통해 네이티브 기능을 활용하여 장치 간 효율적인 성능과 호환성을 보장합니다. 전체 비디오를 재생하지 않고도 비디오 콘텐츠의 시각적 표현이 필요한 앱에 특히 유용합니다.
사용 사례
비디오 미리보기 생성
미디어 갤러리 썸네일
콘텐츠 추천 UI
비디오 업로드 미리보기
소셜 미디어 게시물 미리보기
주요 기능
로컬 비디오 파일을 지원합니다
비디오 URL을 지원합니다
크로스 플랫폼(안드로이드, iOS, 웹)
효율적인 프레임 추출
간단한 API 통합
적합한 대상
미디어 집약형 애플리케이션
비디오 공유 플랫폼
콘텐츠 관리 시스템
비디오 라이브러리가 있는 모바일 앱
웹 기반 비디오 뷰어
고려 사항
Android 및 iOS에서 적절한 권한이 필요합니다
웹 지원은 브라우저 기능에 따라 제한될 수 있습니다
큰 비디오 파일은 성능에 영향을 줄 수 있습니다
미니어처 품질은 원본 비디오 해상도에 따라 달라집니다
원격 URL에 대한 네트워크 요청에는 오류 처리가 필요합니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
get_video_thumbnail
This project is a modified fork of video_thumbnail,
originally created by
John Zhong. Modifications and improvements have been made to adapt the project to new needs.
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 / Android / web.
Methods
function
parameter
description
return
thumbnailData
String [video], optional Map<String, dynamic> [headers], ImageFormat [imageFormat](JPEG/PNG/WEBP), int [maxHeight](0: for the original resolution of the video, or scaled by the source aspect ratio), [maxWidth](0: for the original resolution of the video, or scaled by the source aspect ratio), int [timeMs]generates the thumbnail from the frame around the specified millisecond, int[quality]`(0-100)
generates thumbnail from [video]
[Future<Uint8List>]
thumbnailFile
String [video], optional Map<String, dynamic> [headers], String [thumbnailPath](folder or full path where to store the thumbnail file, null to save to same folder as the video file) this ignored on the web, ImageFormat [imageFormat](JPEG/PNG/WEBP), int [maxHeight](0: for the original resolution of the video, or scaled by the source aspect ratio), int [maxWidth](0: for the original resolution of the video, or scaled by the source aspect ratio), int [timeMs] generates the thumbnail from the frame around the specified millisecond, int [quality](0-100)
creates a file of the thumbnail from the [video]
[Future<String>]
Warning:
Giving both the maxHeight and maxWidth has different result on Android platform, it actually
scales the thumbnail
to the specified maxHeight and maxWidth.
To generate the thumbnail from a network resource, the video must be properly URL encoded.
Usage
Installing
add get_thumbnail_video as a dependency in your pubspec.yaml file.
final uint8list = awaitVideoThumbnail.thumbnailData(
video: videofile.path,
imageFormat: ImageFormat.JPEG,
maxWidth: 128, // specify the width of the thumbnail, let the height auto-scaled to keep the source aspect ratio
quality: 25,
);
Generate a thumbnail file from video URL
XFile thumbnailFile = awaitVideoThumbnail.thumbnailFile(
video: "https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4",
thumbnailPath: (awaitgetTemporaryDirectory()).path,
imageFormat: ImageFormat.WEBP,
maxHeight: 64, // specify the height of the thumbnail, let the width auto-scaled to keep the source aspect ratio
quality: 75,
);
final image = kIsWeb ? Image.network(thumbnailFile.path) : Image.file(File(thumbnailFile.path));
Generate a thumbnail file from video Assets declared in pubspec.yaml
Flutter Thumbnail on the Web platform has some limitations that might surprise developers more
familiar with
mobile/desktop targets.
In no particular order:
CORS headers
This plugin requires the server hosting the video to include appropriate CORS headers in the
response. Specifically, the
server must include the Access-Control-Allow-Origin and Access-Control-Allow-Methods headers in
the response to the
request.
For more information, please refer to
the Mozilla Developer Network documentation.
HTTP range headers
This plugin requires the server hosting the video to support HTTP range headers. If the server does
not support range
requests, the plugin may generate a thumbnail from the first frame of the video instead of the
desired frame.
For more information, please refer to
the Mozilla Developer Network documentation.
Notes
Fork or pull requests are always welcome. Currently it seems have a little performance issue while
generating WebP
thumbnail by using libwebp under iOS.