fixed gapless playback

This commit is contained in:
uh wot 2022-06-21 02:36:45 +02:00
parent 0ac770d844
commit a21c19228b
Signed by: uhwot
GPG Key ID: CB2454984587B781
1 changed files with 8 additions and 2 deletions

View File

@ -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.3.7 // @version 1.3.8
// @license GPL-3.0-only // @license GPL-3.0-only
// @homepageURL https://git.freezerapp.xyz/uhwot/dzunlock // @homepageURL https://git.freezerapp.xyz/uhwot/dzunlock
// @downloadURL https://git.freezerapp.xyz/uhwot/dzunlock/raw/branch/master/dzunlock.user.js // @downloadURL https://git.freezerapp.xyz/uhwot/dzunlock/raw/branch/master/dzunlock.user.js
@ -98,8 +98,14 @@ window.addEventListener('DOMContentLoaded', (_) => {
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
if (unsafeWindow.dzPlayer.getPosition() === 0) {
track = unsafeWindow.dzPlayer.getCurrentSong()
} else {
track = unsafeWindow.dzPlayer.getNextSong() // gapless playback
}
const quality = unsafeWindow.dzPlayer.control.getAudioQuality() const quality = unsafeWindow.dzPlayer.control.getAudioQuality()
const track = unsafeWindow.dzPlayer.getCurrentSong()
const id = parseInt(track.SNG_ID) const id = parseInt(track.SNG_ID)
let is_subbed = !unsafeWindow.dzPlayer.user_status.can_subscribe let is_subbed = !unsafeWindow.dzPlayer.user_status.can_subscribe