I have list of file path like this one: content://media/external/audio/media/2732
I want to play the audio using the given file path. How can I add that path as a media item?
MediaItem(
id: "content://media/external/audio/media/2732",
title: "Test Song",
)
Above code doesn't work.
Finally I found the solution. I used this package: URI to File.
Implementation
Uri uri = Uri.parse("content://media/external/audio/media/2732");
File file = await toFile(uri);
MediaItem(
id: file.path,
title: "Test Song",
)
Finally I found the solution. I used this package: URI to File.
Implementation
Uri uri = Uri.parse("content://media/external/audio/media/2732");
File file = await toFile(uri);
MediaItem(
id: file.path,
title: "Test Song",
)