mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 10:47:25 +01:00
mobile: Full playback notification
This commit is contained in:
parent
c2b39677b5
commit
19da47ea04
1 changed files with 23 additions and 3 deletions
|
|
@ -331,16 +331,36 @@ class _PlaybackService extends BackgroundAudioTask {
|
||||||
final recordingInfo = await db.getRecording(track.track.recordingId);
|
final recordingInfo = await db.getRecording(track.track.recordingId);
|
||||||
final workInfo = await db.getWork(recordingInfo.recording.work);
|
final workInfo = await db.getWork(recordingInfo.recording.work);
|
||||||
|
|
||||||
final composers = workInfo.composers
|
final title = workInfo.composers
|
||||||
.map((p) => '${p.firstName} ${p.lastName}')
|
.map((p) => '${p.firstName} ${p.lastName}')
|
||||||
.join(', ');
|
.join(', ');
|
||||||
|
|
||||||
final title = workInfo.work.title;
|
final subtitleBuffer = StringBuffer(workInfo.work.title);
|
||||||
|
|
||||||
|
final partIds = track.track.partIds;
|
||||||
|
if (partIds.isNotEmpty) {
|
||||||
|
subtitleBuffer.write(': ');
|
||||||
|
|
||||||
|
final section =
|
||||||
|
workInfo.sections.lastWhere((s) => s.beforePartIndex <= partIds[0]);
|
||||||
|
|
||||||
|
if (section != null) {
|
||||||
|
subtitleBuffer.write(section.title);
|
||||||
|
subtitleBuffer.write(': ');
|
||||||
|
}
|
||||||
|
|
||||||
|
subtitleBuffer
|
||||||
|
.write(partIds.map((i) => workInfo.parts[i].part.title).join(', '));
|
||||||
|
}
|
||||||
|
|
||||||
|
final subtitle = subtitleBuffer.toString();
|
||||||
|
|
||||||
AudioServiceBackground.setMediaItem(MediaItem(
|
AudioServiceBackground.setMediaItem(MediaItem(
|
||||||
id: track.identifier,
|
id: track.identifier,
|
||||||
album: composers,
|
album: subtitle,
|
||||||
title: title,
|
title: title,
|
||||||
|
displayTitle: title,
|
||||||
|
displaySubtitle: subtitle,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue