Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/pr_title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
llc
ui
repo
thumb
requireScope: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -39,7 +40,8 @@ jobs:
scopes: |
{
"llc": "packages/stream_core",
"ui": "packages/stream_core_flutter"
"ui": "packages/stream_core_flutter",
"thumb": "packages/stream_thumbnail"
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*

# Swift Package Manager related
**/ios/**/.build/
**/ios/**/.swiftpm/

# macOS
**/Flutter/ephemeral/
**/Pods/
Expand Down
1 change: 1 addition & 0 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ command:
markdown: ^7.3.0
meta: ^1.15.0
mime: ^2.0.0
plugin_platform_interface: ^2.1.8
rxdart: ^0.28.0
shimmer: ^3.0.0
stream_core: ^0.4.0
Expand Down
3 changes: 3 additions & 0 deletions packages/stream_thumbnail/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

* Initial release.
22 changes: 22 additions & 0 deletions packages/stream_thumbnail/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2026 STREAM.IO, INC.
Copyright (c) 2019 John Zhong

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
70 changes: 70 additions & 0 deletions packages/stream_thumbnail/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Stream Thumbnail

## Introduction

A Flutter plugin for creating a thumbnail image from a video. Give it a local file path or a video URL and it returns the thumbnail as bytes or as a saved image file. Works on Android, iOS, and web.

## Installation

Add the following to your `pubspec.yaml` and replace `[version]` with the latest version:

```yaml
dependencies:
stream_thumbnail: ^[version]
```

## Usage

```dart
import 'package:stream_thumbnail/stream_thumbnail.dart';
```

### Bytes

Get the thumbnail as in-memory bytes — ideal for `Image.memory`:

```dart
final bytes = await StreamThumbnail.thumbnailData(
video: 'https://example.com/video.mp4',
imageFormat: StreamThumbnailFormat.jpeg,
maxWidth: 128, // 0 keeps the source resolution
quality: 25,
);
```

### File

Write the thumbnail to disk and get back an `XFile`. If `thumbnailPath` is omitted, the
image is saved next to the video (or in the cache directory for remote videos):

```dart
final thumbnail = await StreamThumbnail.thumbnailFile(
video: '/path/to/video.mp4',
imageFormat: StreamThumbnailFormat.png,
maxHeight: 200,
);
```

### Multiple files

Generate thumbnails for several videos in one call:

```dart
final thumbnails = await StreamThumbnail.thumbnailFiles(
videos: ['/path/to/a.mp4', '/path/to/b.mp4'],
);
```

## Options

Every method accepts the same options:

| Option | Description |
| --------------- | ------------------------------------------------------------------------------- |
| `video`(s) | Path to a local video file or a video URL. |
| `headers` | HTTP headers sent when fetching a remote video. |
| `thumbnailPath` | Output path (file variants only). Defaults to the video's folder or cache dir. |
| `imageFormat` | `JPEG`, `PNG`, or `WEBP`. Defaults to `PNG`. WebP on iOS is backed by `libwebp`.|
| `maxHeight` / `maxWidth` | Max size in pixels, or `0` to keep the source resolution. |
| `timeMs` | Capture position in milliseconds. |
| `quality` | Output quality, `0`–`100` (ignored for PNG). |
56 changes: 56 additions & 0 deletions packages/stream_thumbnail/android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
buildscript {
val kotlinVersion = "2.2.20"
repositories {
google()
mavenCentral()
}

dependencies {
classpath("com.android.tools.build:gradle:8.11.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
}
}

plugins {
id("com.android.library")
}

group = "io.getstream.stream_thumbnail"
version = "1.0-SNAPSHOT"

allprojects {
repositories {
google()
mavenCentral()
}
}

android {
namespace = "io.getstream.stream_thumbnail"
compileSdk = 36

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

sourceSets {
getByName("main") {
java.srcDirs("src/main/kotlin")
}
}

defaultConfig {
minSdk = 24
}

lint {
disable.add("InvalidPackage")
}
}

kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11
}
}
1 change: 1 addition & 0 deletions packages/stream_thumbnail/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.gradle.jvmargs=-Xmx1536M
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 1 addition & 0 deletions packages/stream_thumbnail/android/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = "stream_thumbnail"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.getstream.stream_thumbnail">
</manifest>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Loading
Loading