Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Streamyard Keyboard Shortcuts
// ==UserScript==
// @name Streamyard Keyboard Shortcuts
// @namespace http://streamyard.com
// @version 0.1
// @description Simple keyboard shortcuts for streamyard
// @author justinleegarrison@gmail.com
// @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);
})();
@cesarhernandezgt

This comment has been minimized.

Copy link

@cesarhernandezgt cesarhernandezgt commented Sep 23, 2020

Hi @rothgar is this a script you can add to a live Streamyard session?
If yes, I tried to add it editing vie google chrome developer tools and adding in the <head> section something like:

<script type="text/javascript" async="" src="https://gist.githubusercontent.com/rothgar/92e69d5bdcf80ea23f065bb6db03f7cd/raw/8b1d8e1288be068c3a4aecbcc6e1bdbc3862da68/streamyard-tampermonkey.js"></script>

But after typing m the mute action didn't trigger. any clue on what's went wrong?

@rothgar

This comment has been minimized.

Copy link
Owner Author

@rothgar rothgar commented Sep 23, 2020

I'm loading the script with tampermonkey https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo

It works but has some bugs I haven't had time to fix yet. Would welcome any feedback/updates to make it more stable.

Specifically I need to detect when the keyboard isn't focused on an input field (chat window)

@cathellis

This comment has been minimized.

Copy link

@cathellis cathellis commented Sep 24, 2020

I'm interested in this, can I make it work with my Elgato Stream Deck?

@timmmmyboy

This comment has been minimized.

Copy link

@timmmmyboy timmmmyboy commented Oct 1, 2020

I'm interested in this, can I make it work with my Elgato Stream Deck?

I was able to use a Stream Deck with this no problem, simply simulate the keyboard presses in the software and have Streamyard open with this script and it works. I was also able to modify this to simulate a few other shots like the various layouts since they all had unique aria text. Thanks @rothgar!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.