I am trying to use the canvas drawImage method with a video source, but it does not work in Android 4.4.2, tested in Chrome browser.
Here is my code:
$(function() { var canvas = document.getElementById('canvas'); var ctx = canvas.getContext('2d'); var video = document.getElementById('video'); var videoWidth; var videoHeight; var paused = false; canvas.addEventListener('click', function() { if (paused) { video.play(); } else { video.pause(); } paused = !paused; }); video.addEventListener("loadedmetadata", function() { videoWidth = this.videoWidth || this.width; videoHeight = this.videoHeight || this.height; canvas.width = videoWidth; canvas.height = videoHeight; }, false); video.addEventListener('play', function() { var $this = this;
Fiddle: http://jsfiddle.net/h1hjp0Lp/
Is there a way to make it work with Android and iOS devices?
source share