-
-
Save fullo/7db1046225b0f14374342ccad493b881 to your computer and use it in GitHub Desktop.
Streamyard Keyboard Shortcuts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Streamyard Keyboard Shortcuts | |
// @namespace http://streamyard.com | |
// @version 0.1 | |
// @description Simple keyboard shortcuts for streamyard | |
// @author justinleegarrison@gmail.com | |
// @author ffullone@gmail.com | |
// @match https://streamyard.com/* | |
// @grant none | |
// @run-at document-end | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var keyMap = {17: false, 18: false }; // ctrl+alt+KEY | |
document.addEventListener('keydown', function(e) { | |
if (e.keyCode in keyMap) { | |
keyMap[e.keyCode] = true; | |
} | |
console.log(e); | |
if ( e.key == "1" && keyMap[17] && keyMap[18]) { | |
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 == "2" && keyMap[17] && keyMap[18]) { | |
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(); | |
} | |
} else if (e.key == "3" && keyMap[17] && keyMap[18]) { | |
var streamUnmuteButtons = document.querySelectorAll('[aria-label="Add to stream"]'); | |
var streamMuteButtons = document.querySelectorAll('[aria-label="Remove from stream"]'); | |
if (streamUnmuteButtons !== null) { | |
var streamUnmuteButton = streamUnmuteButtons.forEach(btn => btn.click()); | |
} | |
if (streamMuteButtons !== null) { | |
var streamMuteButton = streamMuteButtons.forEach(btn => btn.click()); | |
} | |
} else if (e.key == "4" && keyMap[17] && keyMap[18]) { | |
var chatButton = document.getElementById("broadcast-aside-tab-chat"); | |
if (chatButton !== null) { | |
chatButton.click(); | |
} | |
} else if (e.key == "6" && keyMap[17] && keyMap[18]) { | |
var brandButton = document.getElementById("broadcast-aside-tab-brand"); | |
if (brandButton !== null) { | |
brandButton.click(); | |
} | |
} else if (e.key == "7" && keyMap[17] && keyMap[18]) { | |
var soloLayout = document.querySelector('[aria-label="Solo layout. The host camera fills all the space. If no host camera, the first guest that was added is used."]'); | |
if (soloLayout !== null) { | |
soloLayout.click(); | |
} | |
} else if (e.key == "8" && keyMap[17] && keyMap[18]) { | |
var thinLayout = document.querySelector('[aria-label="Thin layout. All cameras are visible and squished to fill up all the space."]'); | |
if (thinLayout !== null) { | |
thinLayout.click(); | |
} | |
} else if (e.key == "9" && keyMap[17] && keyMap[18]) { | |
var groupLayout = document.querySelector('[aria-label="Group layout. All cameras are visible and spaced out."]'); | |
if (groupLayout !== null) { | |
groupLayout.click(); | |
} | |
} else if (e.key == "0" && keyMap[17] && keyMap[18]) { | |
var smallLayout = document.querySelector('[aria-label="Small screen layout. One camera and the shared screen are visible. If no screen, it behaves like the leader layout."]'); | |
if (smallLayout !== null) { | |
smallLayout.click(); | |
} | |
} else if (e.key == "." && keyMap[17] && keyMap[18]) { | |
var leaderLayout = document.querySelector('[aria-label="Leader layout. All cameras are visible. One is larger than the others."]'); | |
if (leaderLayout !== null) { | |
leaderLayout.click(); | |
} | |
}else if (e.key == "+" && keyMap[17] && keyMap[18]) { | |
var largeLayout = document.querySelector('[aria-label="Large screen layout. The shared screen is large, all cameras are visible but small. If no screen, it behaves like the group layout."]'); | |
if (largeLayout !== null) { | |
largeLayout.click(); | |
} | |
} else if (e.key == "-" && keyMap[17] && keyMap[18]) { | |
var fullLayout = document.querySelector('[aria-label="Full screen layout. Only the shared screen is visible. If no screen, it behaves like the group layout."]'); | |
if (fullLayout !== null) { | |
fullLayout.click(); | |
} | |
} | |
}, false); | |
document.addEventListener('keyup', (e) => { | |
if (e.keyCode in keyMap) { | |
keyMap[e.keyCode] = false; | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
now is possible to add or remove from the stream all the user at once with "s"