Capture
Browser Support
Basic Camera and Microphone Capture
<div {{ stimulus_controller('@pwa/capture') }}>
<video id="preview" autoplay playsinline></video>
<button {{ stimulus_action('@pwa/capture', 'media', 'click', {constraints: {audio: true, video: true}}) }}>
Start Camera
</button>
<button {{ stimulus_action('@pwa/capture', 'stop', 'click') }}>
Stop Capture
</button>
</div>
<script>
document.addEventListener('pwa--capture:recorder:start', (event) => {
document.getElementById('preview').srcObject = event.detail.stream;
});
</script>Screen Capture with Recording
Capture with Region Restriction
Parameters
For the media Action
media ActionFor the capture Action
capture ActionFor the record Action
record ActionActions
Targets
Events
Best Practices
Last updated
Was this helpful?