Skip to content

feat(documentPiP): auto open on tab switch and trigger button#17450

Draft
bandhan-majumder wants to merge 1 commit into
jitsi:gsoc2026-document-pipfrom
bandhan-majumder:document-pip
Draft

feat(documentPiP): auto open on tab switch and trigger button#17450
bandhan-majumder wants to merge 1 commit into
jitsi:gsoc2026-document-pipfrom
bandhan-majumder:document-pip

Conversation

@bandhan-majumder

Copy link
Copy Markdown
Contributor

description

This PR contains the opening and closing of the window through the button and the media session api (tab switch). This introduces some changes and refactor to the existing functions as well. Contents are not yet.

video demo:

Screencast.From.2026-06-02.02-05-58.mp4

video shows this:

prejoin auto tab switch triggers document pip
button successfully opens and changes label based on the active/inactive state
auto opens on tab switch duing meeting and closes when tab comes in focus

pip?: {
disabled?: boolean;
showOnPrejoin?: boolean;
documentPiP: {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so common properties like disabled or should we show on prejoin or not, is kept as it is. added documentPiP for properties related to that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me in general

*
* @returns {React.ReactElement}
*/
function DocumentPiPContent() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be more polished I think

@jitsi-jenkins

Copy link
Copy Markdown

Hi, thanks for your contribution!
If you haven't already done so, could you please make sure you sign our CLA (https://jitsi.org/icla for individuals and https://jitsi.org/ccla for corporations)? We would unfortunately be unable to merge your patch unless we have that piece :(.

};
}

export function enterPiP() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to reuse existing showPiP function only. But the guard shouldShowPiP() is preventing for tab switch cases as we want to always open it. This can be merged together I think

}

try {
const pipWindow = await (window as any).documentPictureInPicture.requestWindow({

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this "any" types are intentional as it's showing type error other wise. Should I just use ts ignore ? or keep it as any?

* Document Picture-in-Picture utility functions.
*/

declare global {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this global is not required too. Can be removed in the enhancements as well : )

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe I should rename it to PiPActionButton ?

@hristoterezov hristoterezov Jun 5, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have preference. both sounds OK to me.

override _handleClick() {
const { dispatch } = this.props;
sendAnalytics(createToolbarEvent('picture-in-picture'));
dispatch(enterPiP());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this handle only the enterPip use case. I see you've added some strings for close but is this implemented?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I have added that too


try {
// @ts-ignore - enterpictureinpicture is a newer MediaSession action.
navigator.mediaSession.setActionHandler('enterpictureinpicture', async (details: any) => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

media session

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants