Return to Snippet

Revision: 58045
at June 22, 2012 06:13 by chrisaiv


Initial Code
/***************************************
	D-pad
	***************************************/
	var video = $("video");
	$(window).bind("keydown", onKeyDownHandler );
	function onKeyDownHandler( e ){
		switch( e.keyCode ){
			case 227:
			//fast forward 10 seconds
			video.currentTime += 10;
			break;
			case 228: 
			//rewind by 10 seconds
			video.currentTime -= 10;
			break;
			case 179:
			if( video.paused ) video.play();
			else video.pause();
			break;
		}
	}

Initial URL


Initial Description
If you happen to have a GoogleTV and you want to control <video> using the D-Pad, here's how you do it using a switch case and jQuery.

Initial Title
Javascript: Controlling video using D-Pad control

Initial Tags


Initial Language
JavaScript