I would like to put the video player on Canvas.
(Since my video is alpha channel and I would like to play the video on jpg)
I made code like this below html
<video id="mainVideo" src="item0.mp4">
</video>
<canvas id="mainCanvas">
</canvas>
my css
#mainCanvas {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 400;
height: 400;
}
#mainVideo {
position: absolute;
top: 300;
left: 300;
margin: -50px 0 0 -50px;
}
my javascript
document.addEventListener('DOMContentLoaded', function(){
var canvas = document.getElementById('mainCanvas');
var context = canvas.getContext('2d');
var img = new Image();
img.src = "image.jpg";
context.drawImage(img, 0,0)
},false);
In my thought,it shows the jpg and video on it.
Howevere, only the jpg appears on it,(video might be concealed by canvas??)
please let me know how can I pay the video on jpg??
My idea (using HTML and canvas together)is correct?