Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uint8List support for arturi #1085

Open
HadiWannous opened this issue Aug 9, 2024 · 2 comments
Open

Uint8List support for arturi #1085

HadiWannous opened this issue Aug 9, 2024 · 2 comments

Comments

@HadiWannous
Copy link

Feature proposal

i need the mediaItem support for uint8list as audio artwork...there is no working way to parse it in uri form

Motivating use case(s)

supporting fetched data from audio file to make the artwork appear in the notification

@ryanheise
Copy link
Owner

You can write the data to a file and then use a file URI.

@SDarius22
Copy link

Currently working on an implementation using a file and the following error has occured:

D/HWUI    (12310): --- Failed to create image decoder with message 'unimplemented'
W/System.err(12310): java.lang.NullPointerException: key == null || value == null
W/System.err(12310): 	at android.util.LruCache.put(LruCache.java:171)
W/System.err(12310): 	at com.ryanheise.audioservice.AudioService.loadArtBitmap(AudioService.java:241)
W/System.err(12310): 	at com.ryanheise.audioservice.AudioService.setMetadata(AudioService.java:801)
W/System.err(12310): 	at com.ryanheise.audioservice.AudioServicePlugin$AudioHandlerInterface.lambda$onMethodCall$2$com-ryanheise-audioservice-AudioServicePlugin$AudioHandlerInterface(AudioServicePlugin.java:842)
W/System.err(12310): 	at com.ryanheise.audioservice.AudioServicePlugin$AudioHandlerInterface$$ExternalSyntheticLambda4.run(Unknown Source:6)
W/System.err(12310): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
W/System.err(12310): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
W/System.err(12310): 	at java.lang.Thread.run(Thread.java:1012)

My code looks like this:

final File file = File(path);
file.writeAsBytesSync(data.buffer.asUint8List());
MediaItem item = MediaItem(
      id: song.id.toString(),
      album: song.album,
      title: song.title,
      artist: song.artist,
      duration: Duration(milliseconds: song.duration ?? 0),
      artUri: file.uri,
);
mediaItem.add(item);

Any idea why this wouldn't work? Or why the error?
The same thing works on Linux, but on Android it raises this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants