PhotoBooth JS Methods

You can control your <photobooth> using our Javascript API. Below is a full list of the available methods.

How do I call methods on a PhotoBooth instance?
connect
disconnect
setMetadata
takePicture
select_filter
getPhoto
publish
selectDevices

How do I call methods on a PhotoBooth instance?

You can get your camera's JS instance by accessing it in the CameraTag photobooths array once the PhotoBooth has initialized:
CameraTag.observe(YOUR_BOOTH_ID, "initialized", function(){
  myBooth = CameraTag.photobooths["YOUR_BOOTH_ID"];
}) 
Note that the BOOTH_ID listed above should match the 'id' attribute of the <photoboth> tag and not the app id ('data-app-id' attribute).

Once you have the instance calling methods is as simple as

myBooth.connect();

connect()

Connects the booth to the computer's webcam.

disconnect()

Disconnect the booth from the computer's webcam

setMetadata( js_object )

Allows you to pass arbitrary data to be stored with your photo on our server. This data will be returned as part of the photo object in the REST API and server callbacks.

takePicture()

Snap a photo from a connected booth (see connect above)

select_filter()

Select a filter to be previewed when reviewing / editing a photo (by index)

publish()

Publish a photo to the CameraTag servers.

getPhoto()

Get information (JS Object) about the recently published image (populated after publish)

selectDevices()

loads the device selection screen and allows the user to select a camera / microphone to use when recording.