<html>
<meta http-equiv="content-type" charset="utf-8">
<head>
<title>JavaScript Camera Test</title>
</head>
<body>
	
	<div id="VideoView"></div>
	
	<script language="JavaScript">
		
		const cameraSize = { w: 640, h: 480 };
		const resolution = { w: 640, h: 480 };
		let video;
		let media;
		
		video          = document.createElement('video');
		video.id       = 'video';
		video.width    = cameraSize.w;
		video.height   = cameraSize.h;
		video.autoplay = true;
		document.getElementById('VideoView').appendChild(video);
		
		media = navigator.mediaDevices.getUserMedia(
			{ audio:
				false
			, video:
				{ width : { ideal: resolution.w }
				, height: { ideal: resolution.h }
				}
			}
		).then( function(stream)
			{
				video.srcObject = stream;
			}
		);
		
	</script>
	
</body>
</html>
<< 広告 >>