doctypehtml/videocanvas.html

48 lines
1006 B
HTML
Raw Normal View History

2011-02-05 05:40:18 +00:00
<!doctype html>
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(function() {
$('#do').click(function() {
var code = $('#testCode').val();
eval(code);
});
});
</script>
<style type="text/css">
#testCode {
width: 500px;
height: 300px;
font-size: 20px;
}
#video1 {
width: 320px;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="preview">
<video id="video1" class="testvideo" src="test1.ogg" controls="controls"></video>
<canvas id="canvas" width="320" height="240"></canvas>
</div>
<div id="txtWrap">
<textarea id="testCode">
var canvas = document.querySelector("canvas");
var ctx = canvas.getContext("2d");
var video = document.getElementById("video1");
ctx.drawImage(video, 0, 0, video.width, video.height, 0, 0, canvas.width, canvas.height);
</textarea><br />
<button id="do">Do</button>
</div>
</div>
</body>
</html>