$('#example').photobooth().on("image",function( event, dataUrl ){
$( "#gallery" ).append( '<img src="' + dataUrl + '" >');
});
container = document.getElementById( "example" );
gallery = document.getElementById( "gallery" );
myPhotobooth = new Photobooth( container );
myPhotobooth.onImage = function( dataUrl ){
var myImage = document.createElement( "img" );
myImage.src = dataUrl;
gallery.appendChild( myImage );
};
Photobooth is supported in all browsers that support navigator.getUserMedia. In Firefox some features are disabled for performance reasons. To override this use forceHSB. Please note: For earlier versions of Firefox it might be necessary to set navigator.media.enabled in about:config to true.
since 21 | since 17 | no | since 12 | no |
Creates the photobooth in the specified DOMElement. If the provided DOMElement isn't attached yet, resize() needs to be called to set Photobooth's size.
$( '#example' ).photobooth();
myPhotobooth = new Photobooth( document.getElementById( "container" ) );
The function that Photobooth calls when the user clicks the camera icon. Receives a dataUrl string as an argument
$( '#example' ).on( "image", function( event, dataUrl ){
// do stuff...
});
myPhotobooth.onImage = function( dataUrl ){
// do stuff...
};
Resizes the photobooth to the specified width and height ( in Pixel );
$( '#example' ).data( "photobooth" ).resize( 400, 300 );
myPhotobooth.resize( 400, 300 );
Closes the videostream, cancels the canvas drawing loop and frees up the webcam. Use resume() to continue
$( '#example' ).data( "photobooth" ).pause();
myPhotobooth.pause();
Resumes video playback that had previously been paused with pause().
$( '#example' ).data( "photobooth" ).resume();
myPhotobooth.resume();
Destroys the photobooth. Closes the video stream, cancels all outstanding frames and destroys the DOM elements and eventlisteners.
$( '#example' ).data( "photobooth" ).destroy();
myPhotobooth.destroy();
Photobooth's hue/saturation/brightness adjusment is by default turned of in Firefox for performance reasons. In order to override this setting, set forceHSB to true.
$( '#example' ).data( "photobooth" ).forceHSB = true;
myPhotobooth.forceHSB = true;
is true if the browser supports webcams ( getUserMedia ) and false if not.
if( !$( '#example' ).data( "photobooth" ).isSupported )
{
// do stuff...
}
if( !myPhotobooth.isSupported )
{
// do stuff...
}