Webcam
HTML5 webcam for Vaadin 7
Webcam allows you to capture images from the web camera. This add-on uses only JavaScript, so no Flash plug-in is required from the browser.
Currently works only with Google Chrome (also on Android) and Mozilla Firefox.
Sample code
private File targetFile; @Override protected void init(VaadinRequest request) { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); setContent(layout); // Create the webcam and assign a receiver. final Webcam webcam = new Webcam(); webcam.setWidth("400px"); webcam.setReceiver(new Receiver() { @Override public OutputStream receiveUpload(String filename, String mimeType) { try { targetFile = File.createTempFile(filename, ".jpeg"); targetFile.deleteOnExit(); return new FileOutputStream(targetFile); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } }); // Add an event listener to be called after a successful capture. webcam.addCaptureSucceededListener(new CaptureSucceededListener() { @Override public void captureSucceeded(CaptureSucceededEvent event) { Image img = new Image("Captured image", new FileResource( targetFile)); img.setWidth("200px"); layout.addComponent(img); } }); // Add a button as an alternative way to capture. Button button = new Button( "Click the webcam viewfinder OR here to capture"); button.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { webcam.capture(); } }); layout.addComponent(webcam); layout.addComponent(button); }
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Add support for Chrome on Android.
- Released
- 2015-04-15
- Maturity
- EXPERIMENTAL
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 7.0+
- Browser
- Firefox
- Google Chrome
- Android Browser
Vaadin Icons Add-on - Vaadin Add-on Directory
Enables simple usage of Vaadin Icons in your applicationVaadin Icons Add-on enables you to easily use Vaadin Font Icons in your Vaadin application.
Please see the [README](https://github.com/vaadin/vaadin-icons-addon/blob/master/README.md) file for installation instructions.
NOTE: This add-on has been integrated into Vaadin Framework 8 since 8.0.0.beta2
Issue TrackerSource Code
Vaadin Font Icons
Usage Instructions
Vaadin Icons Add-on version 1.0.1
null
Vaadin Icons Add-on version 2.0.0
100+ new icons
Font files included in add-on