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

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

Introduction

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

Prototype

public final native String getSrc() ;

Source Link

Document

Returns the source URL for the media, or null if none is set.

Usage

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

License:Apache License

@Override
protected void onLoad() {
    VideoElement el = getElement().cast();
    if (el.getSrc() == null || el.isPaused()) {
        play();//from   w w  w .ja v a2 s  . c  om
    }
}

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

License:Apache License

/**
 * <p>//from   ww w .  ja v  a2s  .  c  om
 * Starts the video stream from the camera. This is called when the component is loaded.
 * Use {@link CameraCaptureHandler}s to be notified when the stream actually starts or if
 * an error occurs.
 * </p>
 * <p>
 * At this point the user is requested by the browser to allow the application to use the camera.
 * If the user doesn't allow it, an error is notified to the {@link CameraCaptureHandler}s.
 * </p>
 */
public void play() {
    if (!isSupported()) {
        onCameraCaptureError("MaterialCameraCapture is not supported in this browser.");
        return;
    }
    VideoElement el = getElement().cast();
    if (el.getSrc() == null) {
        nativePlay(getElement());
    } else {
        el.play();
    }
}