video js toggle play pause

JavaScript
function playPause() {
 var video = document.querySelector("video");
 if (video.paused)
   video.play(); 
 else 
   video.pause();
}

Source

Also in JavaScript: