Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>there a way using HTML5, Original link <a href="http://jsfiddle.net/vphyr/" rel="nofollow noreferrer">http://jsfiddle.net/vphyr/</a>` <br /></p> <pre><code>&lt;input type="button" id="capture" value="Capture" /&gt; Press play, and then start capturing &lt;div id="screen"&gt;&lt;/div&gt;` </code></pre> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var VideoSnapper = { /** * Capture screen as canvas * @param {HTMLElement} video element * @param {Object} options = width of screen, height of screen, time to seek * @param {Function} handle function with canvas element in param */ captureAsCanvas: function(video, options, handle) { // Create canvas and call handle function var callback = function() { // Create canvas var canvas = $('&lt;canvas /&gt;').attr({ width: options.width, height: options.height })[0]; // Get context and draw screen on it canvas.getContext('2d').drawImage(video, 0, 0, options.width, options.height); // Seek video back if we have previous position if (prevPos) { // Unbind seeked event - against loop $(video).unbind('seeked'); // Seek video to previous position video.currentTime = prevPos; } // Call handle function (because of event) handle.call(this, canvas); } // If we have time in options if (options.time &amp;&amp; !isNaN(parseInt(options.time))) { // Save previous (current) video position var prevPos = video.currentTime; // Seek to any other time video.currentTime = options.time; // Wait for seeked event $(video).bind('seeked', callback); return; } // Otherwise callback with video context - just for compatibility with calling in the seeked event return callback.apply(video); } }; $(function() { $('video').bind('video_really_ready', function() { var video = this; $('input').click(function() { var canvases = $('canvas'); VideoSnapper.captureAsCanvas(video, { width: 160, height: 68, time: 40 }, function(canvas) { $('#screen').append(canvas); if (canvases.length == 4) canvases.eq(0).remove(); }) }); }); });</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"&gt;&lt;/script&gt; &lt;video id="video" controls preload="none" width="640" poster="http://media.w3.org/2010/05/sintel/poster.png" onloadedmetadata="$(this).trigger('video_really_ready')"&gt; &lt;source id='mp4' src="http://media.w3.org/2010/05/sintel/trailer.mp4" type='video/mp4' /&gt; &lt;source id='webm' src="http://media.w3.org/2010/05/sintel/trailer.webm" type='video/webm'/&gt; &lt;source id='ogv' src="http://media.w3.org/2010/05/sintel/trailer.ogv" type='video/ogg' /&gt; &lt;/video&gt; &lt;br /&gt; &lt;input type="button" id="capture" value="Capture" /&gt; Press play, and then start capturing &lt;div id="screen"&gt;&lt;/div&gt;</code></pre> </div> </div> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload