join with mic only button added

This commit is contained in:
steveseguin 2023-04-07 17:28:46 -04:00
parent 1b1eb7d0ee
commit 039960baa0
5 changed files with 82 additions and 32 deletions

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=278" />
<link rel="stylesheet" href="./main.css?ver=279" />
<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=47"></script>
<script type="text/javascript" crossorigin="anonymous" src="./thirdparty/aes.js"></script>
<script type="text/javascript" crossorigin="anonymous" src="./webrtc.js?ver=606"></script>
<script type="text/javascript" crossorigin="anonymous" src="./webrtc.js?ver=607"></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">
@ -386,7 +386,7 @@
<h2 id="add_camera">
<span data-translate="add-your-camera">Add your Camera to OBS</span>
</h2>
<div class="container-inner">
<div class="container-inner" id="add_camera_inner">
<br />
<p>
<video id="previewWebcam" class="previewWebcam task" title="Right-click this video for additional options" data-menu="context-menu-video" oncanplay="updateStats();" controlsList="nodownload" muted autoplay playsinline ></video>
@ -552,6 +552,18 @@
</div>
</div>
</div>
<div id="container-3a" title="Add your Microphone to OBS" onkeyup="enterPressedClick(event,this);" alt="Add your Microphone to OBS" tabindex="3" role="button" aria-pressed="false" class="microphoneBackground column columnfade pointer rounded card hidden" onclick="previewWebcam(true)" style=" overflow-y: auto;">
<h2 id="add_microphone">
<span data-translate="add-your-microphone">Add your Microphone to OBS</span>
</h2>
<div class="outer close">
<div class="inner">
<label class="labelclass">
<span data-translate="back">Back</span>
</label>
</div>
</div>
</div>
<div id="container-2" title="Remote Screenshare into OBS" onkeyup="enterPressedClick(event,this);" alt="Remote Screenshare into OBS" tabindex="4" role="button" aria-pressed="false" class="column columnfade pointer rounded card" style=" overflow-y: auto;">
<h2 id="add_screen">
<span data-translate="remote-screenshare-obs">Remote Screenshare into OBS</span>
@ -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
</script>
<script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=713"></script>
<script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=715"></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=575"></script>
<script type="text/javascript" crossorigin="anonymous" id="main-js" src="./main.js?ver=577"></script>
</body>
</html>

67
lib.js
View File

@ -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";

View File

@ -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;

14
main.js
View File

@ -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 {

View File

@ -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",