001/* 002 * #%L 003 * GwtMaterial 004 * %% 005 * Copyright (C) 2015 - 2017 GwtMaterialDesign 006 * %% 007 * Licensed under the Apache License, Version 2.0 (the "License"); 008 * you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 * #L% 019 */ 020package gwt.material.design.addins.client.camera.base; 021 022import gwt.material.design.addins.client.camera.events.CameraCaptureHandler; 023 024public interface HasCameraActions { 025 026 /** 027 * <p> 028 * Starts the video stream from the camera. This is called when the component is loaded. 029 * Use {@link CameraCaptureHandler}s to be notified when the stream actually starts or if 030 * an error occurs. 031 * </p> 032 * <p> 033 * At this point the user is requested by the browser to allow the application to use the camera. 034 * If the user doesn't allow it, an error is notified to the {@link CameraCaptureHandler}s. 035 * </p> 036 */ 037 void play(); 038 039 /** 040 * Pauses the video stream from the camera. 041 */ 042 void pause(); 043 044 /** 045 * Stops all the Tracks that is currently streaming 046 */ 047 void stop(); 048 049 /** 050 * Captures the current frame of the video to an image data URL. It's the same as calling 051 * {@link gwt.material.design.addins.client.camera.MaterialCameraCapture#captureToDataURL(String)} using "image/png". 052 * 053 * @return The Data URL of the captured image, which can be used as "src" on an "img" element 054 * or sent to the server 055 */ 056 String captureToDataURL(); 057 058 /** 059 * Captures the current frame of the video to an image data URL. 060 * 061 * @param mimeType The type of the output image, such as "image/png" or "image/jpeg". 062 * @return The Data URL of the captured image, which can be used as "src" on an "img" element 063 * or sent to the server 064 */ 065 String captureToDataURL(String mimeType); 066}