mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-03 21:42:10 +08:00
修改对播放模块的调用
This commit is contained in:
parent
24bfe135e7
commit
a9a5a4c2e0
@ -1,3 +1,7 @@
|
|||||||
|
### 优化
|
||||||
|
|
||||||
|
- 修改对播放模块的调用,杜绝应用显示正在播放的歌曲与实际播放歌曲不一致的问题(这是播放模块歌曲队列与应用内歌曲队列在某些情况下出现不一致时导致的)
|
||||||
|
|
||||||
### 修复
|
### 修复
|
||||||
|
|
||||||
- 修复kw源某些歌曲的歌词提取异常的问题
|
- 修复kw源某些歌曲的歌词提取异常的问题
|
||||||
|
@ -85,7 +85,8 @@ export const playMusic = async(tracks, time) => {
|
|||||||
// await updateMusicInfo(track)
|
// await updateMusicInfo(track)
|
||||||
const currentTrackIndex = await TrackPlayer.getCurrentTrack()
|
const currentTrackIndex = await TrackPlayer.getCurrentTrack()
|
||||||
await TrackPlayer.add(tracks).then(() => list.push(...tracks))
|
await TrackPlayer.add(tracks).then(() => list.push(...tracks))
|
||||||
await TrackPlayer.skip(list.indexOf(track))
|
const queue = await TrackPlayer.getQueue()
|
||||||
|
await TrackPlayer.skip(queue.findIndex(t => t.id == track.id))
|
||||||
|
|
||||||
if (currentTrackIndex == null) {
|
if (currentTrackIndex == null) {
|
||||||
if (!isTempTrack(track.id)) {
|
if (!isTempTrack(track.id)) {
|
||||||
@ -105,8 +106,8 @@ export const playMusic = async(tracks, time) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (list.length > 2) {
|
if (queue.length > 2) {
|
||||||
TrackPlayer.remove(Array(list.length - 2).fill(null).map((_, i) => i)).then(() => list.splice(0, list.length - 2))
|
TrackPlayer.remove(Array(queue.length - 2).fill(null).map((_, i) => i)).then(() => list.splice(0, list.length - 2))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user