api boolean fixes

This commit is contained in:
Steve Seguin 2022-10-01 15:36:22 -04:00
parent 0573fb38ba
commit 09467fac9a
3 changed files with 171 additions and 44 deletions

View File

@ -57,7 +57,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=209" />
<link rel="stylesheet" href="./main.css?ver=213" />
<script type="text/javascript" crossorigin="anonymous" src="./thirdparty/adapter.min.js"></script>
<style id="lightbox-animations" type="text/css"></style>
<!-- <link rel="manifest" href="manifest.json" /> -->
@ -82,7 +82,7 @@
<link itemprop="url" href="./media/vdoNinja_logo_full.png" />
</span>
<script type="text/javascript" crossorigin="anonymous" src="./thirdparty/CodecsHandler.js?ver=37"></script>
<script type="text/javascript" crossorigin="anonymous" src="./webrtc.js?ver=520"></script>
<script type="text/javascript" crossorigin="anonymous" src="./webrtc.js?ver=521"></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">
@ -628,7 +628,7 @@
<div style="margin: 20px; max-width: 400px; text-align: left; margin: auto auto;">
<div class="invite_setting_group">
<h4>
<span data-translate="advanced-paramaters">Advanced Options</span>
<span data-translate="quality-paramaters">Quality settings</span>
</h4>
<div class="invite_setting_item">
<input type="checkbox" id="invite_bitrate" />
@ -649,16 +649,19 @@
</label>
</div>
<div class="invite_setting_item">
<label for="invite_quality" data-translate="video-resolution">Video resolution: </label>
<label for="invite_quality" data-translate="video-resolution">Target video resolution: </label>
<select id="invite_quality" name="invite_quality">
<option value="-1" selected>User selectable</option>
<option value="0">Maximum resolution</option>
<option value="1">Balanced</option>
<option value="2">Smooth and cool</option>
<option value="0">1080p (high-quality)</option>
<option value="1">720p (balanced)</option>
<option value="2">360p (older computers)</option>
</select>
</div>
</div>
<div class="invite_setting_group">
<h4>
<span data-translate="general-paramaters">User options</span>
</h4>
<div class="invite_setting_item">
<input type="checkbox" id="invite_effects" />
<label for="invite_effects">
@ -677,12 +680,6 @@
<span data-translate="hide-screen-share" title="The guest will only be able to select their webcam as an option">Hide the screenshare option</span>
</label>
</div>
<div class="invite_setting_item">
<input type="checkbox" id="invite_remotecontrol" />
<label for="invite_remotecontrol">
<span data-translate="allow-remote-control" title="Hold CTRL and the mouse wheel to zoom in and out remotely of compatible video streams">Remote control of zoom (android)</span>
</label>
</div>
<div class="invite_setting_item">
<input type="checkbox" id="invite_obfuscate" />
<label for="invite_obfuscate">
@ -693,6 +690,17 @@
<span data-translate="add-a-password-to-stream" title="Add a password to make the stream inaccessible to those without the password"> Add a password:</span>
<input type="text" autocorrect="off" autocapitalize="none" id="invite_password" placeholder="Add an optional password" />
</div>
</div>
<div class="invite_setting_group">
<h4>
<span data-translate="interview-paramaters">Two-way chat</span>
</h4>
<div class="invite_setting_item">
<input type="checkbox" id="invite_hostlink" />
<label for="invite_hostlink">
<span data-translate="generate-host-link" title="Generate host link to chat with guest; 2-way interview chat.">Generate host link also</span>
</label>
</div>
<div class="invite_setting_item">
<span data-translate="add-the-guest-to-a-room" title="Add the guest to a group-chat room; it will be created automatically if needed."> Add the guest to a room:</span>
<input type="text" autocorrect="off" autocapitalize="none" id="invite_joinroom" placeholder="Enter Room name here" oninput="document.getElementById('invitegroupchat').style.display='block';" />
@ -709,8 +717,8 @@
</div>
</div>
<div>See the
<a style="text-decoration: none; color: blue;" target="_blank" href="https://docs.vdo.ninja/advanced-settings">documentation</a> for more options and info.<br /><br />
Try out the advanced <a style="text-decoration: none; color: blue;" target="_blank" href="https://invite.vdo.ninja/">invite generator</a> here also.
<a style="text-decoration: none; color: blue;" target="_blank" href="https://docs.vdo.ninja/advanced-settings">documentation</a> for a list of all options and details.<br /><br />
Try out the advanced <a style="text-decoration: none; color: blue;" target="_blank" href="https://invite.vdo.ninja/">invite generator</a> here as well.
</div>
</div>
</div>
@ -1250,7 +1258,7 @@
<span class="slider"></span>
</label>
<font class="tooltip" style='cursor: help;position:relative;bottom:2px;font-family:"Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", Times, Symbola, Aegyptus, Code2000, Code2001, Code2002, Musica, serif, LastResort;'><span class="tooltiptext">This can cause video playback to lag</span></font>
<span data-translate="unlock-video-bitrate">unlock Video Bitrate</span>
<span data-translate="unlock-video-bitrate">Unlock video bitrate</span>
<br />
<label class="switch" title="Disable fit-to-window optmized video scaling for added sharpness; increases CPU / Network load though.">
@ -1777,7 +1785,7 @@
<input type="text" id="pptHotKey" placeholder="press a key here" style="padding-left: 7px;" onkeypress="event.preventDefault;event.stopPropagation();return false;" onkeyup="event.preventDefault;event.stopPropagation();return false;" onkeydown="setHotKey();"/>
<button onclick="setHotKey(false);" style="margin: 0 0 0 4px; border-radius: 5px; padding: 3px 3px;">Clear</button>
<br /><br />
<label title="Enable Draw on Screen">Enable Draw-on-Screen</label>
<label title="Draw on the Screen">Draw-on-Screen</label>
<button id='startDrawScreen' title="CTRL (cmd) + ALT + D to toggle" onclick="drawOnScreen();" style="margin: 0 0 0 4px; border-radius: 5px; padding: 3px 3px;">Enable</button>
<button class='hidden drawActive' onclick="drawOnScreenObject.erase();" style="margin: 0 0 0 4px; border-radius: 5px; padding: 3px 3px;">Clear</button>
<button class='hidden drawActive' onclick="drawOnScreenObject.stop();" style="margin: 0 0 0 4px; border-radius: 5px; padding: 3px 3px;" title="CTRL (cmd) + ALT + D to toggle" >Stop</button>
@ -2258,11 +2266,11 @@
// session.defaultBackgroundImages = ["./media/bg_sample1.webp", "./media/bg_sample2.webp"]; // for &effects=5 (virtual backgrounds)
</script>
<script type="text/javascript" crossorigin="anonymous" src="./thirdparty/aes.js"></script>
<script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=478"></script>
<script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=483"></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=442"></script>
<script type="text/javascript" crossorigin="anonymous" id="main-js" src="./main.js?ver=445"></script>
</body>
</html>

162
lib.js
View File

@ -9170,8 +9170,6 @@ function updateLocalStats(){
uploadQuality = "title='Severe connection issues' style='color: transparent; text-shadow: 0 0 0 #F00;'";
}
console.log("upq "+uploadQuality);
if (Firefox && (totalBitrate===0 && totalBitrate2===0)){
// does not support the current stats system
} else if (totalBitrate > totalBitrate2){
@ -19303,11 +19301,27 @@ session.publishStream = function(v){ // stream is used to generated an SDP
}; // publishStream
session.postPublish = function(){
session.postPublish = async function(){
log("Post publish");
if (session.welcomeMessage){
getChatMessage(session.welcomeMessage, false, true, true);
}
if (session.welcomeImage){
var welcomeoverlay = document.createElement("img");
welcomeoverlay.src = session.welcomeImage;
welcomeoverlay.className = "fadein";
welcomeoverlay.id = "welcomeImage";
document.body.appendChild(welcomeoverlay);
await sleep(2000);
setTimeout(function(welcomeoverlay){
welcomeoverlay.style = "animation: fadeout 1s;"
setTimeout(function(welcomeoverlay){
welcomeoverlay.remove();
},990,welcomeoverlay);
}, 1000, welcomeoverlay);
}
clearInterval(session.updateLocalStatsInterval);
session.updateLocalStatsInterval = setInterval(function(){updateLocalStats();},session.statsInterval);
@ -24540,7 +24554,7 @@ function generateQRPageCallback(hash) {
}
if (getById("invite_joinroom").value.trim().length) {
sendstr += "&room=" + getById("invite_joinroom").value.trim();
sendstr += "&ssid&room=" + getById("invite_joinroom").value.trim();
viewstr += "&solo&room=" + getById("invite_joinroom").value.trim();
}
@ -24548,8 +24562,7 @@ function generateQRPageCallback(hash) {
sendstr += "&hash=" + hash;
viewstr += "&password=" + sanitizePassword(getById("invite_password").value.trim());
}
if (getById("invite_group_chat_type").value) { // 0 is default
if (getById("invite_group_chat_type").value == 1) { // no video
sendstr += "&novideo";
@ -24569,15 +24582,22 @@ function generateQRPageCallback(hash) {
}
var wss = "";
if (session.customWSS){
if (session.customWSS!==true){
wss = "&pie="+session.customWSS;
} else {
wss = "&wss="+session.wss;
if (session.customWSS){
if (session.customWSS!==true){
wss = "&pie="+session.customWSS;
} else {
wss = "&wss="+session.wss;
}
}
var hoststr = "";
if (getById("invite_hostlink").checked) {
hoststr = 'https://' + location.host + location.pathname + '?push=' + sid + "_hostlink" + "&view="+ sid + sendstr + "&bitrate=500" + title + wss;
sendstr = 'https://' + location.host + location.pathname + '?push=' + sid + "&view="+sid + "_hostlink" + sendstr + "&bitrate=1200" + title + wss;
} else {
sendstr = 'https://' + location.host + location.pathname + '?push=' + sid + sendstr + title + wss;
}
}
sendstr = 'https://' + location.host + location.pathname + '?push=' + sid + sendstr + title + wss;
if (getById("invite_obfuscate").checked) {
sendstr = obfuscateURL(sendstr);
@ -24587,14 +24607,28 @@ function generateQRPageCallback(hash) {
getById("gencontent").style.display = "none";
getById("gencontent").className = ""; //
getById("gencontent2").style.display = "block";
getById("gencontent2").className = "container-inner"; //
getById("gencontent2").className = "container-inner";
getById("gencontent2").innerHTML = '<br /><div id="qrcode" style="background-color:white;display:inline-block;color:black;max-width:380px;padding:35px 40px 40px 40px;">\
<h2 style="margin:0 0 8px 0;color:black" data-translate="invite-link">Guest Invite Link:</h2>\
<a class="task grabLinks" title="Click to copy guest invite link to clipboard" onclick="copyFunction(this,event)" \
style="word-break: break-all;cursor:copy;background-color:#CFC;border: 2px solid black;width:300px;padding:8px;margin:0px;color:#000;" href="' + sendstr + '" >' + sendstr + ' <i class="las la-paperclip" style="cursor:pointer"></i></a><br /><br /></div>\
<br /><br />and don\'t forget the<h2 style="color:black">OBS Browser Source Link:</h2><a class="task grabLinks" title="Click to copy or just Drag the link directly into OBS" data-drag="1" onclick="copyFunction(this,event)" style="word-break: break-all;margin:0px;cursor:grab;background-color:#FCC;width:380px;padding:10px;border:2px solid black;margin:5px;color:#000;" href="' + viewstr + '" >' + viewstr + ' <i class="las la-paperclip" style="cursor:pointer"></i></a> \
<br /><br />\
<span data-translate="please-note-invite-ingestion-link">This invite link and OBS ingestion link are reusable. Only one person may use a specific invite at a time.</span><br /><br /><button onclick="resetGen();" style="font-size:1.2em;paddding:5px;"><i class="las la-redo-alt"></i> Create Another Invite Link</button>';
<h2 style="margin:0 0 8px 0;color:black" data-translate="invite-link">Guest Invite Link:</h2>\
<a class="task grabLinks" title="Click to copy guest invite link to clipboard" onclick="copyFunction(this,event)" \
style="word-break: break-all;cursor:copy;background-color:#CFC;border: 2px solid black;width:300px;padding:8px;margin:0px;color:#000;" href="' + sendstr + '" >' + sendstr + ' <i class="las la-paperclip" style="cursor:pointer"></i></a><br /><br /></div>\
<br /><br />and don\'t forget the<h2 style="color:black">OBS Browser Source Link:</h2><a class="task grabLinks" title="Click to copy or just Drag the link directly into OBS" data-drag="1" onclick="copyFunction(this,event)" style="word-break: break-all;margin:0px;cursor:grab;background-color:#FCC;width:380px;padding:10px;border:2px solid black;margin:5px;color:#000;" href="' + viewstr + '" >' + viewstr + ' <i class="las la-paperclip" style="cursor:pointer"></i></a> \
';
if (hoststr){
getById("gencontent2").innerHTML += '<br /><br /><h2 style="color:black">Host Chat Link:</h2><a class="task" title="Click to copy" onclick="copyFunction(this,event)" style="font-weight: bold;display: inline-flex;word-break: break-all;margin:0px;cursor:grab;background-color:#cce1ff;width:380px;padding:10px;border:2px solid black;margin:5px;color:#000;" href="' + hoststr + '" >' + hoststr + ' <i class="las la-paperclip" style="cursor:pointer"></i></a>';
}
getById("gencontent2").innerHTML += '<br /><br />\
<span data-translate="please-note-invite-ingestion-link">\
<li>This invite link and OBS ingestion link are reusable.</li>\
<li>Only one person may use a specific invite at a time.</li>\
<li>The stream ID can be changed manually to something else; keep it unique and alphanumeric.</li>\
<li>Nothing is stored server-side; links do not expire, nor is there anything to delete.</li>\
</span><br /><br />\
<button onclick="resetGen();" style="font-size:1.2em;paddding:5px;"><i class="las la-redo-alt"></i> Create Another Invite Link</button>';
var qrcode = new QRCode(getById("qrcode"), {
width: 300
, height: 300
@ -28046,21 +28080,39 @@ function targetGuest(target, action, value=null){
directMigrate(element, true, value); // if value is set, it will auto transfer the guest to that room.
}
} else if ((action == 1) || (action == "addScene")) {
if (value == "null" || value == null){
value = 1;
var scene = 1;
if (value == "null" || value == null || value == "toggle"){
scene = 1;
} else if ((value !== true) && (value !== false)){
scene = value;
}
var element = getGuestTargetScene(value, target); // oscid/action/target/value 1/1/scene
var element = getGuestTargetScene(scene, target); // oscid/action/target/value 1/1/scene
if (element) {
if (value===true){
element.value = 1;
} else if (value===false){
element.value = 0;
}
return directEnable(element, true); // false or true return
}
} else if ((action == 2) || (action == "muteScene")) {
var element = getGuestTarget("mute-scene", target);
if (element) {
if (value===true){
element.value = 1;
} else if (value===false){
element.value = 0;
}
return directMute(element, true); // false/true
}
} else if ((action == 3) || (action == "mic")) {
var element = getGuestTarget("mute-guest", target);
if (element) {
if (value===true){
element.value = 1;
} else if (value===false){
element.value = 0;
}
return remoteMute(element, true); // false/true
}
} else if ((action == 4) || (action == "hangup")) {
@ -28071,16 +28123,31 @@ function targetGuest(target, action, value=null){
} else if ((action == 5) || (action == "soloChat")) { // see soloChatBidirectional action=9 for two-way
var element = getGuestTarget("solo-chat", target);
if (element) {
if (value===true){
element.value = 1;
} else if (value===false){
element.value = 0;
}
return session.toggleSoloChat(element.dataset.UUID);
}
} else if ((action == 6) || (action == "speaker")) {
var element = getGuestTarget("toggle-remote-speaker", target);
var element = getGuestTarget("toggle-remote-speaker", target);
if (element) {
if (value===true){
element.value = 1;
} else if (value===false){
element.value = 0;
}
return remoteSpeakerMute(element);
}
} else if ((action == 7) || (action == "display")) {
var element = getGuestTarget("toggle-remote-display", target);
if (element) {
if (value===true){
element.value = 1;
} else if (value===false){
element.value = 0;
}
return remoteDisplayMute(element);
}
} else if ((action == 8) || (action == "group")) {
@ -28096,41 +28163,81 @@ function targetGuest(target, action, value=null){
if (element) {
var ctrl = {};
ctrl.ctrlKey = true;
if (value===true){
element.value = 1;
} else if (value===false){
element.value = 0;
}
return session.toggleSoloChat(element.dataset.UUID, ctrl);
}
} else if ((action == 12) || (action == "addScene2")) {
var element = getGuestTargetScene(2, target);
if (element) {
if (value===true){
element.value = 1;
} else if (value===false){
element.value = 0;
}
return directEnable(element, true)
}
} else if ((action == 13) || (action == "addScene3")) {
var element = getGuestTargetScene(3, target);
if (element) {
if (value===true){
element.value = 1;
} else if (value===false){
element.value = 0;
}
return directEnable(element, true)
}
} else if ((action == 14) || (action == "addScene4")) {
var element = getGuestTargetScene(4, target);
if (element) {
if (value===true){
element.value = 1;
} else if (value===false){
element.value = 0;
}
return directEnable(element, true)
}
} else if ((action == 15) || (action == "addScene5")) {
var element = getGuestTargetScene(5, target);
if (element) {
if (value===true){
element.value = 1;
} else if (value===false){
element.value = 0;
}
return directEnable(element, true)
}
} else if ((action == 16) || (action == "addScene6")) {
var element = getGuestTargetScene(6, target);
if (element) {
if (value===true){
element.value = 1;
} else if (value===false){
element.value = 0;
}
return directEnable(element, true)
}
} else if ((action == 17) || (action == "addScene7")) {
var element = getGuestTargetScene(7, target);
if (element) {
if (value===true){
element.value = 1;
} else if (value===false){
element.value = 0;
}
return directEnable(element, true)
}
} else if ((action == 18) || (action == "addScene8")) {
var element = getGuestTargetScene(8, target);
if (element) {
if (value===true){
element.value = 1;
} else if (value===false){
element.value = 0;
}
return directEnable(element, true)
}
} else if ((action == 19) || (action == "forceKeyframe")) {
@ -28141,6 +28248,11 @@ function targetGuest(target, action, value=null){
} else if ((action == 20) || (action == "soloVideo")) {
var element = getGuestTarget("solo-video", target);
if (element) {
if (value===true){
element.value = 1;
} else if (value===false){
element.value = 0;
}
return requestInfocus(element);
}
} else if ((action == 21) || (action == "sendChat")) {

View File

@ -1344,6 +1344,13 @@ body {
.mainmenuclass {
display: inherit;
}
#welcomeImage{
object-fit:cover;
width:100%;
height:100%;
display:block;
z-index:10;
}
.infoblob {
color: white;