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

Learn how error monitoring with Sentry closes the gap between the product team and your customers. With Sentry, you can focus on what you do best: building and scaling software that makes your users’ lives better.

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.

 

What’s the best way to boost the efficiency of your product team and ship with confidence? Check out this ebook to learn how Sentry's real-time error monitoring helps developers stay in their workflow to fix bugs before the user even knows there’s a problem.

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 }}