Example usage for com.google.gwt.dom.client VideoElement getClientHeight

List of usage examples for com.google.gwt.dom.client VideoElement getClientHeight

Introduction

In this page you can find the example usage for com.google.gwt.dom.client VideoElement getClientHeight.

Prototype

@Override
    public int getClientHeight() 

Source Link

Usage

From source file:gwt.material.design.addins.client.camera.MaterialCameraCapture.java

License:Apache License

/**
 * Native call to capture the frame of the video stream.
 *///w  ww.ja v a2  s . co m
protected String nativeCaptureToDataURL(CanvasElement canvas, Element element, String mimeType) {
    VideoElement videoElement = (VideoElement) element;
    int width = videoElement.getVideoWidth();
    int height = videoElement.getVideoHeight();
    if (Double.isNaN(width) || Double.isNaN(height)) {
        width = videoElement.getClientWidth();
        height = videoElement.getClientHeight();
    }
    canvas.setWidth(width);
    canvas.setHeight(height);
    Context2d context = canvas.getContext2d();
    context.drawImage(videoElement, 0, 0, width, height);
    return canvas.toDataUrl(mimeType);
}