Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Opera Adds HTML5 Webcam Input: getUserMedia

DZone's Guide to

Opera Adds HTML5 Webcam Input: getUserMedia

· Web Dev Zone ·
Free Resource

Jumpstart your Angular applications with Indigo.Design, a unified platform for visual design, UX prototyping, code generation, and app development.

The latest builds of Opera now support the 'getUserMedia' HTML5 API.  This allows you to set up an HTML5 <video> as the input for a webcam recording.  



Here's a simple code snippet showing how this works:

// Replace the source of the video element with the stream from the camera
  var video = document.getElementById('sourcevid');
  if (navigator.getUserMedia) {
      navigator.getUserMedia('video', successCallback, errorCallback);
      function successCallback(stream) {
          video.src = stream;
      }
      function errorCallback(error) {
          console.error('An error occurred: [CODE ' + error.code + ']');
          return;
      }
  } else {
      console.log('Native web camera streaming (getUserMedia) is not supported in this browser.');
      return;
  }

Source: http://labs.opera.com/news/2011/10/19/

The other major new feature in the new build is 'Native Pages', which is Opera's own implementation of a feature similar to Safari Reader where you can use CSS3 extensions to split pages of content into book-like pages with page turning arrows.  Check out the post for the full changelist.

 

Take a look at an Indigo.Design sample application to learn more about how apps are created with design to code software.

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}