fixed some issues with switching channels and host-mode enabling

This commit is contained in:
Kasper Rynning-Tønnesen
2018-07-01 22:26:29 +02:00
parent 8b513f5582
commit 8b9069b8be
4 changed files with 20 additions and 12 deletions

View File

@@ -177,8 +177,12 @@ var Channel = {
Playercontrols.initYoutubeControls(Player.player); Playercontrols.initYoutubeControls(Player.player);
Playercontrols.initSlider(); Playercontrols.initSlider();
if(player_ready) { if(player_ready) {
Player.player.setVolume(Crypt.get_volume()); try {
Player.soundcloud_player.setVolume(embed ? 1 : Crypt.get_volume() / 100); Player.player.setVolume(Crypt.get_volume());
} catch(e){}
try {
Player.soundcloud_player.setVolume(embed ? 1 : Crypt.get_volume() / 100);
} catch(e){}
} }
Helper.removeClass(".video-container", "no-opacity"); Helper.removeClass(".video-container", "no-opacity");
var codeURL = "https://remote."+window.location.hostname+"/"+id; var codeURL = "https://remote."+window.location.hostname+"/"+id;

View File

@@ -552,10 +552,10 @@ function enable_host_mode(enabled) {
} }
Helper.css("#fullscreen", "display", "block"); Helper.css("#fullscreen", "display", "block");
hostMode = false; hostMode = false;
document.addEventListener('webkitfullscreenchange', exitHandler, false); document.removeEventListener('webkitfullscreenchange', exitHandler, false);
document.addEventListener('mozfullscreenchange', exitHandler, false); document.removeEventListener('mozfullscreenchange', exitHandler, false);
document.addEventListener('fullscreenchange', exitHandler, false); document.removeEventListener('fullscreenchange', exitHandler, false);
document.addEventListener('MSFullscreenChange', exitHandler, false); document.removeEventListener('MSFullscreenChange', exitHandler, false);
} }
List.dynamicContentPageJumpTo(-10); List.dynamicContentPageJumpTo(-10);
} }
@@ -781,6 +781,7 @@ function change_offline(enabled, already_offline){
} }
function resizePlaylistPlaying(playing) { function resizePlaylistPlaying(playing) {
if(document.querySelector("#wrapper") == null) return;
if(window.innerWidth < 601) { if(window.innerWidth < 601) {
var subtract = 0; var subtract = 0;
if(playing) { if(playing) {

View File

@@ -153,6 +153,7 @@ var List = {
}, },
populate_list: function(msg, no_reset) { populate_list: function(msg, no_reset) {
if(document.querySelector("#wrapper") == null) return;
// This math is fucked and I don't know how it works. Should be fixed sometime // This math is fucked and I don't know how it works. Should be fixed sometime
if(!Helper.mobilecheck() && !embed && !client){ if(!Helper.mobilecheck() && !embed && !client){
List.can_fit = Math.round(Helper.computedStyle("#wrapper", "height") / 71); List.can_fit = Math.round(Helper.computedStyle("#wrapper", "height") / 71);

View File

@@ -91,11 +91,13 @@ var Player = {
setThumbnail: function(conf, video_id) { setThumbnail: function(conf, video_id) {
if(embed) return; if(embed) return;
if(!conf.hasOwnProperty("thumbnail") || conf.thumbnail == "") { if(!conf.hasOwnProperty("thumbnail") || conf.thumbnail == "") {
if(videoSource == "soundcloud") { try {
document.getElementById("thumbnail_image").innerHTML = "<img id='thumbnail_image_channel' src='" + full_playlist[full_playlist.length - 1].thumbnail + "' alt='thumbnail' />"; if(videoSource == "soundcloud" && full_playlist != undefined) {
} else { document.getElementById("thumbnail_image").innerHTML = "<img id='thumbnail_image_channel' src='" + full_playlist[full_playlist.length - 1].thumbnail + "' alt='thumbnail' />";
document.getElementById("thumbnail_image").innerHTML = "<img id='thumbnail_image_channel' src='https://img.youtube.com/vi/"+video_id+"/mqdefault.jpg' alt='thumbnail' />"; } else {
} document.getElementById("thumbnail_image").innerHTML = "<img id='thumbnail_image_channel' src='https://img.youtube.com/vi/"+video_id+"/mqdefault.jpg' alt='thumbnail' />";
}
} catch(e) {}
} }
}, },
@@ -828,7 +830,7 @@ var Player = {
onYouTubeIframeAPIReady: function() { onYouTubeIframeAPIReady: function() {
Player.player = new YT.Player('player', { Player.player = new YT.Player('player', {
videoId: video_id, videoId: video_id,
playerVars: { rel:"0", wmode:"transparent", controls: "0" , fs: "0", iv_load_policy: "3", theme:"light", color:"white", showinfo: 0}, playerVars: { rel:"0", autoplay: 1, wmode:"transparent", controls: "0" , fs: "0", iv_load_policy: "3", theme:"light", color:"white", showinfo: 0},
events: { events: {
'onReady': Player.onPlayerReady, 'onReady': Player.onPlayerReady,
'onStateChange': Player.onPlayerStateChange, 'onStateChange': Player.onPlayerStateChange,