Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Colab workaround to web components troubleshooting docs #1158

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/web-components/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,16 @@ You can fix this Trusted Types error by disabling Trusted Types in the security
)
)
```

## Colab

### Site level user permissions

Some APIs like [`navigator.mediaDevices.getUserMedia()`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia) require that users grant permission through a browser prompt. Colab attempts to detect if a code cell requires user permission, but this detection does not work for Mesop apps running in Colab using `me.colab_run()`.

As a workaround, use the IPython `%%javascript` cell magic to trigger a user permission prompt. Once permission is granted, it applies to all cells in the notebook. For example, to request the `microphone` permission, create a new code cell and run the following code:

```
%%javascript
navigator.mediaDevices.getUserMedia({audio: true, video: false});
```
Loading