HELP Programming the video player whats wrong with my code

+2 paul gares · November 1, 2016

<!Doctype html>

<html lang="en">
<head>
<title>html5</title>
<meta charset="utf-8">
<link rel="stylesheet" href="paul.css">
<script>
function first(){

barSize=600;

video=document.getElementById('video');

play = document.getElementById('play');

defaultBar= document.getElementById('defaultBar');

progressBar=document.getElementById('progressBar');

play.addEventListener('click',pause,false);

progressBar.addEventListener('click',click,false);

}

function pause(){

if(!video.paused && !video.ended){
video.pause();
play.innerHTML='play';
window.clearInterval(updateBar);
}

else{
video.play();
play.innerHTML='pause';
updateBar=SetInterval(update,500);
}
}

function update(){

if(!video.ended){
var sizes=parseInt(video.currentTime*barSize/video.duration);
progressBar.style.width=sizes+'px';
}

else{
progressBar.style.width='0px';
play.innerHTML='play';
window.clearInterval(updateBar);
}
}

function click(e){
if(!video.paused && !video.ended){
var mouseX=e.pageX-bar.offsetLeft;
var newTime=mouseX*video.duration/barSize;
video.currentTime=newTime;
progressBar.style.width=mouseX+'px';
}
}

window.addEventListener('load',first,false);

</script>
</head>
<body>

<section id="wrapper">
<video src="king paul pulgares.3gp" id="video" width="640px" height="350px"></video>

<nav>

<div id="buttons">

<button type="button" id="play">play</button>
</div>

<div id="defaultBar">
<div id="progressBar"></div>
</div>

<div style="clear:both;"></div>

</nav>

</section>

</body>
</html>

Post a Reply

Replies

Oldest  Newest  Rating
+1 Dhruv Singhal · January 22, 2017
what error are you facing??
  • 1

HTML / CSS / Web Design

129,802 followers
About

Discuss, share, ask, learn and teach HTML5 and CSS3.

Links
Moderators