mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Testing
This commit is contained in:
@@ -11,7 +11,9 @@ var Youtube = {
|
||||
socket.on("np", function(obj)
|
||||
{
|
||||
Youtube.loaded = false;
|
||||
if(video_id != undefined && Youtube.ytplayer !== undefined) Youtube.before_load = Youtube.ytplayer.getVideoUrl();
|
||||
try{
|
||||
if(video_id != undefined && Youtube.ytplayer !== undefined) Youtube.before_load = Youtube.ytplayer.getVideoUrl();
|
||||
}catch(e){}
|
||||
if(obj[0].length == 0){
|
||||
|
||||
document.getElementById('song-title').innerHTML = "Empty channel. Add some songs!";
|
||||
@@ -44,22 +46,25 @@ var Youtube = {
|
||||
//if(player_ready && !window.mobilecheck())
|
||||
if(player_ready && !/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream)
|
||||
{
|
||||
if(Youtube.ytplayer.getVideoUrl().split('v=')[1] != video_id)
|
||||
{
|
||||
Youtube.ytplayer.loadVideoById(video_id);
|
||||
Youtube.notifyUser(video_id, song_title);
|
||||
Youtube.ytplayer.seekTo(seekTo);
|
||||
if(paused)
|
||||
Youtube.ytplayer.pauseVideo();
|
||||
}
|
||||
if(!paused){
|
||||
Youtube.ytplayer.playVideo();
|
||||
Youtube.durationSetter();
|
||||
}
|
||||
if(Youtube.ytplayer.getDuration() > seekTo || Youtube.ytplayer.getDuration() == 0)
|
||||
Youtube.ytplayer.seekTo(seekTo);
|
||||
Youtube.after_load = video_id;
|
||||
setTimeout(function(){Youtube.loaded = true;},500);
|
||||
try{
|
||||
if(Youtube.ytplayer.getVideoUrl().split('v=')[1] != video_id)
|
||||
{
|
||||
Youtube.ytplayer.loadVideoById(video_id);
|
||||
Youtube.notifyUser(video_id, song_title);
|
||||
Youtube.ytplayer.seekTo(seekTo);
|
||||
if(paused)
|
||||
Youtube.ytplayer.pauseVideo();
|
||||
}
|
||||
|
||||
if(!paused){
|
||||
Youtube.ytplayer.playVideo();
|
||||
Youtube.durationSetter();
|
||||
}
|
||||
if(Youtube.ytplayer.getDuration() > seekTo || Youtube.ytplayer.getDuration() == 0)
|
||||
Youtube.ytplayer.seekTo(seekTo);
|
||||
Youtube.after_load = video_id;
|
||||
setTimeout(function(){Youtube.loaded = true;},500);
|
||||
}catch(e){}
|
||||
}
|
||||
else
|
||||
Youtube.getTitle(song_title, viewers);
|
||||
@@ -245,20 +250,24 @@ var Youtube = {
|
||||
//console.log(Youtube.stopInterval);
|
||||
duration = Youtube.ytplayer.getDuration();
|
||||
if(duration != undefined){
|
||||
dMinutes = Math.floor(duration / 60);
|
||||
dSeconds = duration - dMinutes * 60;
|
||||
currDurr = Youtube.ytplayer.getCurrentTime();
|
||||
if(currDurr > duration)
|
||||
currDurr = duration;
|
||||
minutes = Math.floor(currDurr / 60);
|
||||
seconds = currDurr - minutes * 60;
|
||||
document.getElementById("duration").innerHTML = Helper.pad(minutes)+":"+Helper.pad(seconds)+" <span id='dash'>/</span> "+Helper.pad(dMinutes)+":"+Helper.pad(dSeconds);
|
||||
per = (100 / duration) * currDurr;
|
||||
if(per >= 100)
|
||||
per = 100;
|
||||
else if(duration == 0)
|
||||
per = 0;
|
||||
$("#bar").width(per+"%");
|
||||
try{
|
||||
dMinutes = Math.floor(duration / 60);
|
||||
dSeconds = duration - dMinutes * 60;
|
||||
currDurr = Youtube.ytplayer.getCurrentTime();
|
||||
if(currDurr > duration)
|
||||
currDurr = duration;
|
||||
minutes = Math.floor(currDurr / 60);
|
||||
seconds = currDurr - minutes * 60;
|
||||
document.getElementById("duration").innerHTML = Helper.pad(minutes)+":"+Helper.pad(seconds)+" <span id='dash'>/</span> "+Helper.pad(dMinutes)+":"+Helper.pad(dSeconds);
|
||||
per = (100 / duration) * currDurr;
|
||||
if(per >= 100)
|
||||
per = 100;
|
||||
else if(duration == 0)
|
||||
per = 0;
|
||||
$("#bar").width(per+"%");
|
||||
}catch(e){
|
||||
Youtube.stopInterval = true;
|
||||
}
|
||||
}
|
||||
if(!Youtube.stopInterval) setTimeout(Youtube.durationSetter, 1000);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user