Skip to content

Commit

Permalink
++
Browse files Browse the repository at this point in the history
  • Loading branch information
littleGnAl committed Jun 15, 2023
1 parent 7429f0d commit c1733b2
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions example/lib/examples/advanced/music_player/music_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ class _MusicPlayerExampleState extends State<MusicPlayerExample> {
if (!isPreloaded) {
_preloadCompleted = Completer();
_getLyricCompleted = Completer();
await _musicContentCenter.preload(
songCode: _selectedMusic.songCode!);
await _musicContentCenter.preload(_selectedMusic.songCode!);
_getLyricRequestId = await _musicContentCenter.getLyric(
songCode: _selectedMusic.songCode!);
} else {
Expand Down Expand Up @@ -310,18 +309,30 @@ class _MusicPlayerExampleState extends State<MusicPlayerExample> {
});
}
},
onPreLoadEvent: (int songCode, int percent, String lyricUrl,
PreloadStatusCode status, MusicContentCenterStatusCode errorCode) {
onPreLoadEvent: (
String requestId,
int songCode,
int percent,
String lyricUrl,
PreloadStatusCode status,
MusicContentCenterStatusCode errorCode,
) {
logSink.log(
'[onPreLoadEvent], songCode: $songCode, percent: $percent status: $status, errorCode: $errorCode, lyricUrl: $lyricUrl');
'[onPreLoadEvent], requestId: $requestId songCode: $songCode, percent: $percent status: $status, errorCode: $errorCode, lyricUrl: $lyricUrl');
if (_selectedMusic.songCode == songCode &&
status == PreloadStatusCode.kPreloadStatusCompleted) {
_preloadCompleted?.complete();
_preloadCompleted = null;
}
},
onLyricResult: (String requestId, String lyricUrl,
MusicContentCenterStatusCode errorCode) {
onLyricResult: (
String requestId,
int songCode,
String lyricUrl,
MusicContentCenterStatusCode errorCode,
) {
logSink.log(
'[onLyricResult], requestId: $requestId songCode: $songCode, lyricUrl: $lyricUrl errorCode: $errorCode');
if (_getLyricRequestId == requestId) {
_getLyricCompleted?.complete(lyricUrl);
_getLyricCompleted = null;
Expand Down

0 comments on commit c1733b2

Please sign in to comment.