createMusicMessage method
音乐消息(msg_type=16)。duration 为秒,省略则不写入 extra。
Implementation
Message createMusicMessage({
required int talkMode,
required int toFromId,
required String title,
required String url,
String? artist,
String? cover,
int? duration,
}) {
return Message(
msgId: genMsgId(),
msgType: MsgType.music,
talkMode: talkMode,
toFromId: toFromId,
extra: {
'title': title,
'url': url,
if (artist != null && artist.isNotEmpty) 'artist': artist,
if (cover != null && cover.isNotEmpty) 'cover': cover,
'duration': ?duration,
},
sendTime: _now(),
status: 1,
fromId: _store.ownerId,
);
}