Firefox 16 now supports HTML5 getUserMedia. It enables access to webcam without any plugins.
There is an entry in about:config, set that to true. In case you need to add a new entry then:
- open about:config
- Right click any entry.
- Select ‘New‘ >> ‘Boolean‘
Add the following entry and set it true:
media.navigator.enabled
Remember to define callback methods right within the getUserMedia() method as shown below:
navigator.getUserMedia(gumOptions,
function successCallback(stream) {
// Replace source of video element with stream from camera
if(navigator.getUserMedia==navigator.mozGetUserMedia) {
video.src = stream;
} else {
video.src = window.URL.createObjectURL(stream) || stream;
}video.play();
},
function errorCallback(error) {
console.error(‘An error occurred: [CODE ‘ + error.code + ‘]’);
video.play();
});
It won’t works in-case you defined it elsewhere. No need to use CreateObjectURL to pass the stream the video element. Pass the stream directly. video.src=stream
Paul Rouget of Mozilla, created a video tutorial demonstrating HTML5 getUserMedia: