Estou desenvolvendo um player de vídeo e esta acontecendo um problema quando carrego outro vídeo, quando abro uma nova div no jquery usando o load do jquery os timer do video bagunçam e ficam piscando os 2 timers do vídeo anterior e do novo vídeo, os timers do vídeo estão nesse código:
-----------------------
I'm developing a video player and a problem is happening when I load another video when I open a new div in jquery using the jquery load video mess up the timer and blink timers 2 of the previous video and the new video, the timers video is in this code:
setInterval(function(){ var current = video.get(0).currentTime; if (parseInt(current)/60>=1) { var h = Math.floor(current / 3600); current = current - h * 3600; var m = Math.floor(current / 60); var s = Math.floor(current % 60); if(h.toString().length<2){h='0'+h;} if(m.toString().length<2){m='0'+m;} if(s.toString().length<2){s='0'+s;} } else { var m = Math.floor(current / 60); var s = Math.floor(current % 60); if(m.toString().length<2){m='0'+m;} if(s.toString().length<2){s='0'+s;} } $('#tempoatual').html(m + ":" + s); var current2 = video.get(0).duration; if (parseInt(current2)/60>=1) { var h = Math.floor(current2 / 3600); current2 = current2 - h * 3600; var m = Math.floor(current2 / 60); var s = Math.floor(current2 % 60); if(h.toString().length<2){h='0'+h;} if(m.toString().length<2){m='0'+m;} if(s.toString().length<2){s='0'+s;} } else { var m = Math.floor(current2 / 60); var s = Math.floor(current2 % 60); if(m.toString().length<2){m='0'+m;} if(s.toString().length<2){s='0'+s;} } $('#tempototal').html(m + ":" + s); },900)
e no começo do script eu dou um append e coloco os timers no browser
-----------------------------
and the beginning of the script I give a append and put timers in browser
$(document).ready(function () { $( "#video" ).append("<div id='tempoatual'></div><div id='tempototal'></div>"); });
e depois eu dou um load:
--------------------
and then I give a load:
$(document).ready(function () { $( "#teste" ).click(function() { $( "#result" ).load( "video1.php" ); }); });
acho q o problema é no append, precisaria limpar a div vídeo antes de dar o append de outro vídeo...
-----------------------
I think the problem is in append, need to clear the div video before giving append another video ...