Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Display video inside HTML5 canvas
You can try the following code snippet to display video inside HTML5 canvas.
var canvas1 = document.getElementById('canvas');
var context = canvas1.getContext('2d');
var video = document.getElementById('video');
video.addEventListener('play', function () {
var $this = this;
(function loop() {
if (!$this.paused && !$this.ended) {
context.drawImage($this, 0, 0);
setTimeout(loop, 1000 / 30);
}
})();
}, 0);Advertisements