Skip to content

Commit

Permalink
mise en fonction de la barre de progression et correction readme
Browse files Browse the repository at this point in the history
  • Loading branch information
leknoppix committed Aug 16, 2013
1 parent 1ca1802 commit 63320ae
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Structure HTML:
<img id="photo-pochette" src="http://dummyimage.com/75x75/" />
<span id="titre_album"></span>
<span id="song"></span>
<input type="text" name="valeurtimeline" id="valeurtimeline" />
<br />
<br />
<div class="avancement">
Expand Down
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ <h2>Mon lecteur audio</h2>
<img id="photo-pochette" src="http://dummyimage.com/75x75/" />
<span id="titre_album"></span>
<span id="song"></span>
<input type="text" name="valeurtimeline" id="valeurtimeline" />
<br />
<br />
<div class="avancement">
Expand Down
24 changes: 20 additions & 4 deletions js/lecteur.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,36 @@
});
lecteurarret = function()
{
inittimeline();
$(options.play).show();
$(options.pause).hide();
document.getElementById(audio[current]).pause();
document.getElementById(audio[current]).currentTime=0;
}
lecteuron = function()
{
currentTimeActif=document.getElementById(audio[current]).currentTime;
inittimeline();
changepochette();
$(options.play).hide();
$(options.pause).show();
document.getElementById(audio[current]).play();
$("#valeurtimeline").val(currentTimeActif);
document.getElementById(audio[current]).addEventListener("timeupdate", updateProgress, false);
}
avancement = function()
updateProgress = function()
{
var player=document.getElementById(audio[current]);
var duration = player.duration; // Durée totale
var time = player.currentTime; // Temps écoulé
var fraction = time / duration;
percent = Math.ceil(fraction * 100);
$( ".avancement" ).slider({
orientation: "horizontal",
range: "min",
max: 100,
value: percent,
});
}
timeline = function()
function inittimeline()
{
$( ".avancement" ).slider({
orientation: "horizontal",
Expand All @@ -74,8 +81,12 @@
}
if(options.autoplay==true)
{
$(options.play).hide();
$(options.pause).show();
lecteuron();
}else{
$(options.play).show();
$(options.pause).hide();
changepochette();
}
}
Expand All @@ -90,8 +101,12 @@
}
if(options.autoplay==true)
{
$(options.play).hide();
$(options.pause).show();
lecteuron();
}else{
$(options.play).show();
$(options.pause).hide();
changepochette();
}

Expand All @@ -110,6 +125,7 @@
maxcurrent++;
});
changepochette();
inittimeline();
$(options.play).on('click',function(e)
{
e.preventDefault();
Expand Down

0 comments on commit 63320ae

Please sign in to comment.