Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Google Meet, open your video Picture in Picture mode #bookmarklet
javascript: void ((function(userName = 'You') {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
function findUpElementByDataAttribute(element, attr) {
if (element) {
return element.dataset[attr] ? element : findUpElementByDataAttribute(element.parentElement, attr);
}
}
const usersElements = [...document.querySelectorAll('[data-initial-participant-id] [data-self-name]')];
const userElement = usersElements.find(e => e.textContent.toLowerCase().includes(userName.toLowerCase()));
const element = findUpElementByDataAttribute(userElement, 'initialParticipantId');
const videos = [...element?.querySelectorAll('video')];
const video = videos.find(v => !v.paused);
video?.requestPictureInPicture();
})('%s'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment