This can be done with a few very easy steps using Javascript and Canvas Element:
HTML:
<video autoplay id="previewVideo" data-videoid="JYpUXXD4xgc"> <source src="video.php?videoid=JYpUXXD4xgc" type="video/mp4"/> </video> <canvas id="bigVideo"></canvas>
JavaScript:
document.addEventListener('DOMContentLoaded', function(){ var v = document.getElementById('previewVideo'); var canvas = document.getElementById('bigVideo'); var context = canvas.getContext('2d'); var cw = Math.floor(canvas.clientWidth); var ch = Math.floor(canvas.clientHeight); canvas.width = cw; canvas.height = ch; v.addEventListener('play', function(){ updateBigVideo(this,context,cw,ch); },false); },false); function updateBigVideo(v,c,w,h) { if(v.paused || v.ended) return false; c.drawImage(v,0,0,w,h); setTimeout(updateBigVideo,20,v,c,w,h); }
The canvas retrieves the video image and displays it again on BigVideo.
The updateBigVideo() function is called every 20 ms, which results in a frame rate of about 50 FPS.
More details here: http://html5doctor.com/video-canvas-magic/
Glabbichrulz
source share