0

I have tried:

video.height // never worked
video.offsetHeight // worked when video was visible, now returning 0

for the purpose of showing only a processed video, I keep the video element hidden, and if I am drawing it on the screen in certain intervals, the below code works(even witht eh video hidden),

var video = document.getElementById('someVid');
var canvas = document.getElementById('someCanvas');
var ctx = canvas.getContext('2d');
ctx.drawImage(video, 0, 0, canvas.height, canvas.width);

I need the height and width for some processing, before drawing, so the new draw line would be:

ctx.drawImage(video, x, y, w, h, 0, 0, canvas.height, canvas.width);

for calculation of that x,y,w,h I need hidden video's height, width.

p.s: no need IE support, only firefox and chrome.

mido
  • 24,198
  • 15
  • 92
  • 117

1 Answers1

1

ok, found the solution,

var height = video.videoHeight;
var width =  video.videoWidth;

returns intrinsic values...

source

Community
  • 1
  • 1
mido
  • 24,198
  • 15
  • 92
  • 117