minor sync

This commit is contained in:
steveseguin 2023-02-24 19:00:01 -05:00
parent c02cb19078
commit f75213cb9a
6 changed files with 351 additions and 114 deletions

View File

@ -1109,6 +1109,8 @@
password = urlParams.get('password') || urlParams.get('pass') || urlParams.get('pw') || urlParams.get('p');
}
var aspectRatio = 16/9.0;
document.documentElement.style.setProperty('--aspect-ratio', aspectRatio);
@ -1791,13 +1793,15 @@
additional2 += "&chatbutton=0";
}
urlEdited = urlEdited.replace("?","");
var chatmsg = "Welcome to the Comms app. Select a group to participate in.";
chatmsg = encodeURIComponent(chatmsg);
if (window.location.hostname == "comms.cam"){
var iframesrc = "https://vdo.ninja/?controlbarspace&volumecontrol&sharperscreen&groupmode&novice&ltb=350&minipreview&transparent&hideheader&margin&rounded&hidetranslate&cleandirector&vd=0&webcam&nvb&sstype=3&ssb&showlabel=toprounded&labelsize=85&style=2&room="+roomname+additional+additional2+"&b64css="+injectCSS+streamID+label+"&chatmsg="+chatmsg;
var iframesrc = "https://vdo.ninja/?"+urlEdited+"&controlbarspace&volumecontrol&sharperscreen&groupmode&novice&ltb=350&minipreview&transparent&hideheader&margin&rounded&hidetranslate&cleandirector&vd=0&webcam&nvb&sstype=3&ssb&showlabel=toprounded&labelsize=85&style=2&room="+roomname+additional+additional2+"&b64css="+injectCSS+streamID+label+"&chatmsg="+chatmsg;
} else {
var iframesrc = "./index.html?controlbarspace&volumecontrol&sharperscreen&groupmode&novice&ltb=350&minipreview&transparent&hideheader&margin&rounded&hidetranslate&cleandirector&vd=0&webcam&nvb&sstype=3&ssb&showlabel=toprounded&labelsize=85&style=2&room="+roomname+additional+additional2+"&b64css="+injectCSS+streamID+label+"&chatmsg="+chatmsg;
var iframesrc = "./index.html?"+urlEdited+"&controlbarspace&volumecontrol&sharperscreen&groupmode&novice&ltb=350&minipreview&transparent&hideheader&margin&rounded&hidetranslate&cleandirector&vd=0&webcam&nvb&sstype=3&ssb&showlabel=toprounded&labelsize=85&style=2&room="+roomname+additional+additional2+"&b64css="+injectCSS+streamID+label+"&chatmsg="+chatmsg;
}
@ -2062,7 +2066,37 @@
var group = document.createElement('span');
group.dataset.group = groupID;
group.classList.add("group");
group.innerText = "group: "+groupID;
//group.innerText = "group: "+groupID;
var name = document.createElement('span');
if (savedSession.aliases && savedSession.aliases[groupID]){
name.innerHTML = savedSession.aliases[groupID];
name.innerHTML += "<br /><small>group: "+groupID+"</small>";
} else {
name.innerHTML = "group: "+groupID;
}
name.title = "Hold CTRL and click to give this group a custom label";
group.appendChild(name);
name.groupID = groupID;
name.onclick = function(e){
if (e.ctrlKey){
var nn = prompt("Rename this group", this.groupID);
if (this.groupID == nn){
name.innerHTML = "group: "+nn;
delete group.dataset.alias;
//delete savedSession.aliases[this.groupID];
} else if (nn){
name.innerHTML = nn;
name.innerHTML += "<br /><small>group: "+groupID+"</small>";
group.dataset.alias = nn;
//savedSession.aliases[this.groupID] = nn;
}
saveSession();
} else {
this.parentNode.click();
}
}
group.onclick = remoteActivate;
group.title = "Activate this group; the view scene link will be updated";
@ -2184,9 +2218,11 @@
console.log("remoteActivate");
if (event.target && group===null){
group = event.target.dataset.group;
event.target.parentNode.classList.toggle("pressed");
if (event.target && event.target.parentNode){
event.target.parentNode.classList.toggle("pressed");
}
}
if (event.target.parentNode.classList.contains("pressed")){
if (event.target && event.target.parentNode && event.target.parentNode.classList.contains("pressed")){
var index = savedSession.activeGroups.indexOf(group);
if (index == -1){
savedSession.activeGroups.push(group);
@ -2214,6 +2250,7 @@
savedSession.activeViewGroups = [];
savedSession.settings = {};
savedSession.version = 1;
savedSession.aliases = {};
for (var i=0;i<groups.length;i++){
try {
@ -2221,6 +2258,13 @@
} catch(e){
errorlog(e);
}
try {
if (groups[i].dataset.alias){
savedSession.aliases[groups[i].dataset.group] = groups[i].dataset.alias;
}
} catch(e){
errorlog(e);
}
if (groups[i].parentNode.classList.contains("pressed")){
try {
savedSession.activeGroups.push(groups[i].dataset.group);

View File

@ -56,7 +56,7 @@
<meta property="twitter:image" content="./media/vdoNinja_logo_full.png" />
<meta name="msapplication-TileColor" content="#da532c" />
<meta name="theme-color" content="#ffffff" />
<link rel="stylesheet" href="./main.css?ver=260" />
<link rel="stylesheet" href="./main.css?ver=265" />
<script type="text/javascript" crossorigin="anonymous" src="./thirdparty/adapter.js"></script>
<style id="lightbox-animations" type="text/css"></style>
<!-- <link rel="manifest" href="manifest.json" /> -->
@ -83,7 +83,7 @@
<script type="text/javascript" crossorigin="anonymous" src="./thirdparty/CodecsHandler.js?ver=45"></script>
<script type="text/javascript" crossorigin="anonymous" src="./thirdparty/aes.js"></script>
<script type="text/javascript" crossorigin="anonymous" src="./webrtc.js?ver=577"></script>
<script type="text/javascript" crossorigin="anonymous" src="./webrtc.js?ver=579"></script>
<input id="zoomSlider" type="range" style="display: none;" />
<span id="electronDragZone" style="pointer-events: none; z-index:-10; position:absolute;top:0;left:0;width:100%;height:2%;-webkit-app-region: drag;min-height:20px;"></span>
<div id="header">
@ -132,7 +132,7 @@
<div id="head7" class="hidden" data-translate="director-muted-you">The director has muted you.</div>
</div>
<div id="controlButtons" >
<div id="controlButtons" class="hidden">
<div id="obsState" class="hidden" >ACTIVE</div>
<div id="subControlButtons">
@ -609,7 +609,9 @@
</select>
</div>
<br />
<div id="audioScreenCaptureDocs" data-translate="application-audio-capture">For application-specific audio capture, <a href='https://docs.vdo.ninja/audio' style='color: #007AC8;'>see here</a></div>
<div id="audioScreenCaptureDocs" data-translate="application-audio-capture">For application-specific audio capture, <a href='https://docs.vdo.ninja/audio' style='color: #007AC8;' target="_blank">see here</a></div>
<div id="audioScreenCaptureDocs2" data-translate="1080p-screen-capture-guide">For achieving 1080p60 game-capture, <a href='https://docs.vdo.ninja/guides/how-to-screen-share-in-1080p' style='color: #007AC8;' target="_blank">see here</a></div>
</div>
<div class="outer close">
<div class="inner">
@ -898,7 +900,7 @@
<br />
<br />
<h3>
🛠 For support, join the <a href="https://discord.vdo.ninja/">Discord <i class="lab la-discord"></i></a> or see the <a href="https://www.reddit.com/r/VDONinja/">sub-reddit <i class="lab la-reddit-alien"></i></a>. The <a href="https://docs.vdo.ninja/">documentation is here</a> and my personal email is <i>steve@seguin.email</i>
🛠 For support, join the <a href="https://discord.gg/T4xpQVv">Discord <i class="lab la-discord"></i></a> or see the <a href="https://www.reddit.com/r/VDONinja/">sub-reddit <i class="lab la-reddit-alien"></i></a>. The <a href="https://docs.vdo.ninja/">documentation is here</a> and my personal email is <i>steve@seguin.email</i>
</h3>
</span>
@ -2405,11 +2407,11 @@
// session.hidehome = true; // If used, 'hide home' will make the landing page inaccessible, along with hiding a few go-home elements.
// session.record = false; // uncomment to block users from being able to record via vdo.ninja's built in recording function
</script>
<script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=657"></script>
<script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=666"></script>
<!--
// If you wish to change branding, blank offers a good clean start.
<script type="text/javascript" id="main-js" src="./main.js" data-translation="blank"></script>
-->
<script type="text/javascript" crossorigin="anonymous" id="main-js" src="./main.js?ver=542"></script>
<script type="text/javascript" crossorigin="anonymous" id="main-js" src="./main.js?ver=549"></script>
</body>
</html>

254
lib.js
View File

@ -500,6 +500,7 @@ function playAllVideos(){
}
for (var i in session.rpcs){
if (session.rpcs[i].whip){continue;}
try{
if (session.rpcs[i].videoElement){
log("I: "+i);
@ -684,7 +685,7 @@ async function delay(ms) {
}
var Prompts = {};
async function promptAlt(inputText, block=false, asterix=false, value=false){
async function promptAlt(inputText, block=false, asterix=false, value=false, time=false){
var result = null;
if (session.beepToNotify){
playtone();
@ -710,41 +711,80 @@ async function promptAlt(inputText, block=false, asterix=false, value=false){
type = "password";
}
modalTemplate =
`<div id="modal_${promptID}" class="promptModal" style="z-index:${zindex + 2}">
<div class="promptModalInner">
<span id="close_${promptID}" class='modalClose' data-pid="${promptID}">×</span>
<span class='promptModalMessage'>${inputText}</span>
<input id="input_${promptID}" autocorrect="off" autocapitalize="none" data-pid="${promptID}" type="${type}" class="largeTextEntry" />
<button id="submit_${promptID}" data-pid="${promptID}" style="width:120px; background-color: #fff; position: relative;border: 1px solid #999; margin: 0 0 0 55px;" data-translate='ok'> OK</button>
<button id="cancel_${promptID}" data-pid="${promptID}" style="width:120px; background-color: #fff; position: relative;border: 1px solid #999; margin: 0;" data-translate='cancel'> Cancel</button>
if (time){
modalTemplate =
`<div id="modal_${promptID}" class="promptModal" style="z-index:${zindex + 2}">
<div class="promptModalInner">
<span id="close_${promptID}" class='modalClose' data-pid="${promptID}">×</span>
<span class='promptModalMessage' style='margin:20px'>${inputText}</span>
<input id="input_${promptID}" title="minutes" autocorrect="off" autocapitalize="none" data-pid="${promptID}" value="0" style="width:50px;padding:4px;margin:4px;" min="0" type="number" /> minutes,
<input id="input_${promptID}_sec" title="seconds" autocorrect="off" autocapitalize="none" data-pid="${promptID}" value="0" style="width:50px;padding:4px;margin:4px;" max="59" min="0" type="number" /> seconds
<button id="submit_${promptID}" data-pid="${promptID}" style="width:120px; background-color: #fff; position: relative;border: 1px solid #999; margin: 0 0 0 10px" data-translate='ok'> OK</button>
<button id="cancel_${promptID}" data-pid="${promptID}" style="width:120px; background-color: #fff; position: relative;border: 1px solid #999; margin: 0;" data-translate='cancel'> Cancel</button>
<br /><br />
</div>
</div>
</div>
<div id="modalBackdrop_${promptID}" class="${backdropClass}" style="z-index:${zindex + 1}"></div>`;
<div id="modalBackdrop_${promptID}" class="${backdropClass}" style="z-index:${zindex + 1}"></div>`;
} else {
modalTemplate =
`<div id="modal_${promptID}" class="promptModal" style="z-index:${zindex + 2}">
<div class="promptModalInner">
<span id="close_${promptID}" class='modalClose' data-pid="${promptID}">×</span>
<span class='promptModalMessage'>${inputText}</span>
<input id="input_${promptID}" autocorrect="off" autocapitalize="none" data-pid="${promptID}" type="${type}" class="largeTextEntry" />
<button id="submit_${promptID}" data-pid="${promptID}" style="width:120px; background-color: #fff; position: relative;border: 1px solid #999; margin: 0 0 0 55px;" data-translate='ok'> OK</button>
<button id="cancel_${promptID}" data-pid="${promptID}" style="width:120px; background-color: #fff; position: relative;border: 1px solid #999; margin: 0;" data-translate='cancel'> Cancel</button>
</div>
</div>
<div id="modalBackdrop_${promptID}" class="${backdropClass}" style="z-index:${zindex + 1}"></div>`;
}
document.body.insertAdjacentHTML("beforeend", modalTemplate); // Insert modal at body end
document.getElementById("input_"+promptID).focus();
if (value!==false){
document.getElementById("input_"+promptID).value = value;
if (time){
document.getElementById("input_"+promptID).value = parseInt(value/60);
document.getElementById("input_"+promptID+"_sec").value = parseInt(value)%60;
} else {
document.getElementById("input_"+promptID).value = value;
}
}
if (!time){
document.getElementById("input_"+promptID).addEventListener("keyup", function(event) {
if (event.key === "Enter") {
var pid = event.target.dataset.pid;
result = document.getElementById("input_"+pid).value;
document.getElementById("modal_"+pid).remove();
document.getElementById("modalBackdrop_"+pid).remove();
Prompts[pid].resolve();
}
});
} else {
document.getElementById("input_"+promptID).addEventListener("keyup", function(event) {
if (event.key === "Enter") {
document.getElementById("input_"+promptID+"_sec").focus();
}
});
document.getElementById("input_"+promptID+"_sec").addEventListener("keyup", function(event) {
if (event.key === "Enter") {
document.getElementById("submit_"+promptID).focus();
}
});
}
document.getElementById("input_"+promptID).addEventListener("keyup", function(event) {
if (event.key === "Enter") {
var pid = event.target.dataset.pid;
result = document.getElementById("input_"+pid).value;
document.getElementById("modal_"+pid).remove();
document.getElementById("modalBackdrop_"+pid).remove();
Prompts[pid].resolve();
}
});
document.getElementById("submit_"+promptID).addEventListener("click", function(event){
var pid = event.target.dataset.pid;
result = document.getElementById("input_"+pid).value;
if (time){
result = parseInt(document.getElementById("input_"+pid+"_sec").value) + parseInt(document.getElementById("input_"+pid).value)*60;
} else {
result = document.getElementById("input_"+pid).value;
}
document.getElementById("modal_"+pid).remove();
document.getElementById("modalBackdrop_"+pid).remove();
Prompts[pid].resolve();
@ -1196,6 +1236,8 @@ session.obsStateSync = function(data2send=false, uid=false){
}
}
for (var UUID in session.rpcs){
if (uid && (uid!==UUID)){continue;} // target just a single connection.
@ -1218,6 +1260,18 @@ session.obsStateSync = function(data2send=false, uid=false){
}
}
if (session.filterOBSscenes && msg.obsState && msg.obsState.details && msg.obsState.details.scenes && msg.obsState.details.scenes.length){
var scenes = [];
msg.obsState.details.scenes.forEach(scene=>{
if (session.filterOBSscenes && session.filterOBSscenes.length){
if (session.filterOBSscenes.includes(scene)){
scenes.push(scene);
}
}
});
msg.obsState.details.scenes = scenes;
}
if (session.optimize!==false){
var bandwidth = parseInt(session.rpcs[UUID].targetBandwidth);
if (needOptimize){
@ -1496,7 +1550,7 @@ function manageSceneState(data, UUID){ // incoming obs details
control = parseInt(session.pcs[UUID].obsState.details.controlLevel) || 0; //0 for NONE, 1 for READ_OBS (OBS data), 2 for READ_USER (User data), 3 for BASIC, 4 for ADVANCED and 5 for ALL
}
if (control ===5){
if (control >= 4){
if (session.director || !session.roomid){
if (session.obsControls!==false){
getById("obscontrolbutton").classList.remove("hidden"); // so they get a tip.
@ -1697,6 +1751,7 @@ function manageSceneState(data, UUID){ // incoming obs details
var details = session.pcs[UUID].obsState.details;
if (details.scenes){
details.scenes.forEach(scene=>{
var sceneButton = document.createElement("button");
sceneButton.dataset.obsScene = scene;
sceneButton.dataset.UUID = UUID;
@ -1705,7 +1760,7 @@ function manageSceneState(data, UUID){ // incoming obs details
sceneButton.classList.add("pressed");
}
obsSceneNamesBox.appendChild(sceneButton);
if (control<5){
if (control<4){
sceneButton.disabled = true;
sceneButton.style.cursor = "not-allowed";
sceneButton.title = "Source is lacking required permissions.";
@ -1758,9 +1813,19 @@ function processOBSCommand(msg){
return false;
}
try { // {changeScene: this.dataset.obsScene}
if (msg.obsCommand.action && (typeof msg.obsCommand.action=="string")){
if (msg.obsCommand.value && (typeof msg.obsCommand.value=="string")){
if ((msg.obsCommand.action == "setCurrentScene") && session.filterOBSscenes && session.filterOBSscenes.length){
try {
if (!session.filterOBSscenes.includes(msg.obsCommand.value)){
return false;
}
} catch(e){errorlog(e);return false;}
}
window.obsstudio[msg.obsCommand.action](msg.obsCommand.value);
} else {
window.obsstudio[msg.obsCommand.action]();
@ -3232,6 +3297,7 @@ function hideHomeCheck(){
}
getById("audioScreenCaptureDocs").classList.add("permahide");
getById("audioScreenCaptureDocs2").classList.add("permahide");
getById("translateButton").classList.add("permahide");
getById("calendarButton").classList.add("permahide");
getById("info").classList.add("permahide");
@ -10025,19 +10091,16 @@ function updateStats(obsvc = false) {
}
function toggleControlBar() {
if (getById("controlButtons").style.display != 'none') {
// Dont hardcode style here. Copy it over to data-style before changing to none;
getById("controlButtons").dataset.style = getById("controlButtons").style.display;
getById("controlButtons").style.display = 'none';
} else {
// Copy the style over from the data-style attribute.
getById("controlButtons").style.display = getById("controlButtons").dataset.style;
};
if (!getById("controlButtons").classList.contains("hidden")) {
getById("controlButtons").dataset.enabled = true;
getById("controlButtons").classList.add("hidden");
} else if (getById("controlButtons").dataset.enabled){
getById("controlButtons").classList.remove("hidden");
delete getById("controlButtons").dataset.enabled;
}
}
function toggleMute(apply = false, event=false) { // TODO: I need to have this be MUTE, toggle, with volume not touched.
var mouseUp = null;
@ -10599,7 +10662,7 @@ function hangup2() {
getById("mutebutton").classList.add("hidden");
getById("hangupbutton2").classList.add("hidden");
//getById("chatbutton").classList.remove("hidden");
getById("controlButtons").style.display = "inherit";
getById("controlButtons").classList.remove("hidden");
//getById("mutespeakerbutton").classList.add("hidden");
getById("mutevideobutton").classList.add("hidden");
getById("screenshare2button").classList.add("hidden");
@ -11388,7 +11451,7 @@ async function directTimer(ele, event=false) { // A directing room only is cont
ele.classList.remove("red2");
if (!event || (!((event.ctrlKey) || (event.metaKey)))) {
if (ele.value == 0 || ele.value == 2) {
var getTime = await promptAlt("Time in seconds to count down", false, false, parseInt(getById("overlayClockContainer").dataset.initial));
var getTime = await promptAlt("Time to set count down timer", false, false, parseInt(getById("overlayClockContainer").dataset.initial), true);
if (!getTime){return;}
getById("overlayClockContainer").dataset.initial = parseInt(getTime) || 600;
ele.value = 1;
@ -11523,7 +11586,7 @@ async function directRoomTimer(ele, event=false) { // A directing room only is
if (!event || (!((event.ctrlKey) || (event.metaKey)))) {
if (ele.value == 0 || ele.value == 2) {
var getTime = await promptAlt("Time in seconds to count down", false, false, parseInt(getById("overlayClockContainer").dataset.initial));
var getTime = await promptAlt("Time to set count down timer", false, false, parseInt(getById("overlayClockContainer").dataset.initial), true);
if (!getTime){return;}
getTime = parseInt(getTime);
getById("overlayClockContainer").dataset.initial = getTime || 600;
@ -12327,7 +12390,7 @@ async function publishScreen() {
if (session.screensharebutton) {
getById("screensharebutton").className = "float2";
}
getById("controlButtons").style.display = "flex";
getById("controlButtons").classList.remove("hidden");
getById("helpbutton").style.display = "inherit";
getById("reportbutton").style.display = "";
} else if (session.cleanish && session.recordLocal!==false){
@ -12338,29 +12401,29 @@ async function publishScreen() {
getById("mutevideobutton").classList.add("hidden");
getById("hangupbutton").classList.add("hidden");
getById("hangupbutton2").classList.add("hidden");
getById("controlButtons").style.display = "flex";
getById("controlButtons").classList.remove("hidden");
getById("settingsbutton").classList.add("hidden");
getById("screenshare2button").classList.add("hidden");
getById("screensharebutton").classList.add("hidden");
getById("queuebutton").classList.add("hidden");
} else {
getById("controlButtons").style.display = "none";
getById("controlButtons").classList.add("hidden");
}
if (session.chatbutton === true) {
getById("chatbutton").classList.remove("hidden");
getById("controlButtons").style.display = "flex";
getById("controlButtons").classList.remove("hidden");
} else if (session.chatbutton === false) {
getById("chatbutton").classList.add("hidden");
}
if (session.screensharebutton === true) {
getById("controlButtons").style.display = "flex";
getById("controlButtons").classList.remove("hidden");
getById("screensharebutton").className = "float2";
}
if (session.hangupbutton === true){
getById("controlButtons").style.display = "flex";
getById("controlButtons").classList.remove("hidden");
getById("hangupbutton").className = "float";
}
@ -12491,6 +12554,14 @@ async function joinDataMode(){ // join the room, but without publishing anything
getById("head3").classList.add('hidden');
getById("head3a").classList.add('hidden');
joinRoom(session.roomid);
} else if (session.view){
window.onresize = updateMixer;
play();
if (session.permaid!==false){
session.postPublish();
}
} else if (session.permaid!==false){
session.postPublish();
}
}
@ -12601,7 +12672,7 @@ function publishWebcam(btn = false) {
getById("head1").className = 'hidden';
if (!(session.cleanOutput)) {
if (!session.cleanOutput){
getById("mutebutton").classList.remove("hidden");
getById("mutespeakerbutton").classList.remove("hidden");
//getById("mutespeakerbutton").className="float";
@ -12631,10 +12702,14 @@ function publishWebcam(btn = false) {
getById("screensharebutton").className = "float";
getById("screenshare3button").className = "float hidden";
getById("screenshare2button").className = "float hidden";
} else {
} else if (session.screenshareType===2){
getById("screenshare2button").className = "float";
getById("screensharebutton").className = "float hidden";
getById("screenshare3button").className = "float hidden";
} else {
getById("screenshare3button").className = "float";
getById("screensharebutton").className = "float hidden";
getById("screenshare2button").className = "float hidden";
}
} else {
getById("screensharebutton").className = "float";
@ -12642,7 +12717,7 @@ function publishWebcam(btn = false) {
getById("screenshare3button").className = "float hidden";
}
}
getById("controlButtons").style.display = "flex";
getById("controlButtons").classList.remove("hidden");
getById("helpbutton").style.display = "inherit";
getById("reportbutton").style.display = "";
} else if (session.cleanish && session.recordLocal!==false){
@ -12653,18 +12728,18 @@ function publishWebcam(btn = false) {
getById("mutevideobutton").classList.add("hidden");
getById("hangupbutton").classList.add("hidden");
getById("hangupbutton2").classList.add("hidden");
getById("controlButtons").style.display = "flex";
getById("controlButtons").classList.remove("hidden");
getById("settingsbutton").classList.add("hidden");
getById("screenshare2button").classList.add("hidden");
getById("screensharebutton").classList.add("hidden");
getById("queuebutton").classList.add("hidden");
} else {
getById("controlButtons").style.display = "none";
getById("controlButtons").classList.add("hidden");
}
if (session.chatbutton === true) {
getById("chatbutton").classList.remove("hidden");
getById("controlButtons").style.display = "inherit";
getById("controlButtons").classList.remove("hidden");
} else if (session.chatbutton === false) {
getById("chatbutton").classList.add("hidden");
}
@ -13223,11 +13298,11 @@ session.publishIFrame = function(iframeURL){
if (!(session.cleanOutput)){
getById("chatbutton").className="float";
getById("hangupbutton").className="float";
getById("controlButtons").style.display="flex";
getById("controlButtons").classList.remove("hidden");
getById("helpbutton").style.display = "inherit";
getById("reportbutton").style.display = "";
} else {
getById("controlButtons").style.display="none";
getById("controlButtons").classList.add("hidden");
}
if (session.chatbutton === false) {
@ -14949,7 +15024,7 @@ async function createRoomCallback(passAdd, passAdd2) {
getById("queuebutton").classList.remove("hidden");
}
getById("chatbutton").classList.remove("hidden");
getById("controlButtons").style.display = "inherit";
getById("controlButtons").classList.remove("hidden");
getById("mutespeakerbutton").classList.remove("hidden");
getById("websitesharebutton").classList.remove("hidden");
//getById("screensharebutton").classList.remove("hidden");
@ -14983,12 +15058,12 @@ async function createRoomCallback(passAdd, passAdd2) {
} else {
getById("miniPerformer").style.display = "none";
getById("controlButtons").style.display = "none";
getById("controlButtons").classList.add("hidden");
}
if (session.chatbutton === true) {
getById("chatbutton").classList.remove("hidden");
getById("controlButtons").style.display = "inherit";
getById("controlButtons").classList.remove("hidden");
} else if (session.chatbutton === false) {
getById("chatbutton").classList.add("hidden");
}
@ -22364,11 +22439,11 @@ session.hostFile = function(ele, event){ // webcam stream is used to generated a
if (!(session.cleanOutput)){
getById("chatbutton").className="float";
getById("hangupbutton").className="float";
getById("controlButtons").style.display="flex";
getById("controlButtons").classList.remove("hidden");
getById("helpbutton").style.display = "inherit";
getById("reportbutton").style.display = "";
} else {
getById("controlButtons").style.display="none";
getById("controlButtons").classList.add("hidden");
}
@ -22485,11 +22560,11 @@ session.publishFile = function(ele, event){ // webcam stream is used to generate
if (!(session.cleanOutput)){
getById("chatbutton").className="float";
getById("hangupbutton").className="float";
getById("controlButtons").style.display="flex";
getById("controlButtons").classList.remove("hidden");
getById("helpbutton").style.display = "inherit";
getById("reportbutton").style.display = "";
} else {
getById("controlButtons").style.display="none";
getById("controlButtons").classList.add("hidden");
}
var bigPlayButton = document.getElementById("bigPlayButton");
@ -30949,8 +31024,6 @@ function audioMeterGuest(mediaStreamSource, UUID, trackid){
}
}
try{
clearTimeout(session.rpcs[UUID].inboundAudioPipeline[trackid].analyser.interval);
session.rpcs[UUID].inboundAudioPipeline[trackid].analyser.interval = setTimeout(function(){updateLevels();},100);
@ -31211,7 +31284,7 @@ async function loadScript(url, callback=false){
}
var tokenClient=false;
function YoutubeChatInterface(){ // this lets us query Youtube for chat messages, but its quota limited :(
function YoutubeChatInterface(remote=false){ // this lets us query Youtube for chat messages, but its quota limited :(
if (!tokenClient){
tokenClient=true;
} else {
@ -31240,9 +31313,17 @@ function YoutubeChatInterface(){ // this lets us query Youtube for chat messages
gapi.client.setToken(JSON.parse(saved));
listBroadcasts();
} else if (gapi.client.getToken() === null) {
warnUser("<button onclick='(function(){tokenClient.requestAccessToken({prompt: \"consent\"});})()'>Grant Access to Youtube Chat</button>", false, false);
if (remote){
tokenClient.requestAccessToken({prompt:"consent"});
} else {
warnUser("<button onclick='(function(){tokenClient.requestAccessToken({prompt: \"consent\"});})()'>Grant Access to Youtube Chat</button>", false, false);
}
} else {
warnUser("<button onclick='(function(){this.remove();tokenClient.requestAccessToken({prompt: \"\"});})()'>Grant Access to Youtube Chat</button>", false, false);
if (remote){
tokenClient.requestAccessToken({prompt: ""});
} else {
warnUser("<button onclick='(function(){this.remove();tokenClient.requestAccessToken({prompt: \"\"});})()'>Grant Access to Youtube Chat</button>", false, false);
}
}
}
@ -31768,11 +31849,19 @@ function whipClient(){ // publish to whip.vdo.ninja with obs v29 I think, to use
var resp = await processWHIP(data);
if (resp){
var ret = {};
data.result = resp;
ret.callback = data;
log(ret);
socket.send(JSON.stringify(ret));
var get = data.get;
data = {};
if (get){
data.get = get;
data.result = resp;
ret.callback = data;
log(ret);
socket.send(JSON.stringify(ret));
}
}
} else if ("delete" in data){
warnlog("WHIP Client is actively disconnecting");
// session.closeRPC(i, true);
}
}
});
@ -31795,7 +31884,7 @@ async function processWHIP(data){
}
log("setupIncoming");
await session.setupIncoming(msg); // could end up setting up the peer the wrong way.
session.rpcs[msg.UUID].whip = true;
var callback = null;
var promise = new Promise((resolve, reject) => {
callback = resolve;
@ -31834,24 +31923,27 @@ async function processWHIP(data){
var iceBundle = await promise2; // waiting for ICE GATHER COMPLETE
session.rpcs[msg.UUID].whipCallback2 = null;
log("ICE BUNDLE");
log(iceBundle);
var insertIce = "";
iceBundle.forEach(ice=>{
if (ice.candidate){
insertIce += "a="+ice.candidate+"\r\n";
}
});
//log("ICE BUNDLE");
//log(iceBundle);
var sdpAnswer = await promise;
//var insertIce = "";
//iceBundle.forEach(ice=>{
// if (ice.candidate){
// insertIce += "a="+ice.candidate+"\r\n";
// }
//});
await promise;
session.rpcs[msg.UUID].whipCallback = null;
sdpAnswer = session.rpcs[msg.UUID].localDescription.sdp;
sdpAnswer = sdpAnswer.replace("a=ice-ufrag", insertIce+"a=ice-ufrag");
//sdpAnswer = sdpAnswer.replace("a=ice-ufrag", insertIce+"a=ice-ufrag");
log("completed");
log(sdpAnswer);
warnlog(sdpAnswer);
return sdpAnswer; // return SDP answer for the remote WHIP request
}

View File

@ -47,6 +47,10 @@
color: #FFF;
}
button:hover,[role="button"]:not(.column):hover{
filter: brightness(90%);
}
table {
display: inline-block;
padding:10px;
@ -358,15 +362,41 @@ button.white:active {
font-size: calc(6vh + 6vw / 2);
letter-spacing: 0.0em;
text-shadow: 0.05em 0.05em 0px rgb(0 0 0);
width: 100%;
z-index: 6;
vertical-align: top;
text-align: center;
text-align: right;
right:0;
bottom:0;
position: fixed;
overflow-wrap: anywhere;
cursor: pointer;
user-select: none;
}
#overlayClockContainer.top {
top:0%;
bottom:unset;
}
#overlayClockContainer.vmiddle {
bottom:48%;
top:unset;
}
#overlayClockContainer.bottom {
bottom:0%;
top:unset;
}
#overlayClockContainer.left {
right:unset;
left:0;
}
#overlayClockContainer.hmiddle {
right:45%;
left:unset;
}
#overlayClockContainer.right {
right:0;
left:unset;
}
#overlayClock{
padding:2px 20px;
background-color: #0009;
@ -421,6 +451,7 @@ button.white:active {
right:0;
left:unset;
}
#overlayClock2{
padding:0 5px;
background-color: #0009;
@ -444,7 +475,7 @@ button.white:active {
position: fixed;
overflow-wrap: anywhere;
padding:2% 3%;
}
}.
.avatarSelection{
vertical-align: top;
margin: 10px 0;
@ -1023,12 +1054,15 @@ button.glyphicon-button.active.focus {
z-index: 995;
bottom: 0px;
width: 100%;
display: none;
justify-content: center;
align-items: center;
height: 60px;
border: 0;
pointer-events: none;
display: flex;
}
#controlButtons:empty {
display: none;
}
#subControlButtons {
@ -1039,6 +1073,10 @@ button.glyphicon-button.active.focus {
position: absolute;
pointer-events: auto;
}
#subControlButtons:empty{
display:none;
}
#container.vidcon {
height:100%;
}
@ -4527,7 +4565,7 @@ body.darktheme button {
filter: brightness(0.70);
}
body.darktheme .column .las {
color: #f8f7f7;
color: black;
}
body.darktheme label {
filter: brightness(0.85);

91
main.js
View File

@ -1059,6 +1059,10 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
session.fakeUser = true;
session.dataMode = true;
session.autostart = true;
session.novideo = [];
session.noaudio = [];
session.noiframe = [];
session.cleanOutput=true;
}
if (urlParams.has('datamode') || urlParams.has('dataonly')) { // this disables all media in/out.
@ -1066,13 +1070,14 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
}
if (session.dataMode){
session.cleanOutput=true;
session.videoDevice = 0;
session.audioDevice = 0;
session.audioDevice = 0;
getById("mainmenu").classList.add("hidden");
//session.autohide = true;
//session.autostart = true;
session.novideo = [];
session.noaudio = [];
session.noiframe = [];
//session.novideo = [];
//session.noaudio = [];
//session.noiframe = [];
//session.webcamonly = true;
}
@ -1972,11 +1977,17 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
session.obsControls = true;
}
}
if (session.obsControls){
getById("obscontrolbutton").classList.remove("hidden");
getById("controlButtons").style.display = "block";
if (urlParams.has('allowedscenes')){
session.filterOBSscenes = urlParams.get('allowedscenes');
if (session.filterOBSscenes){
session.filterOBSscenes = session.filterOBSscenes.split(",");
} else {
session.filterOBSscenes = true;
}
}
if (urlParams.has('tallyoff') || urlParams.has('notally') || urlParams.has('disabletally') || urlParams.has('to')) {
log("Tally Light off");
getById("obsState").style.setProperty("display", "none", "important");
@ -2879,7 +2890,7 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
getById("translateButton").style.display = "none";
getById("credits").style.display = "none";
getById("header").style.display = "none";
getById("controlButtons").style.display = "none";
getById("controlButtons").classList.add("hidden");
getById("helpbutton").style.display = "none";
getById("helpbutton").style.opacity = 0;
getById("reportbutton").style.display = "none";
@ -2942,6 +2953,13 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
if (urlParams.has('cleanish')) {
session.cleanish = true;
}
if (session.cleanish || !session.cleanOutput){
if (session.obsControls){
getById("obscontrolbutton").classList.remove("hidden");
getById("controlButtons").classList.remove("hidden");
}
}
if (urlParams.has('channels')) { // must be loaded before channelOffset
session.audioChannels = parseInt(urlParams.get('channels')); // for audio output ; not input. see: &channelcount instead.
@ -3810,6 +3828,41 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
session.showTime = false;
}
if (urlParams.has('timer')){
if (urlParams.get('timer') === "1"){
getById("overlayClockContainer").classList.add("top");
getById("overlayClockContainer").classList.add("left");
} else if (urlParams.get('timer') === "7"){
getById("overlayClockContainer").classList.add("bottom");
getById("overlayClockContainer").classList.add("left");
} else if (urlParams.get('timer') === "4"){
getById("overlayClockContainer").classList.add("vmiddle");
getById("overlayClockContainer").classList.add("left");
} else if (urlParams.get('timer') === "2"){
getById("overlayClockContainer").classList.add("top");
getById("overlayClockContainer").classList.add("hmiddle");
} else if (urlParams.get('timer') === "8"){
getById("overlayClockContainer").classList.add("bottom");
getById("overlayClockContainer").classList.add("hmiddle");
} else if (urlParams.get('timer') === "5"){
getById("overlayClockContainer").classList.add("vmiddle");
getById("overlayClockContainer").classList.add("hmiddle");
} else if (urlParams.get('timer') === "3"){
getById("overlayClockContainer").classList.add("top");
getById("overlayClockContainer").classList.add("right");
} else if (urlParams.get('timer') === "9"){
getById("overlayClockContainer").classList.add("bottom");
getById("overlayClockContainer").classList.add("right");
} else if (urlParams.get('timer') === "6"){
getById("overlayClockContainer").classList.add("vmiddle");
getById("overlayClockContainer").classList.add("right");
} else {
getById("overlayClockContainer").classList.add("top");
getById("overlayClockContainer").classList.add("hmiddle");
}
}
if (urlParams.has('hidescreenshare') || urlParams.has('hidess') || urlParams.has('sshide') || urlParams.has('screensharehide')) { // this way I don't need to remember what it's called. I can just guess. :D
session.screenShareElementHidden = true;
}
@ -3958,7 +4011,7 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
if (session.chatbutton === true) {
getById("chatbutton").classList.remove("hidden");
getById("controlButtons").style.display = "inherit";
getById("controlButtons").classList.remove("hidden");
} else if (session.chatbutton === false) {
getById("chatbutton").classList.add("hidden");
}
@ -4002,11 +4055,11 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
}
if (session.chatbutton === true) {
getById("chatbutton").classList.remove("hidden");
getById("controlButtons").style.display = "inherit";
getById("controlButtons").classList.remove("hidden");
} else if (session.chatbutton === false) {
getById("chatbutton").classList.add("hidden");
}
} else if ((session.view) && (session.permaid === false)) {
} else if (session.view && (session.permaid === false)) {
//if (!session.activeSpeaker){
session.audioMeterGuest = false;
//}
@ -4026,7 +4079,7 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
if (session.chatbutton === true) {
getById("chatbutton").classList.remove("hidden");
getById("controlButtons").style.display = "inherit";
getById("controlButtons").classList.remove("hidden");
} else if (session.chatbutton === false) {
getById("chatbutton").classList.add("hidden");
}
@ -4250,7 +4303,7 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
errorlog(e);
}
if (urlParams.has('autohide')) {
if (urlParams.has('autohide')) {
session.autohide=true;
}
if (session.autohide && (session.scene===false)){// && (session.roomid!==false)){
@ -4521,7 +4574,8 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
} else if (!session.youtubeKey){
errorlog("No Youtube Key provided");
}
YoutubeChatInterface();
console.log(session.youtubeKey);
YoutubeChatInterface(true);
}
if ("nextSlide" in e.data){ // panning adjusts the stereo pan , although current its UUID based. can add stream ID based if requested.
@ -5483,6 +5537,13 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
if (session.firstPlayTriggered == false) {
playAllVideos();
session.firstPlayTriggered = true;
try {
if (session.audioCtx && session.audioCtx.state == "suspended"){
session.audioCtx.resume();
}
} catch(e){warnlog("session.audioCtx.resume(); failed 4");}
history.pushState({}, '');
}
});

View File

@ -3609,7 +3609,7 @@
function setobsSceneName(){
var obsSceneName = document.getElementById("canvas").obsSceneName || "";
var input = prompt("Enter the OBS scene you want to trigger", obsSceneName);
var input = prompt("Enter the OBS scene you want to trigger\n\n(To use, also be sure to enable this feature in the mixer settings and enable permissions in the OBS browser source)", obsSceneName);
if (input !==null){
document.getElementById("canvas").obsSceneName = input;
}