8 Replies Latest reply on Nov 23, 2017 10:04 PM by Nipun Asthana

    How to add a video behind canvas elements and control it?

    NeoInTheMatrix

      I understand that video components in html5 exist as div layers floating above the canvas, so I was wondering how to use a different method.

      I came across a post by ClayUUID with the code posted below


      I have 2 questions about using this :

      1. I added the video path location of my video to this code, and put it in my first frames actions on the top layer in my html5 doc. But nothing is happening, I dont see a video. Am I using the code wrong? 2. How can I go about stopping and hiding / starting and showing the video and changing the size?

       

       

       

      var myClip = makeBitmapVideo(this, "C:/Users/Blah/Downloads/video.mp4"); 

      myClip.video.play(); 

      myClip.rotation = 45; 

       

      // accepts target clip to create bitmap in, file path to video 

      // returns reference to bitmap object, with access to video element via "video" property 

      function makeBitmapVideo(clip, path) { 

          var vid = document.createElement("video"); 

          vid.src = path; 

          var bmp = clip.addChild(new createjs.Bitmap(vid)); 

          bmp.video = vid; 

          return bmp;