Cleaned up playback function, commented mediaKeyFixes
This commit is contained in:
parent
eb7788f86d
commit
5214ca9ad2
1 changed files with 12 additions and 36 deletions
|
@ -195,7 +195,6 @@ const app = new Vue({
|
||||||
type: "",
|
type: "",
|
||||||
},
|
},
|
||||||
MVsource: null,
|
MVsource: null,
|
||||||
prevButtonBackIndicator: false,
|
|
||||||
currentSongInfo: {},
|
currentSongInfo: {},
|
||||||
page: "",
|
page: "",
|
||||||
pageHistory: [],
|
pageHistory: [],
|
||||||
|
@ -2233,40 +2232,20 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
prevButton() {
|
prevButton() {
|
||||||
if (!app.prevButtonBackIndicator && app.mk.nowPlayingItem && app.mk.currentPlaybackTime > 2) {
|
if (app.mk.nowPlayingItem && app.mk.currentPlaybackTime > 2) {
|
||||||
app.prevButtonBackIndicator = true;
|
|
||||||
try {
|
|
||||||
clearTimeout(app.pauseButtonTimer);
|
|
||||||
} catch (e) {}
|
|
||||||
app.mk.seekToTime(0);
|
app.mk.seekToTime(0);
|
||||||
app.pauseButtonTimer = setTimeout(() => {
|
|
||||||
app.prevButtonBackIndicator = false;
|
|
||||||
}, 3000);
|
|
||||||
} else {
|
} else {
|
||||||
try {
|
|
||||||
clearTimeout(app.pauseButtonTimer);
|
|
||||||
} catch (e) {}
|
|
||||||
app.prevButtonBackIndicator = false;
|
|
||||||
app.skipToPreviousItem();
|
app.skipToPreviousItem();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isDisabled() {
|
isDisabled() {
|
||||||
if (!app.mk.nowPlayingItem || app.mk.nowPlayingItem.attributes.playParams.kind == "radioStation") {
|
return !app.mk.nowPlayingItem || app.mk.nowPlayingItem.attributes.playParams.kind === "radioStation";
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
},
|
||||||
isPrevDisabled() {
|
isPrevDisabled() {
|
||||||
if (this.isDisabled() || (app.mk.queue._position == 0 && app.mk.currentPlaybackTime <= 2)) {
|
return this.isDisabled() || (app.mk.queue._position === 0 && app.mk.currentPlaybackTime <= 2);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
},
|
||||||
isNextDisabled() {
|
isNextDisabled() {
|
||||||
if (this.isDisabled() || app.mk.queue._position + 1 == app.mk.queue.length) {
|
return this.isDisabled() || app.mk.queue._position + 1 === app.mk.queue.length;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async getNowPlayingItemDetailed(target) {
|
async getNowPlayingItemDetailed(target) {
|
||||||
|
@ -5082,21 +5061,18 @@ const app = new Vue({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
skipToNextItem() {
|
skipToNextItem() {
|
||||||
app.prevButtonBackIndicator = false;
|
if (this.mk.queue.nextPlayableItemIndex !== -1 && this.mk.queue.nextPlayableItemIndex != null) this.mk.changeToMediaAtIndex(this.mk.queue.nextPlayableItemIndex);
|
||||||
// app.mk.skipToNextItem() is buggy somehow so use this
|
|
||||||
if (this.mk.queue.nextPlayableItemIndex != -1 && this.mk.queue.nextPlayableItemIndex != null) this.mk.changeToMediaAtIndex(this.mk.queue.nextPlayableItemIndex);
|
|
||||||
},
|
},
|
||||||
skipToPreviousItem() {
|
skipToPreviousItem() {
|
||||||
// app.mk.skipToPreviousItem() is buggy somehow so use this
|
if (this.mk.queue.previousPlayableItemIndex !== -1 && this.mk.queue.previousPlayableItemIndex != null) this.mk.changeToMediaAtIndex(this.mk.queue.previousPlayableItemIndex);
|
||||||
if (this.mk.queue.previousPlayableItemIndex != -1 && this.mk.queue.previousPlayableItemIndex != null) this.mk.changeToMediaAtIndex(this.mk.queue.previousPlayableItemIndex);
|
|
||||||
},
|
},
|
||||||
mediaKeyFixes() {
|
mediaKeyFixes() {
|
||||||
navigator.mediaSession.setActionHandler("previoustrack", function () {
|
// navigator.mediaSession.setActionHandler("previoustrack", function () {
|
||||||
app.prevButton();
|
// app.skipToPreviousItem();
|
||||||
});
|
// });
|
||||||
navigator.mediaSession.setActionHandler("nexttrack", function () {
|
// navigator.mediaSession.setActionHandler("nexttrack", function () {
|
||||||
app.skipToNextItem();
|
// app.skipToNextItem();
|
||||||
});
|
// });
|
||||||
},
|
},
|
||||||
authCC() {
|
authCC() {
|
||||||
ipcRenderer.send("cc-auth");
|
ipcRenderer.send("cc-auth");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue