Development/Javascript
미디어파일 재생시 재생퍼센트와 남은시간 표시하기
wansdream
2006. 7. 18. 23:45
예제 http://my.dreamwiz.com/blue8199/1114/32.html
<html>
<head>
<script>
window.onload=mpcount
function mpcount(){
t1= mpl.CurrentPosition;
t2= mpl.SelectionEnd
tm=parseInt( (t2-t1)/60 )
ts=parseInt( (t2-t1) % 60 )
perc=parseInt( (t1/t2)*100 )
document.all["mpc"].innerHTML = perc+"% 실행 -- 남은시간: "+tm+ " 분"+ts+" 초"
if(!tm && !ts && t2>0 )
document.all["mpc"].innerHTML = "-Music End-"
else setTimeout("mpcount()",500)
}
</script>
</head>
<body>
<B><div id="mpc" style="font-size:9pt;"></div></B>
<embed src=http://음악주소.mp3 name=mpl></embed>
</body>
</html>
<html>
<head>
<script>
window.onload=mpcount
function mpcount(){
t1= mpl.CurrentPosition;
t2= mpl.SelectionEnd
tm=parseInt( (t2-t1)/60 )
ts=parseInt( (t2-t1) % 60 )
perc=parseInt( (t1/t2)*100 )
document.all["mpc"].innerHTML = perc+"% 실행 -- 남은시간: "+tm+ " 분"+ts+" 초"
if(!tm && !ts && t2>0 )
document.all["mpc"].innerHTML = "-Music End-"
else setTimeout("mpcount()",500)
}
</script>
</head>
<body>
<B><div id="mpc" style="font-size:9pt;"></div></B>
<embed src=http://음악주소.mp3 name=mpl></embed>
</body>
</html>