getAudioUrlFlexible method
Get audio URL using flexible parameters
At least one of title, artist, or videoId must be provided.
If videoId is provided, it will be used directly for faster results.
If only title and/or artist are provided, the method will search
for the song first and then extract the audio URL.
Parameters:
title: Song title (optional if videoId is provided)artist: Artist name (optional if videoId is provided)videoId: YouTube video ID (optional if title/artist provided)audioQuality: Audio quality level - "LOW", "MED", "HIGH", "VERY_HIGH"
Returns a Map with:
- success: bool - Whether the operation was successful
- audioUrl: String - The direct audio URL (if successful)
- error: String - Error message (if failed)
- Additional metadata about the request
Implementation
@override
Future<Map<String, dynamic>> getAudioUrlFlexible({
String? title,
String? artist,
String? videoId,
String audioQuality = 'HIGH',
}) async {
final result = await _methodChannel.invokeMethod('getAudioUrlFlexible', {
'title': title,
'artist': artist,
'videoId': videoId,
'audioQuality': audioQuality,
});
return Map<String, dynamic>.from(result);
}