- Fixed color-issue on local
- Fixed issue with navigating back in playlist on local
- Fixed issue with starting at the right time on local when start/end had been set
- Fixed issue where changing channel when in local, song wouldn't change
- Fixed issue on previous song not starting at the correct time in local mode
This commit is contained in:
Kasper Rynning-Tønnesen
2018-07-24 23:40:35 +02:00
parent d3e6af4643
commit b3da558336
5 changed files with 19 additions and 10 deletions

View File

@@ -356,12 +356,12 @@ var Frontpage = {
//socket.disconnect();
socket.removeAllListeners();
}
var old_chan = chan;
if(!popstate){
window.history.pushState("to the channel!", "Title", "/" + new_channel);
if(prev_chan_list == "") prev_chan_list = new_channel;
if(prev_chan_player == "") prev_chan_player = new_channel;
window.chan = new_channel;
chan = new_channel;
}
var response = document.createElement("div");
@@ -392,6 +392,7 @@ var Frontpage = {
Helper.addClass(".page-footer", "padding-bottom-novideo");
from_frontpage = true;
if(document.querySelectorAll("#alreadychannel").length == 1){
if(old_chan != new_channel) local_new_channel = true;
Channel.init();
}else{
fromFront = true;

View File

@@ -30,7 +30,7 @@ function getColor(id) {
id: id
}),
success: function(c) {
//c = JSON.parse(c);
c = JSON.parse(c);
if(typeof(c) == "object") {
Player.setBGimage({color:c, only:true});
}

View File

@@ -513,6 +513,8 @@ var List = {
full_playlist.unshift(full_playlist.pop());
full_playlist[full_playlist.length - 1].now_playing = true;
if(full_playlist.length == 1) return;
document.querySelector("#wrapper").children[document.querySelector("#wrapper").children.length - 1].remove();
var length = full_playlist.length - 2;

View File

@@ -5,6 +5,7 @@ var client = false;
if(domain.length > 0 && domain[0] == "client") {
client = true;
}
var local_new_channel = false;
var videoSource;
var dynamicListeners = {};
var socket_connected = false;
@@ -1310,7 +1311,7 @@ window.addEventListener("resize", function(){
var scPlaying = false;
var ytPlaying = false;
try {
ytPlaying = Player.player.getPlayerState() == YT.PlayerState.PLAYING || Player.player.getPlayerState() == YT.PlayerState.BUFFERING;
ytPlaying = Player.player.getPlayerState() == YT.PlayerState.PLAYING || Player.player.getPlayerState() == YT.PlayerState.BUFFERING;
} catch(e) {}
try {
scPlaying = Player.soundcloud_player.isPlaying();

View File

@@ -13,7 +13,7 @@ var Player = {
},
now_playing_listener: function(obj) {
if(offline && video_id != undefined) {
if((offline && !local_new_channel) && video_id != undefined) {
return;
}
if(obj.np != undefined) {
@@ -26,7 +26,7 @@ var Player = {
song_title = obj.np[0].title;
duration = obj.np[0].duration;
if(offline && (video_id == "" || video_id == undefined) && !client){
if(offline && (video_id == "" || video_id == undefined || local_new_channel) && !client){
if(obj.conf != undefined) {
conf = obj.conf[0];
}
@@ -85,6 +85,7 @@ var Player = {
Player.cueVideoById(Player.np.id, duration, Player.np.start, Player.np.end);
}
}
local_new_channel = false;
updateChromecastMetadata();
},
@@ -481,8 +482,8 @@ var Player = {
},
playNext: function(){
if(full_playlist.length == 0) return;
var next_song = full_playlist[0];
if(full_playlist == undefined || full_playlist.length == 0) return;
var next_song = full_playlist[0];
video_id = next_song.id;
time = (new Date()).getTime();
@@ -495,13 +496,15 @@ var Player = {
else start = 0;
if(next_song.hasOwnProperty("end")) end = next_song.end;
else end = duration;
Player.np = next_song;
Player.np.start = start;
Player.np.end = end;
//seekTo = 0;
Player.np.duration = duration;
Player.getTitle(song_title, viewers);
seekTo = start;
//Player.setBGimage(video_id);
if(chromecastAvailable){
loadChromecastVideo();
@@ -509,12 +512,14 @@ var Player = {
chrome.cast.media.GenericMediaMetadata({metadataType: 0, title:song_title, image: 'https://img.youtube.com/vi/'+video_id+'/mqdefault.jpg', images: ['https://img.youtube.com/vi/'+video_id+'/mqdefault.jpg']});
chrome.cast.Image('https://img.youtube.com/vi/'+video_id+'/mqdefault.jpg');
} else {
Player.loadVideoById(video_id, duration, start, end);
}
List.channel_function({type:"song_change", time: time, offline_change: true});
},
playPrev: function() {
if(full_playlist == undefined) return;
var length = full_playlist.length - 2;
if(length < 0) {
length = 0;
@@ -536,7 +541,7 @@ var Player = {
Player.np.start = start;
Player.np.end = end;
Player.np.duration = duration;
seekTo = start;
Player.getTitle(song_title, viewers);
//Player.setBGimage(video_id);