Skip to content

Instantly share code, notes, and snippets.

@nenoken
Forked from rothgar/streamyard-tampermonkey.js
Created August 26, 2021 19:05
Show Gist options
  • Save nenoken/c308487f4cf764b2c58e1c239ae0c61d to your computer and use it in GitHub Desktop.
Save nenoken/c308487f4cf764b2c58e1c239ae0c61d to your computer and use it in GitHub Desktop.

Revisions

  1. @rothgar rothgar renamed this gist Aug 13, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. @rothgar rothgar created this gist Aug 10, 2020.
    37 changes: 37 additions & 0 deletions tampermonkey.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    // ==UserScript==
    // @name Streamyard Keyboard Shortcuts
    // @namespace http://streamyard.com
    // @version 0.1
    // @description Simple keyboard shortcuts for streamyard
    // @author [email protected]
    // @match https://streamyard.com/*
    // @grant none
    // @run-at document-end
    // ==/UserScript==

    (function() {
    'use strict';

    document.addEventListener('keydown', function(e) {
    //console.log(e);
    if (e.key == "m" && !e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) {
    var unmuteButton = document.querySelector('[aria-label="Unmute microphone"]');
    var muteButton = document.querySelector('[aria-label="Mute microphone"]');

    if (unmuteButton !== null) {
    unmuteButton.click();
    } else {
    muteButton.click();
    }
    } else if (e.key == "v" && !e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) {
    var faceUnmuteButton = document.querySelector('[aria-label="turn on camera"]');
    var faceMuteButton = document.querySelector('[aria-label="turn off camera"]');

    if (faceUnmuteButton !== null) {
    faceUnmuteButton.click();
    } else {
    faceMuteButton.click();
    }
    }
    }, false);
    })();