I need to add video to the stage and then play on mouse click using kineticjs.
I searched a lot for this but have not found any working code
Thanks
I need to add video to the stage and then play on mouse click using kineticjs.
I searched a lot for this but have not found any working code
Thanks
why does video have to be inside the stage? Couldn't you just place an HTML5 video element on top of the stage?
Add an HTML5
<video>
tag to your DOM with the appropriate<source>
tags. Assign the video element to a variable. Create aKinetic.Image
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.v = your video, i = the image object.
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).