A Pen by Marc Grabanski

Thumbnail
This awesome code was written by 1Marc, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright 1Marc ©
  • HTML
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>A Pen by  Marc Grabanski</title>
  
  
  
  
  
</head>

<body>

  <video preload="auto" width="480" height="270" 
 poster="http://www.jplayer.org/video/poster/Big_Buck_Bunny_Trailer_480x270.png" id="my-video">
	<source src="http://jPlayer.org/video/webm/Big_Buck_Bunny_Trailer.webm " >
	<source src="http://jPlayer.org/video/ogv/Big_Buck_Bunny_Trailer.ogv" >
	<source src="http://jPlayer.org/video/m4v/Big_Buck_Bunny_Trailer.m4v " >
</video>

<div>
<a href="#" id="play">Play</a>
<a href="#" id="pause">Pause</a>
</div>
  
  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/1Marc/a-pen-by-marc-grabanski-fcpgz */
window.onload = function(){
  var video = document.getElementById('my-video');
  var play = document.getElementById('play');
  var pause = document.getElementById('pause');
	
  // associate functions with the 'onclick' events
  play.onclick = playVideo;
  pause.onclick = pauseVideo;
	
  function playVideo(e) {
    e.preventDefault();
    video.play();
  }
	
  function pauseVideo(e) {
    e.preventDefault();
    video.pause();
  }
}

Comments