@snap/camera-kit
Version:
Camera Kit Web
29 lines (21 loc) • 949 B
Markdown
[**CameraKit Web SDK v1.17.0**](../README.md)
***
[](../globals.md) / LensVideoPlaybackMutedError
> **LensVideoPlaybackMutedError**: `NamedError`\<`"LensVideoPlaybackMutedError"`\>
This error occurs when a Lens attempts to play video, but the browser blocks audio playback due to autoplay policies.
The video will still play, but in a muted state.
Applications should handle this error by showing an unmute button or similar UI element,
allowing the user to interact with the page and then unmute audio.
```ts
cameraKitSession.events.addEventListener('error', ({ detail }) => {
if (detail.error.name === 'LensVideoPlaybackMutedError') {
// Show an unmute button that calls session.unmute() on user interaction
unmuteButton.style.display = 'block'
unmuteButton.onclick = () => {
cameraKitSession.unmute()
unmuteButton.style.display = 'none'
}
}
})
```