update method
Updates currently playing Media's displayed info in the native controls.
In case no thumbnail
is passed, no image will be displayed.
This method should be only called when the Media has started playing, otherwise the
info retrieved automatically from Media will overrite the info set by update.
Implementation
Future<void> update(
{String? albumArtist,
String? album,
int? trackCount,
String? artist,
String? title,
int? trackNumber,
Uri? thumbnail}) async {
var info = <String>[
albumArtist ?? '',
album ?? '',
(trackCount != null) ? trackCount.toString() : '',
artist ?? '',
title ?? '',
(trackNumber != null) ? trackNumber.toString() : '',
].toNativeUtf8Array();
/// TODO (alexmercerind): Support video data.
/// TODO (alexmercerind): Add [Stream] to listen to events performed by user on the native controls.
LWM.bindings.PlayerNativeControlsUpdate(
id,
1,
info,
(thumbnail != null)
? 'file://${thumbnail.toString()}'.toNativeUtf8()
: ''.toNativeUtf8(),
);
calloc.free(info);
}