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

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

Introduction

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

Prototype

public final native int getVideoHeight() ;

Source Link

Document

Gets the intrinsic height of video within the element.

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.
 *///from   w w  w .j a va 2s .  c om
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);
}