|
|
@@ -3568,7 +3568,7 @@ export struct LocalMusic {
|
|
|
this.videoUrl = this.currentSong.filePath
|
|
|
this.name = this.currentSong.name
|
|
|
this.cover = this.currentSong.pixelMapPath
|
|
|
-
|
|
|
+ this.artist = this.currentSong.artist
|
|
|
LogUtil.info('this.currentSong.duration ='+this.currentSong.duration)
|
|
|
LogUtil.info('this.currentSong.sampleRate ='+this.currentSong.sampleRate)
|
|
|
LogUtil.info('this.currentSongmimeType ='+this.currentSong.mimeType)
|
|
|
@@ -8044,9 +8044,9 @@ export struct LocalMusic {
|
|
|
onPrepared: async () => {
|
|
|
LogUtils.getInstance().LOGI("setOnPreparedListener-->go");
|
|
|
try {
|
|
|
- this.cover = this.songList[this.curIndex].pixelMapPath
|
|
|
- this.artist = this.songList[this.curIndex].artist
|
|
|
- this.videoUrl = this.songList[this.curIndex].filePath
|
|
|
+ // this.cover = this.songList[this.curIndex].pixelMapPath
|
|
|
+ // this.artist = this.songList[this.curIndex].artist
|
|
|
+ // this.videoUrl = this.songList[this.curIndex].filePath
|
|
|
|
|
|
let isBgCover = PreferencesUtil.getBooleanSync(SettingPage.iS_MUSIC_BG_COVER, true)
|
|
|
if (isBgCover && this.cover !== undefined && StrUtil.isNotEmpty(this.cover)) {
|
|
|
@@ -8859,6 +8859,8 @@ export struct LocalMusic {
|
|
|
this.stop();
|
|
|
this.currentSong = this.songList[this.curIndex]
|
|
|
this.videoUrl = this.songList[this.curIndex].filePath;
|
|
|
+ this.cover = this.songList[this.curIndex].pixelMapPath
|
|
|
+ this.artist = this.songList[this.curIndex].artist
|
|
|
this.name = this.songList[this.curIndex].name
|
|
|
this.startPlayOrResumePlay()
|
|
|
|
|
|
@@ -8913,6 +8915,8 @@ export struct LocalMusic {
|
|
|
this.currentSong = this.songList[this.curIndex];
|
|
|
this.videoUrl = this.songList[this.curIndex].filePath;
|
|
|
this.name = this.songList[this.curIndex].name;
|
|
|
+ this.cover = this.songList[this.curIndex].pixelMapPath
|
|
|
+ this.artist = this.songList[this.curIndex].artist
|
|
|
this.startPlayOrResumePlay();
|
|
|
}
|
|
|
}
|
|
|
@@ -8928,6 +8932,8 @@ export struct LocalMusic {
|
|
|
this.currentSong = this.songList[this.curIndex]
|
|
|
this.videoUrl = this.songList[index].filePath;
|
|
|
this.name = this.songList[index].name
|
|
|
+ this.cover = this.songList[this.curIndex].pixelMapPath
|
|
|
+ this.artist = this.songList[this.curIndex].artist
|
|
|
this.curIndex = index;
|
|
|
this.startPlayOrResumePlay()
|
|
|
}
|
|
|
@@ -8939,8 +8945,8 @@ export struct LocalMusic {
|
|
|
if (!this.debounce()) {
|
|
|
return;
|
|
|
}
|
|
|
- if (this.playType == 3) { //3:随机播放
|
|
|
- this.randomPlay()
|
|
|
+ if (this.playType == 3) { //3:随机播放的上一首应该应该播放历史记录的第二首
|
|
|
+ this.randomModePlayFromHistory()
|
|
|
return;
|
|
|
}
|
|
|
if (this.curIndex == 0) {
|
|
|
@@ -8954,8 +8960,42 @@ export struct LocalMusic {
|
|
|
this.currentSong = this.songList[this.curIndex]
|
|
|
this.videoUrl = this.songList[this.curIndex].filePath;
|
|
|
this.name = this.songList[this.curIndex].name
|
|
|
+ this.cover = this.songList[this.curIndex].pixelMapPath
|
|
|
+ this.artist = this.songList[this.curIndex].artist
|
|
|
this.startPlayOrResumePlay()
|
|
|
}
|
|
|
+ //随机播放模式下点击上一首: 上一首应该应该播放历史记录的第二首
|
|
|
+ private randomModePlayFromHistory() {
|
|
|
+ if (this.historyList.length >= 2) {
|
|
|
+ // 播放历史记录的第二首
|
|
|
+ const prevSong = this.historyList[1];
|
|
|
+ this.curIndex = this.songList.findIndex(song => song.filePath === prevSong.filePath);
|
|
|
+ this.CONTROL_PlayStatus = PlayStatus.INIT;
|
|
|
+ this.stop();
|
|
|
+ this.currentSong = prevSong;
|
|
|
+ this.videoUrl = prevSong.filePath;
|
|
|
+ this.cover = prevSong.pixelMapPath
|
|
|
+ this.artist = prevSong.artist
|
|
|
+ this.name = prevSong.name;
|
|
|
+ this.startPlayOrResumePlay();
|
|
|
+ } else {
|
|
|
+ // 如果历史记录不足两首,可根据需求处理,这里简单按普通逻辑处理
|
|
|
+ if (this.curIndex === 0) {
|
|
|
+ this.curIndex = this.songList.length - 1;
|
|
|
+ } else {
|
|
|
+ this.curIndex--;
|
|
|
+ }
|
|
|
+ this.CONTROL_PlayStatus = PlayStatus.INIT;
|
|
|
+ this.stop();
|
|
|
+ this.currentSong = this.songList[this.curIndex];
|
|
|
+ this.videoUrl = this.songList[this.curIndex].filePath;
|
|
|
+ this.cover = this.songList[this.curIndex].pixelMapPath
|
|
|
+ this.artist = this.songList[this.curIndex].artist
|
|
|
+ this.name = this.songList[this.curIndex].name;
|
|
|
+
|
|
|
+ this.startPlayOrResumePlay();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
debounce() {
|
|
|
const delay = 600;
|