Instantly share code, notes, and snippets.

Embed
What would you like to do?
Push To Talk - Google Meet Bookmarklet

Short link to this page: http://caseywatts.com/ptt

Other gists & tricks: http://caseywatts.com/gists-and-tricks

Push To Talk in a Google Hangout (Meet)

  1. Save this bookmarklet. Right-click on boomarks toolbar Add Page...
    • Name: PTT (push to talk) or whatever you'd like (maybe short so it stays on your bookmarks toolbar)
    • URL: (paste in the bookmarklet.js contents below)
  2. In a Meet, click on the bookmarklet
  3. Press and hold spacebar to talk. Keydown will un-mute you, and keyup will re-mute you.
  4. 🎉
javascript:(function(){
document.body.onkeyup = function(e){
if(e.keyCode == 32){
document.querySelector('[data-tooltip="Turn off microphone"]').click(); // Meet
// document.querySelector('[data-tooltip="Mute microphone"]').click(); // Hangouts, but it doesn't work
}
};
document.body.onkeydown = function(e){
if(e.keyCode == 32){
document.querySelector('[data-tooltip="Turn on microphone"]').click(); // Meet
// document.querySelector('[data-tooltip="Unmute microphone"]').click(); // Hangouts, but it doesn't work
}
};
})();
@adunkman

This comment has been minimized.

adunkman commented Jun 2, 2017

Is $ defined in the page?

If you’re using Chrome, the developer tools define $ for you — https://developers.google.com/web/tools/chrome-devtools/console/command-line-reference#queryselector — but it’s not present in the page.

If that’s the case, you should be able to replace it with:

document.querySelector('[data-tooltip~="microphone"]').click();
@caseywatts

This comment has been minimized.

Owner

caseywatts commented Jun 2, 2017

@adunkman my hero! :D

@co0l3y

This comment has been minimized.

co0l3y commented Nov 2, 2017

Does this work for anyone? Can't get it to work in google meet or hangouts.

@caseywatts

This comment has been minimized.

Owner

caseywatts commented Nov 22, 2017

it stopped working for me at some point, and I haven't gotten it working again :/

I've been using this desktop one instead, which works across even more videochat apps (except for Zoom, unfortunately): https://github.com/yulrizka/osx-push-to-talk

@sparksm

This comment has been minimized.

sparksm commented Jul 11, 2018

javascript: (() => {
  const toggle = tip => ({ key }) =>
    key === ' ' && document.querySelectorAll('[data-tooltip]').forEach(el => el.dataset.tooltip === tip && el.click());
  document.body.onkeyup = toggle('Turn off microphone');
  document.body.onkeydown = toggle('Turn on microphone');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment