Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Add an HTML5 <code>&lt;video&gt;</code> tag to your DOM with the appropriate <code>&lt;source&gt;</code> tags. Assign the video element to a variable. Create a <code>Kinetic.Image</code> for your video to play on. Then play the video by clicking on some object (maybe the image, maybe a "play" button you placed on the stage) and use the following function to draw the video to the image. For best results, hide the video by placing it absolutely offscreen. The image can be any size, but to prevent distortion, the image should be the same aspect ratio as the video.</p> <pre><code>$('body').append('&lt;div id="video' + vid + '" class="offscreen"&gt;&lt;/div&gt;'); var vidobj = '&lt;video width="' + vw + '" height="' + vh + ' preload="auto"&gt;&lt;source src="' + vsrc + '" type="video/mp4"&gt;&lt;/source&gt;&lt;/video&gt;'; $('#video' + vid).html(vidobj); var video = $('#video' + vid + ' &gt; video').get(0); var img = new Kinetic.Image({name : 'video', x : vx, y : vy, width : vw, height : vh, image : video}); layer.add(img); video.play(); setVideo(video,img); function setVideo(v,i) { if (!v.paused &amp;&amp; !v.ended) { i.setImage(v); cvsObj.modal.draw(); setTimeout(setVideo,20,v,i); } } </code></pre> <p>v = your video, i = the image object.</p> <p>EDITED to show creation of HTML5 video tag and Kinetic.Image(). Variables : vid = video id (unique), vw = video width, vh = video height, vx = video x coordinate (for canvas), vy = video y coordinate, vsrc = video source (path to file).</p>
 

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