π΅ YT Flutter Music API
A powerful Flutter plugin that bridges YouTube Music functionality using a Kotlin + Python (Chaquopy) backend.
Search songs, stream results in real time, and fetch related tracksβall directly from your Flutter app.
β¨ Features
- π Search YouTube Music with real-time results
- π‘ Stream search results live via
EventChannel - πΆ Fetch related songs intelligently
- ποΈ Adjustable audio & thumbnail quality
- π§ Powered by
ytmusicapi+yt-dlp - βοΈ Kotlin + Python bridge using Chaquopy
- π± Android support with Flutter frontend
π Getting Started
1. Initialize the plugin
await YtFlutterMusicapi().initialize(
proxy: null,
country: 'US',
);
2. Perform a direct search
final result = await YtFlutterMusicapi().searchMusic(
query: 'Alan Walker Faded',
limit: 5,
audioQuality: 'VERY_HIGH',
thumbQuality: 'VERY_HIGH',
);
print(result['title']); // Outputs: Faded
3. Stream results in real-time
await for (final song in YtFlutterMusicapi().streamSearchResults(
query: 'Alan Walker Faded',
limit: 5,
audioQuality: 'VERY_HIGH',
thumbQuality: 'VERY_HIGH',
)) {
print('π§ ${song['title']} by ${song['artists']}');
}
β‘ Fast feedback: Items arrive as they're fetched β perfect for CLI-style UIs and progressive lists.
βοΈ Configuration Options
| Parameter | Type | Description |
|---|---|---|
query |
String |
Search query (required) |
limit |
int |
Number of results (default: 10) |
audioQuality |
String |
LOW / MED / HIGH / VERY_HIGH |
thumbQuality |
String |
LOW / MED / HIGH / VERY_HIGH |
includeAudioUrl |
bool |
If true, includes audio stream URL |
includeAlbumArt |
bool |
If true, includes album art URL |
π§ͺ Test the Plugin
Download prebuilt APK from:
π Releases
π§ Internals
- β Native side: Kotlin plugin + Chaquopy Python bridge
- β Python packages:
- β
Uses
MethodChannelfor control andEventChannelfor streaming
π‘ Example CLI Output
π‘ Streaming search results for: "Alan Walker Faded"
π§ Streamed Result 1:
Title: Faded
Artists: Alan Walker
Duration: 3:32
Video ID: xyz123
Album Art: Available
Audio URL: Available
---
βΉοΈ Streaming limit reached (5)
β
Stream finished: 5 result(s)
π§βπ» Contributing
I welcome contributions!
git clone https://github.com/golanpiyush/yt_flutter_musicapi.git
cd yt_flutter_musicapi
- Fork & create a feature branch
- Make your changes
- Submit a pull request with description
π License
This project is licensed under the MIT License.
See LICENSE for more details.
π¦ Installation
Add this to your pubspec.yaml:
dependencies:
yt_flutter_musicapi:
git:
url: https://github.com/golanpiyush/yt_flutter_musicapi.git
ref: main
π€ Author
Piyush Golan
π» Developer
GitHub: @golanpiyush
π¬ For questions or collaboration, open an issue or drop a message!
Libraries
- main
- YouTube Music API for Flutter
- yt_flutter_musicapi
- yt_flutter_musicapi_method_channel
- yt_flutter_musicapi_platform_interface