mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-12-29 05:21:01 +00:00
Trying to fix durationsetter
This commit is contained in:
4
static/dist/main.min.js
vendored
4
static/dist/main.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -368,7 +368,7 @@ function onepage_load(){
|
|||||||
$("#channel-load").css("display", "block");
|
$("#channel-load").css("display", "block");
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
|
|
||||||
Playercontrols.stopInterval = true;
|
Youtube.stopInterval = true;
|
||||||
|
|
||||||
|
|
||||||
var url_split = window.location.href.split("/");
|
var url_split = window.location.href.split("/");
|
||||||
|
|||||||
@@ -156,29 +156,6 @@ var Playercontrols = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
durationSetter: function()
|
|
||||||
{
|
|
||||||
duration = Youtube.ytplayer.getDuration();
|
|
||||||
console.log(duration)
|
|
||||||
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+"%");
|
|
||||||
}
|
|
||||||
if(!Playercontrols.stopInterval) setTimeout(Playercontrols.durationSetter, 1000);
|
|
||||||
},
|
|
||||||
|
|
||||||
volumeOptions: function()
|
volumeOptions: function()
|
||||||
{
|
{
|
||||||
if(Youtube.ytplayer.isMuted())
|
if(Youtube.ytplayer.isMuted())
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ var Youtube = {
|
|||||||
before_load: "",
|
before_load: "",
|
||||||
after_load: "",
|
after_load: "",
|
||||||
ytplayer: "",
|
ytplayer: "",
|
||||||
|
stopInterval: false,
|
||||||
|
|
||||||
setup_youtube_listener: function(channel)
|
setup_youtube_listener: function(channel)
|
||||||
{
|
{
|
||||||
@@ -53,7 +54,7 @@ var Youtube = {
|
|||||||
}
|
}
|
||||||
if(!paused){
|
if(!paused){
|
||||||
Youtube.ytplayer.playVideo();
|
Youtube.ytplayer.playVideo();
|
||||||
Playercontrols.durationSetter();
|
Youtube.durationSetter();
|
||||||
}
|
}
|
||||||
if(Youtube.ytplayer.getDuration() > seekTo || Youtube.ytplayer.getDuration() == 0)
|
if(Youtube.ytplayer.getDuration() > seekTo || Youtube.ytplayer.getDuration() == 0)
|
||||||
Youtube.ytplayer.seekTo(seekTo);
|
Youtube.ytplayer.seekTo(seekTo);
|
||||||
@@ -165,7 +166,7 @@ var Youtube = {
|
|||||||
$(".playlist").css("opacity", "1");
|
$(".playlist").css("opacity", "1");
|
||||||
Youtube.ytplayer.loadVideoById(video_id);
|
Youtube.ytplayer.loadVideoById(video_id);
|
||||||
Youtube.ytplayer.playVideo();
|
Youtube.ytplayer.playVideo();
|
||||||
Playercontrols.durationSetter();
|
Youtube.durationSetter();
|
||||||
Youtube.ytplayer.seekTo(seekTo);
|
Youtube.ytplayer.seekTo(seekTo);
|
||||||
}
|
}
|
||||||
Youtube.readyLooks();
|
Youtube.readyLooks();
|
||||||
@@ -236,6 +237,30 @@ var Youtube = {
|
|||||||
'onError': Youtube.errorHandler
|
'onError': Youtube.errorHandler
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
//Youtube.durationSetter();
|
||||||
|
},
|
||||||
|
|
||||||
|
durationSetter: function()
|
||||||
|
{
|
||||||
|
//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+"%");
|
||||||
|
}
|
||||||
|
if(!Youtube.stopInterval) setTimeout(Youtube.durationSetter, 1000);
|
||||||
},
|
},
|
||||||
|
|
||||||
loadPlayer: function() {
|
loadPlayer: function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user