In-browser webcam source via openWebcamCapture()
One call opens a modal that previews the user's webcam, lets them snap a JPEG (mode: 'photo') or record a webm/mp4 clip (mode: 'video'), and resolves with a File ready to drop into the upload queue. No <input type="file"> round-trip, no third-party SDK, no server work.
What you should see: take a photo with the webcam straight into the queue. Auto-upload is off so you can review the shot first; you can also pick an existing file from disk.
First click prompts for camera permission. Press Esc in the modal to cancel.
Drag & drop files here, or paste from clipboard
Browser requirements: secure context (HTTPS or
localhost) and user permission for the camera (and microphone in video mode). Falls back to a descriptive rejected promise if either is unavailable.
JavaScript API
// Photo mode (default) - resolves with image/jpeg.
uploader.openWebcamCapture()
.then(function (file) { uploader.addFile(file); });
// Video mode with mic + 60-second cap.
uploader.openWebcamCapture({
mode: 'video',
audio: true,
maxDurationSec: 60,
mimeType: 'video/webm;codecs=vp9,opus', // optional fileName: 'demo-clip.webm' // optional
}).then(function (file) { uploader.addFile(file); }); What ships
- Modal overlay with live
<video>preview, action buttons, and a status row that ticks the elapsed recording time. - Format negotiation via
MediaRecorder.isTypeSupported- picks the best WebM / MP4 codec the browser supports. - Esc cancels and rejects with
Error('cancelled')- easy to filter out of error logs. - All tracks stop automatically on close to release the camera light.
Pair with the image editor
Webcam -> image editor -> upload is a single Promise chain:
uploader.openWebcamCapture({ mode: 'photo' })
.then(function (file) { return uploader.openImageEditor(file, { aspectRatio: 1 }); })
.then(function (edited) { uploader.addFile(edited); });