-
Notifications
You must be signed in to change notification settings - Fork 34
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
Enable PiP (picture in picture) mode programmatically in Prebuilt UI #232
Comments
@ahkhanjani This will likely not work as you intend it to, because the Picture-in-Picture browser API requires execution from a user gesture (e.g. a button click). Otherwise it throws an error:
I will answer the community thread, too, as I've missed it so far. |
Hi @Regaddi. So would it be ok if it was called on a button click event? E.g. clicking on an in-app tab. We don't intend to automatically turn it on (for example on browser tab change). So having this feature will only benefit our use case. We could technically do some magical weird CSS tricks to shrink the Daily window and move it around but it's definitely not something we'd want when the PiP feature is already built into Daily Prebuilt, and also I'm not sure how Daily's styles would react to that compared to PiP. It'll save us a lot of trouble, and actually without it our current feature will be impossible to make. I'd appreciate it if you would consider it. Best regards |
I tested something just to have tried. Instead of triggering PiP directly, I tried to programmatically click on the PiP toggle button: <button
onClick={() => {
const pipButton = document
.getElementsByTagName("iframe")[0]
?.contentWindow?.document.getElementById("topbar-pip-toggle");
if (!pipButton) return;
pipButton.click();
}}
>
Open PiP
</button> It doesn't work because of iframe cross-origin security:
It's just an experiment that I wanted to share. I still think we should have the trigger function available if it's possible to trigger on click. |
Feature request
The only way to enable PiP seems to be a button in the UI after enabling this feature. There should be a way to turn it on via a method.
Why you need this
In our use case, we have different tabs in the app. When switching to a tab other than the call tab, we want to enable PiP and vice versa.
Another use case could be what this user mentions.
Additional context
I'm using Daily Prebuilt UI in a currently latest version of Next.js/React.
The text was updated successfully, but these errors were encountered: