diff --git a/index.html b/index.html index d9d7645..9458487 100644 --- a/index.html +++ b/index.html @@ -56,7 +56,7 @@ - + @@ -83,7 +83,7 @@ - + +

Remote Screenshare into OBS @@ -2482,11 +2494,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 - + - + diff --git a/lib.js b/lib.js index 54c75ad..c078559 100644 --- a/lib.js +++ b/lib.js @@ -12821,7 +12821,7 @@ async function joinDataMode(){ // join the room, but without publishing anything } } -function publishWebcam(btn = false) { +function publishWebcam(btn = false, miconly=false) { if (btn) { if (btn.dataset.ready == "false") { @@ -16878,7 +16878,7 @@ function loadSettings(){ } } -function gotDevices(deviceInfos) { +function gotDevices(deviceInfos, miconly=false) { log("got devices!1"); log(deviceInfos); @@ -17271,6 +17271,10 @@ function gotDevices(deviceInfos) { option.text = "Disable Video"; option.value = "ZZZ"; videoSelect.appendChild(option); // NO AUDIO OPTION + + if (miconly){ + option.selected = "true"; + } selectors.forEach((select, selectorIndex) => { if (Array.prototype.slice.call(select.childNodes).some(n => n.value === values[selectorIndex])) { @@ -27038,13 +27042,13 @@ async function updateCameraConstraints(constraint, value = null, ctrl=false, UUI return; } -function setupWebcamSelection() { +function setupWebcamSelection(miconly=false) { log("setupWebcamSelection();"); checkBasicStreamsExist(); try { - return enumerateDevices().then(gotDevices).then(function() { + return enumerateDevices().then(function(dInfo){return gotDevices(dInfo, miconly)}).then(function() { if (getById("webcamquality").elements && parseInt(getById("webcamquality").elements.namedItem("resolution").value) == 3) { if (session.maxframeRate===false){ @@ -27059,7 +27063,7 @@ function setupWebcamSelection() { var audioSelect = getById('audioSource'); var videoSelect = getById('videoSourceSelect'); var outputSelect = getById('outputSource'); - + audioSelect.onchange = function() { if (document.getElementById("gowebcam")) { @@ -27204,7 +27208,7 @@ function setupWebcamSelection() { document.getElementById("gowebcam").dataset.audioready = "true"; } - if (session.videoDevice === 0) { + if ((session.videoDevice === 0) || miconly) { if (session.autostart) { publishWebcam(); // no need to mirror as there is no video... return; @@ -27592,13 +27596,13 @@ function createIframePopup() { return; // ignore the rest. } -function previewWebcam() { +function previewWebcam(miconly=false) { if (session.taintedSession === null) { log("STILL WAITING ON HASH TO VALIDATE"); - setTimeout(function() { - previewWebcam(); - }, 1000); + setTimeout(function(miconly) { + previewWebcam(miconly); + }, 1000, miconly); return; } else if (session.taintedSession === true) { warnlog("HASH FAILED; PASSWORD NOT VALID"); @@ -27612,6 +27616,20 @@ function previewWebcam() { return; } activatedPreview = true; + + + if (miconly){ // this just shares the preview section with the mic-only and video+mic modes + if (!getById("add_camera_inner").cloned){ + getById("add_camera_inner").cloned = true; + insertAfter(getById("add_camera_inner"),getById("add_microphone")); + document.getElementById('videoSourceSelect').innerHTML = ""; + } + } else if (getById("add_camera_inner").cloned){ + getById("add_camera_inner").cloned = false; + insertAfter(getById("add_camera_inner"),getById("add_camera")); + document.getElementById('videoSourceSelect').innerHTML = ""; + } + if (session.audioDevice === 0) { // OFF var constraint = { @@ -27646,7 +27664,7 @@ function previewWebcam() { } } - if (session.videoDevice === 0) { + if ((session.videoDevice === 0) || miconly) { constraint.video = false; } else { constraint.video = true; @@ -27662,7 +27680,7 @@ function previewWebcam() { if ((constraint.video === false) && (constraint.audio === false)){ if (session.autostart) { - publishWebcam(); // no need to mirror as there is no video... + publishWebcam(false, miconly); // no need to mirror as there is no video... return; } else { getById("getPermissions").style.display = "none"; @@ -27694,23 +27712,23 @@ function previewWebcam() { if (vtrue === false) { constraint.video = false; } - setTimeout(function(constraint) { - requestBasicPermissions(constraint); - }, 0, constraint); + setTimeout(function(constraint, miconly) { + requestBasicPermissions(constraint, setupWebcamSelection, miconly); + }, 0, constraint, miconly); }).catch((error) => { log("enumeratated failed. Seeking permissions."); - setTimeout(function(constraint) { - requestBasicPermissions(constraint); - }, 0, constraint); + setTimeout(function(constraint, miconly) { + requestBasicPermissions(constraint, setupWebcamSelection, miconly); + }, 0, constraint, miconly); }); } -async function requestBasicPermissions(constraint = {video: true, audio: true}, callback=setupWebcamSelection) { +async function requestBasicPermissions(constraint = {video: true, audio: true}, callback=setupWebcamSelection, miconly=false) { if (session.taintedSession === null) { log("STILL WAITING ON HASH TO VALIDATE"); setTimeout(function(constraint) { - requestBasicPermissions(constraint, callback); + requestBasicPermissions(constraint, callback, miconly); }, 1000, constraint); return null; } else if (session.taintedSession === true) { @@ -27793,7 +27811,7 @@ async function requestBasicPermissions(constraint = {video: true, audio: true}, updateRenderOutpipe(); if (callback){ - callback(); + callback(miconly); } }).catch(function(err) { clearTimeout(timerBasicCheck); @@ -27832,7 +27850,7 @@ async function requestBasicPermissions(constraint = {video: true, audio: true}, errorlog("trying to list webcam again"); if (callback){ - callback(); + callback(miconly); } }); @@ -34078,10 +34096,15 @@ function addEventToAll(targets, trigger, callback) { // js helper } } } + +function insertAfter(newNode, existingNode) { + existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling); +} addEventToAll(".column", 'click', function(e, ele) { if (ele.classList.contains("skip-animation")) { return; } + var bounding_box = ele.getBoundingClientRect(); ele.style.top = bounding_box.top + "px"; ele.style.left = (bounding_box.left - 20) + "px"; diff --git a/main.css b/main.css index a70d5d0..c67e3e2 100644 --- a/main.css +++ b/main.css @@ -2218,6 +2218,13 @@ span[data-action-type="stats-graphs-details-container"]>span{ background-position: 50% 65%; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='347.184' height='187.007' viewBox='0 0 91.859 49.479' fill='none' stroke='%23000' stroke-width='5' stroke-linejoin='round' xmlns:v='https://vecta.io/nano'%3E%3Cpath d='M3.15 3.15h65.569v43.179H3.15z' stroke-dashoffset='22.7149601' paint-order='markers fill stroke'/%3E%3Cpath d='M68.919 28.837L88.709 44.73V7.148L69.019 22.341z'/%3E%3C/svg%3E"); } +#container-3a { + background-repeat: no-repeat; + background-size: 90px; + transition: background-image 0.3s ease-in-out; + -webkit-transition: background-image 0.3s ease-in-out; + background-position: 50% 65%; +} #container-4 { background-repeat: no-repeat; background-size: 80px; diff --git a/main.js b/main.js index c18766b..f70ef30 100644 --- a/main.js +++ b/main.js @@ -2320,7 +2320,6 @@ async function main(){ // main asyncronous thread; mostly initializes the user s } if (session.videoDevice === 0) { - getById("previewWebcam").classList.add("miconly"); if (session.audioDevice === 0) { miniTranslate(getById("add_camera"), "click-start-to-join", "Click Start to Join"); @@ -4059,12 +4058,19 @@ async function main(){ // main asyncronous thread; mostly initializes the user s if (session.roomid.length > 0) { if (session.videoDevice === 0) { if (session.audioDevice === 0) { - miniTranslate(getById("add_camera"), "join-room", "Join room"); + miniTranslate(getById("add_camera"), "join-room", "Join Room"); } else { - miniTranslate(getById("add_camera"), "join-room-with-mic", "Join room with Microphone"); + miniTranslate(getById("add_camera"), "join-room-with-mic", "Join Room with Microphone"); } - } else { + } else if (session.audioDevice === 0) { miniTranslate(getById("add_camera"), "join-room-with-camera", "Join Room with Camera"); + } else { + miniTranslate(getById("add_camera"), "join-room-with-video", "Join Room with Video"); + + miniTranslate(getById("add_microphone"), "join-room-with-mic-only", "Join Room with just Microphone"); + + getById("container-3a").classList.remove("hidden"); + } miniTranslate(getById("add_screen"), "share-screen-with-room", "Screenshare with Room"); } else { diff --git a/translations/blank.json b/translations/blank.json index e15a997..247877e 100644 --- a/translations/blank.json +++ b/translations/blank.json @@ -208,8 +208,10 @@ }, "innerHTML": { "join-room": "Join room", - "join-room-with-mic": "Join room with Microphone", + "join-room-with-mic": "Join Room with Microphone", + "join-room-with-mic-only": "Join with just Microphone", "join-room-with-camera": "Join Room with Camera", + "join-room-with-video": "Join Room with Video", "copy-this-url": "Copy this URL into your \"browser source\"", "share-screen-with-room": "Screenshare with Room", "share-your-mic": "Share your Microphone",