fix gapless playback handling
This commit is contained in:
parent
e7c610f089
commit
96f7b1e646
|
@ -3,7 +3,7 @@
|
||||||
// @namespace io.github.uhwot.dzunlock
|
// @namespace io.github.uhwot.dzunlock
|
||||||
// @description enables deezer hifi features lol
|
// @description enables deezer hifi features lol
|
||||||
// @author uh wot
|
// @author uh wot
|
||||||
// @version 1.4.3
|
// @version 1.4.4
|
||||||
// @license GPL-3.0-only
|
// @license GPL-3.0-only
|
||||||
// @homepageURL https://git.uhwot.cf/uhwot/dzunlock
|
// @homepageURL https://git.uhwot.cf/uhwot/dzunlock
|
||||||
// @downloadURL https://uhwotgit.fly.dev/uhwot/dzunlock/raw/branch/master/dzunlock.user.js
|
// @downloadURL https://uhwotgit.fly.dev/uhwot/dzunlock/raw/branch/master/dzunlock.user.js
|
||||||
|
@ -137,16 +137,20 @@ unsafeWindow.WebSocket = new Proxy(unsafeWindow.WebSocket, {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let last_track_id = null
|
||||||
|
|
||||||
unsafeWindow.fetch = (function (fetch) {
|
unsafeWindow.fetch = (function (fetch) {
|
||||||
return async function (url, init) {
|
return async function (url, init) {
|
||||||
if (url === 'https://media.deezer.com/v1/get_url') {
|
if (url === 'https://media.deezer.com/v1/get_url') {
|
||||||
let track
|
let track
|
||||||
if (unsafeWindow.dzPlayer.getPosition() === 0) {
|
if (last_track_id !== unsafeWindow.dzPlayer.getSongId()) {
|
||||||
track = unsafeWindow.dzPlayer.getCurrentSong()
|
track = unsafeWindow.dzPlayer.getCurrentSong()
|
||||||
} else {
|
} else {
|
||||||
track = unsafeWindow.dzPlayer.getNextSong() // gapless playback
|
track = unsafeWindow.dzPlayer.getNextSong() // gapless playback
|
||||||
}
|
}
|
||||||
|
|
||||||
|
last_track_id = track.SNG_ID
|
||||||
|
|
||||||
const quality = unsafeWindow.dzPlayer.control.getAudioQuality()
|
const quality = unsafeWindow.dzPlayer.control.getAudioQuality()
|
||||||
const id = parseInt(track.SNG_ID)
|
const id = parseInt(track.SNG_ID)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue