mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Fix for offline-mode having now_playing object updated wrongly
This commit is contained in:
@@ -230,7 +230,7 @@ window.addEventListener("DOMContentLoaded", function() {
|
|||||||
var to_remove = document.querySelector(".connect_error");
|
var to_remove = document.querySelector(".connect_error");
|
||||||
if(to_remove != null) {
|
if(to_remove != null) {
|
||||||
var instance = M.Toast.getInstance(to_remove);
|
var instance = M.Toast.getInstance(to_remove);
|
||||||
instancce.dismiss();
|
instance.dismiss();
|
||||||
}
|
}
|
||||||
//before_toast();
|
//before_toast();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ var Player = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
now_playing_listener: function(obj) {
|
now_playing_listener: function(obj) {
|
||||||
|
if(offline && video_id != undefined) return;
|
||||||
if(obj.np != undefined) {
|
if(obj.np != undefined) {
|
||||||
if(offline && (video_id == "" || video_id == undefined) && !client){
|
|
||||||
video_id = obj.np[0].id;
|
video_id = obj.np[0].id;
|
||||||
Player.np = obj.np[0];
|
Player.np = obj.np[0];
|
||||||
Player.np.start = obj.np[0].start;
|
Player.np.start = obj.np[0].start;
|
||||||
@@ -22,43 +22,23 @@ var Player = {
|
|||||||
Player.np.duration = obj.np[0].duration;
|
Player.np.duration = obj.np[0].duration;
|
||||||
if(Player.np.start == undefined) Player.np.start = 0;
|
if(Player.np.start == undefined) Player.np.start = 0;
|
||||||
if(Player.np.end == undefined) Player.np.end = Player.np.duration;
|
if(Player.np.end == undefined) Player.np.end = Player.np.duration;
|
||||||
|
song_title = obj.np[0].title;
|
||||||
|
duration = obj.np[0].duration;
|
||||||
|
|
||||||
|
if(offline && (video_id == "" || video_id == undefined) && !client){
|
||||||
|
|
||||||
if(!obj.np[0].hasOwnProperty("start")) {
|
|
||||||
Player.np.start = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!obj.np[0].hasOwnProperty("end")) {
|
|
||||||
Player.np.end = Player.np.duration;
|
|
||||||
}
|
|
||||||
if(obj.conf != undefined) {
|
if(obj.conf != undefined) {
|
||||||
conf = obj.conf[0];
|
conf = obj.conf[0];
|
||||||
}
|
}
|
||||||
time = obj.time;
|
time = obj.time;
|
||||||
seekTo = 0 + Player.np.start;
|
seekTo = 0 + Player.np.start;
|
||||||
startTime = time - conf.startTime;
|
startTime = time - conf.startTime;
|
||||||
song_title = obj.np[0].title;
|
|
||||||
duration = obj.np[0].duration;
|
|
||||||
videoSource = obj.np[0].hasOwnProperty("source") ? obj.np[0].source : "youtube";
|
videoSource = obj.np[0].hasOwnProperty("source") ? obj.np[0].source : "youtube";
|
||||||
Player.getTitle(song_title, viewers);
|
Player.getTitle(song_title, viewers);
|
||||||
Player.loadVideoById(Player.np.id, duration, Player.np.start, Player.np.end);
|
Player.loadVideoById(Player.np.id, duration, Player.np.start, Player.np.end);
|
||||||
} else {
|
} else {
|
||||||
video_id = obj.np[0].id;
|
|
||||||
Player.np = obj.np[0];
|
|
||||||
Player.np.start = obj.np[0].start;
|
|
||||||
Player.np.end = obj.np[0].end;
|
|
||||||
Player.np.duration = obj.np[0].duration;
|
|
||||||
if(Player.np.start == undefined) Player.np.start = 0;
|
|
||||||
if(Player.np.end == undefined) Player.np.end = Player.np.duration;
|
|
||||||
|
|
||||||
if(!obj.np[0].hasOwnProperty("start")) {
|
|
||||||
Player.np.start = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!obj.np[0].hasOwnProperty("end")) {
|
|
||||||
Player.np.end = Player.np.duration;
|
|
||||||
}
|
|
||||||
song_title = obj.np[0].title;
|
|
||||||
duration = obj.np[0].duration;
|
|
||||||
videoSource = obj.np[0].hasOwnProperty("source") ? obj.np[0].source : "youtube";
|
videoSource = obj.np[0].hasOwnProperty("source") ? obj.np[0].source : "youtube";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user