background preloader

Capturing Audio & Video in HTML5

Capturing Audio & Video in HTML5
Many browsers now have the ability to access video and audio input from the user. However, depending on the browser it might be a full dynamic and inline experience, or it could be delegated to another app on the user's device. On top of that, not every device even has a camera. So how can you create an experience that uses a user generated image that works well everywhere? Start simple and progressively If you want to progressively enhance your experience, you need to start with something that works everywhere. Ask for a URL This is the best supported but least satisfying option. Though, if you want to manipulate the image in any way, things are a bit more complicated. File input You can also use a simple file input element, including an accept filter that indicates you only want image files. This method works on all platforms. <input type="file" accept="image/*" id="file-input"><script> const fileInput = document.getElementById('file-input'); Drag and drop Paste from clipboard if (file ! Tips Related:  kazooskiy

Face detection using HTML5, javascript, webrtc, websockets, Jetty and OpenCV Through HTML5 and the corresponding standards, modern browsers get more standarized features with every release. Most people have heard of websockets that allows you to easily setup a two way communication channel with a server, but one of the specifications that hasn't been getting much coverage is the webrtc specificiation. With the webrtc specification it will become easier to create pure HTML/Javascript real-time video/audio related applications where you can access a user's microphone or webcam and share this data with other peers on the internet. Update: in the newest versions of the webrtc spec we can also access the microphone! As with a lot of HTML5 related specification, the webrtc one isn't quite finished yet, and support amongst browsers is minimal. For this we need to take the following steps: In other words, we're going to create a real-time face detection system, where the frontend is completely provided by 'standard' HTML5/Javascript functionality.

window.scrollBy Méthode : window.scrollBy()Déroule les ascenseursCompatible : Syntaxevoid window.scrollBy(Integer x, Integer y) DescriptionActive l'ascenseur horizontal de x pixels et l'ascenseur vertical de y pixels. Voir aussi scrollTo() pour fixer une position aux ascenseurs. Exemple Ascenseur Code source <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>Partie pour allonger la page<BR><BR><BR><SCRIPTlanguage=javascript>function Scroller(){window.scrollBy(0,100);}setTimeout("Scroller()",500);</SCRIPT> Résultat Partie pour allonger la page ExplicationCe script allonge la page en ajoutant des retours à la ligne et fait descendre le scrolling de 100 pixels au bout de 500 millisecondes.

Controlando nuestra WebCam con HTML5 Un sencillo ejemplo en el que accedemos a nuestra WebCam lo que nos permitirá convertir nuestro navegador web en una cámara de fotos utilizando únicamente HTML5, JavaScript y Canvas. Esto es posible gracias al desarrollo de la API getUserMedia, la cual aún no es soportada en todos los navegadores. Gracias a getUserMedia podremos acceder no solo al control de nuestra cámara sino también al del microfóno, aunque debemos tener en cuenta que la especificación todavía se encuentra en fase de desarrollo (la última actualización del borrador se dio el 12 de diciembre). El mayor inconveniente es el lento soporte que está recibiendo esta API, lo que siginifica que esta aplicación ni siquiera es compatible con muchos de los navegadores modernos. Respecto a Firefox, a día de hoy la gente de Mozilla aún no ha desarrollado la interfaz de usuario para la solicitud de activación de la cámara/micrófono. En realidad el código es más sencillo de lo que podría parecer.

Moqups · Mockups, Wireframes & Prototyping Windows Phone 8 and Continuous Location Tracking in the Background (Pt.2) The first article talked about how to use the new Location API on Windows Phone 8. In it, I did not talk about background tracking. Today I will modify the prior solution to do that and to log events to the output window as well as prevent the UI from being updated while the app is deactivated. Source is available here. We will start with telling the OS that this app can track location in the background. First thing is to open the WMAppManifest.xml file in the XML editor by right-clicking it and selecting Open With. Now we replace the DefaultTask element with the following: 1. 2. 3. 4. 5. Next we add an event handler for the RunningInBackground event. 1. 2. 3. 4. And add an empty handler to App.xaml. 1.private void Application_RunningInBackground(object sender, RunningInBackgroundEventArgs args) We need a way to tell the app that it is running in the background. 1.public static bool InBackground { get; set; } Now we will add the ability to view the state of the app in the debug window. 05. 06.

Camera and Video Control with HTML5 Client-side APIs on mobile and desktop devices are quickly providing the same APIs. Of course our mobile devices got access to some of these APIs first, but those APIs are slowly making their way to the desktop. One of those APIs is the getUserMedia API, providing developers access to the user's camera. Let me show you how to get simple camera access from within your browser! The HTML Please read my note about the HTML structure below: <video id="video" width="640" height="480" autoplay></video><button id="snap">Snap Photo</button><canvas id="canvas" width="640" height="480"></canvas> Each of these elements should be created once confirmation of camera support is confirmed, but for the sake of this tutorial, I wanted to show you what the elements look like with basic HTML. The JavaScript Since the HTML elements above are already created, the JavaScript portion will look smaller than you think: Taking a photo is only marginally more difficult.

A Basic HTML5 Template What follows is an excerpt from HTML5 & CSS3 for the Real World, by Alexis Goldstein, Louis Lazaris and Estelle Weyl. This post was originally published in 2013 and was updated in April 2016. As you learn HTML5 and add new techniques to your toolbox, you’re likely going to want to build yourself boilerplate, from which you can begin all your HTML5-based projects. We encourage this, and you may also consider using one of the many online sources that provide a basic HTML5 starting point for you.[] In this project, however, we want to build our code from scratch and explain each piece as we go along. Let’s start simple, with a bare-bones HTML5 page: <! With that basic template in place, let’s now examine some of the significant parts of the markup and how these might differ from how HTML was written prior to HTML5. The Doctype First, we have the Document Type Declaration, or doctype. And for HTML4 Transitional: Simple, and to the point. The html Element The head Element Note: Encoding Declaration

jQuery webcam plugin The jQuery webcam plugin is a transparent layer to communicate with a camera directly in JavaScript. As there is native support for webcams in modern browsers, it would be great if you could add this feature to the project and use the flash-version as a fallback for older ones. I don't have time for this project at the moment, so a pull request would be great! Overview This plugin provides three different modes to access a webcam through a small API directly with JavaScript - or more precisely jQuery. jQuery webcam example error: No camera was detected. Available Cameras If you activate the filter with the button on the right side of the picture, methods of my already published jQuery plugin xcolor will be used to distort the colors of the Canvas. General information about the interface The following snippet describes the interface of the webcam API: Config Parameter widthThe width of the flash movie. heightThe height of the flash movie. Callback Interface Save Interface webcam.save('/upload.php');

A Simple Trip Meter using the Geolocation API Introduction The Geolocation API lets you find out where the user is and keep tabs on them as they move around, always with the user's consent. This functionality could be used as part of user queries, e.g. to guide someone to a destination point. It could also be used for "geo-tagging" some content the user has created, e.g. to mark where a photo was taken. The API is device-agnostic; it doesn't care how the browser determines location, so long as clients can request and receive location data in a standard way. The underlying mechanism might be via GPS, wifi, or simply asking the user to enter their location manually. The example here is a trip meter showing the initial location and maintaining a display of the distance they have travelled since the page was loaded. Step 1. You can easily check for compatibility by testing for the presence of the geolocation object: // check for Geolocation supportif (navigator.geolocation) { console.log('Geolocation is supported!') Step 2. Step 3.

HTML, native and hybrid - choosing the best approach | FluidUI - iPhone, Android and Windows8 Mobile Mockups One of the questions we get asked a lot about at Fluid UI is whether to use HTML5 or build "native" apps. We highlight the key talking points you need to know to when choosing the right solution for your project or business needs. HTML5: Write once, work everywhere HTML5 allows developers to create rich, internet enabled content across mobile, web and desktop. Going native: The popular choice Native is the most popular approach to building apps. A native app will always have full access to all of a device’s features – Camera, geolocation, address book and eye tracking to name a few. The third way - hybrid apps Hybrid apps combine many of the benefits of both HTML5 and native by creating an app that displays HTML5 content as part of the app. The benefits of mixing the two approaches include: The ability to get your app in the iOS and Android storesThe ability to display full screen appsThe ability to maintain control over your site and to update it easily. Bringing Fluid UI into the equation

HTML5: camera access CSS Background Animations Background animations are an awesome touch when used correctly. In the past, I used MooTools to animate a background position. Luckily these days CSS animations are widely supported enough to rely on them to take over JavaScript-based animation tasks. The following simple CSS snippet animates the background image (via background position) of a given element. We'll use CSS animations instead of transitions for this effect: With the animation code in place, now it's time to apply it to an element with a background image: The cloud background image within the sample element will elegantly scroll from left to right over a duration of 40 seconds, seamlessly repeating an infinite number of times. How epic is it that we don't need to use JavaScript to manage these animations anymore?

Acceder a webcam y micrófono con HTML5 En este artículo te expondré una de las características de HTML5 más potentes: la capacidad de acceder a dispositivos como webcam y micrófono. El ejemplo que usaré es uno de los que expuse en uno de mis seminarios y que forma parte de los ejemplos de HTML5 y CSS3 para descargar aunque explicado en detalle. Ver ejemplo completo Funciona 100% en Chrome El ejemplo pretende que recojamos el audio y vídeo de nuestro dispositivo y los mostremos en un elemento video de HTML5. No es demasiado práctico pero servirá para comprender el funcionamiento. <! Acceso a dispositivos con HTML5 HTML5 nos permite acceder, siempre que el navegador lo permita, a dispositivos como webcam y micrófono a través del método getUserMedia. Como ves comprobamos que cada motor (webkit, microsoft, gecko) puede tener su propio método getUserMedia. navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia; Rating: 8.3/10 (9 votes cast)

Related: