Fixed local-mode issues

This commit is contained in:
Kasper Rynning-Tønnesen
2018-03-02 13:04:56 +01:00
parent 5e9e682932
commit b9bc22d1d2
4 changed files with 27 additions and 17 deletions

View File

@@ -504,9 +504,9 @@ function sendColor(coll, socket, id) {
var c = ColorThief.getColor(image);
if(socket) {
socket.emit("color", {color: c});
socket.emit("color", {color: c, only: true});
} else {
io.to(coll).emit("color", {color: c});
io.to(coll).emit("color", {color: c, only: false});
}
});
}

View File

@@ -54,23 +54,28 @@ var List = {
found_array_index = 0;
break;
case "song_change":
if(window.location.pathname != "/") List.song_change(msg.time, msg.remove);
if(full_playlist.length > 0) {
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
if((offline && msg.offline_change) || !offline) {
if(window.location.pathname != "/") List.song_change(msg.time, msg.remove);
if(full_playlist.length > 0) {
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
}
found_array = [];
found_array_index = 0;
}
found_array = [];
found_array_index = 0;
break;
case "changed_values":
List.changedValues(msg.value);
break;
case "song_change_prev":
if(window.location.pathname != "/") List.song_change_prev(msg.time);
if(full_playlist.length > 0) {
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
if((offline && msg.offline_change) || !offline) {
if(window.location.pathname != "/") List.song_change_prev(msg.time);
if(full_playlist.length > 0) {
Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id});
}
found_array = [];
found_array_index = 0;
}
found_array = [];
found_array_index = 0;
break;
}
},

View File

@@ -227,6 +227,11 @@ $().ready(function(){
});
initializeCastApi = function() {
try {
if(cast == undefined) return;
} catch(e) {
return;
}
cast.framework.CastContext.getInstance().setOptions({
receiverApplicationId: "E6856E24",
autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED
@@ -1159,7 +1164,7 @@ $(document).on( "click", "#add-many", function(e){
} else {
try {
var length = parseInt(end) - parseInt(start);
$(this).parent().parent().remove();
$(this).parent().parent().parent().remove();
Search.submit(id, title, length, false, 0, 1, start, end);
} catch(e) {
Materialize.toast("Only numbers are accepted as song start and end parameters..", 3000, "red lighten");

View File

@@ -406,7 +406,7 @@ var Player = {
} else {
Player.loadVideoById(video_id, duration, start, end);
}
List.channel_function({type:"song_change", time: time});
List.channel_function({type:"song_change", time: time, offline_change: true});
},
playPrev: function() {
@@ -444,7 +444,7 @@ var Player = {
Player.loadVideoById(video_id, duration, start, end);
}
List.channel_function({type:"song_change_prev", time: time});
List.channel_function({type:"song_change_prev", time: time, offline_change: true});
},
sendNext: function(obj){
@@ -554,7 +554,7 @@ var Player = {
setBGimage: function(c){
var color = c.color;
if(window.location.pathname != "/") {
if(window.location.pathname != "/" && ((offline && c.only) || (!offline && !c.only))) {
document.getElementById("main-container").style.backgroundColor = Helper.rgbToHsl(color,true);
$("meta[name=theme-color]").attr("content", Helper.rgbToHex(color[0], color[1], color[2]));
var new_color = Helper.rgbToHex(color[0], color[1], color[2]);
@@ -677,9 +677,9 @@ var Player = {
if(Player.player.getCurrentTime() > Player.np.end && Player.player.getPlayerState() == YT.PlayerState.PLAYING) {
end_programmatically = true;
Player.player.pauseVideo();
if(!offline) {
Player.player.pauseVideo();
socket.emit("end", {id: video_id, channel: chan.toLowerCase(), pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true)});
} else {
Player.playNext();