Title

jQuery video controls

description

jQuery commands to control html video like play pause and set properties

Published 2022-08-19

Modified 2022-08-19

content

				
					var video = $('#videocontainer video');
var videocontainer = $('#videocontainer');
				
			
				
					video.prop('currentTime','0');
video.get(0).play();
video.get(0).pause();
				
			
				
					$('#toggle_playpause').click(function(){
    if (video.get(0).paused) {
	    	video.get(0).play();
    } else {
	    	video.get(0).pause();
    }
});
				
			
				
					$('#toggle_visibility_playpause').click(function(){
    if (videocontainer.is(':hidden')) {
            video.prop('currentTime','0');
			video.get(0).play();
		}
	else {
			video.get(0).pause();
		}
    videocontainer.slideToggle();
});