diff --git a/animations.js b/animations.js index 532a850..45b886f 100644 --- a/animations.js +++ b/animations.js @@ -6,11 +6,16 @@ $("body").append(''); $(".column").on('click', function() { /* The position of the container will be set to fixed, so set the top & left properties of the container */ + if ( $(this).hasClass( "skip-animation" )){ + return; + } + + var bounding_box = $(this).get(0).getBoundingClientRect(); $(this).css({ top: bounding_box.top + 'px', left: bounding_box.left -20+ 'px' }); /* Set container to fixed position. Add animation */ - $(this).addClass('in-animation'); + $(this).addClass('in-animation').removeClass('pointer'); /* An empty container has to be added in place of the lightbox container so that the elements below don't come up Dimensions of this empty container is the same as the original container */ @@ -91,8 +96,8 @@ if(e.originalEvent.animationName == 'inlightbox') { /* On animation end from full-screen to normal */ else if(e.originalEvent.animationName == 'outlightbox') { /* Remove fixed positioning, remove animation rules */ - $(this).removeClass('in-animation').removeClass('out-animation').removeClass('columnfade'); - + $(this).removeClass('in-animation').removeClass('out-animation').removeClass('columnfade').addClass('pointer'); + /* Remove the empty container that was earlier added */ $("#empty-container").remove(); diff --git a/dock.html b/dock.html index d469f58..5a525b5 100644 --- a/dock.html +++ b/dock.html @@ -50,6 +50,12 @@ button{ transform-origin: 0 0; } +.gone { + position: absolute; + display:inline-block; + left: -9999px; +} + @@ -69,17 +75,35 @@ function copyFunction(copyText) { } function generateStreamID(){ - var text = ""; - var possible = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789"; - for (var i = 0; i < 7; i++){ - text += possible.charAt(Math.floor(Math.random() * possible.length)); + var text = ""; + var possible = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789"; + for (var i = 0; i < 7; i++){ + text += possible.charAt(Math.floor(Math.random() * possible.length)); + } + console.log(text); + return text; +}; +function toHexString(byteArray){ + return Array.prototype.map.call(byteArray, function(byte){ + return ('0' + (byte & 0xFF).toString(16)).slice(-2); + }).join(''); +} +generateHash = function (str, length=false){ + var buffer = new TextEncoder("utf-8").encode(str); + return crypto.subtle.digest("SHA-256", buffer).then( + function (hash) { + hash = new Uint8Array(hash); + if (length){ + hash = hash.slice(0, parseInt(parseInt(length)/2)); + } + hash = toHexString(hash); + return hash; } - console.log(text); - return text; - }; + ); +}; function generateInvite(){ - var title = encodeURI(getById("videoname").value); + var title = encodeURI(getById("videoname").value.replace(/[\W]+/g,"_")); if (title.length){ title = "&label="+title; } @@ -111,16 +135,10 @@ function generateInvite(){ } if (getById("invite_joinroom").value.trim().length){ - sendstr+="&room="+getById("invite_joinroom").value.trim(); - viewstr+="&scene=1&room="+getById("invite_joinroom").value.trim(); + sendstr+="&room="+getById("invite_joinroom").value.replace(/[\W]+/g,"_"); + viewstr+="&scene&room="+getById("invite_joinroom").value.replace(/[\W]+/g,"_"); } - if (getById("invite_password").value.trim().length){ - sendstr+="&password"; - viewstr+="&password="+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"; @@ -142,13 +160,31 @@ function generateInvite(){ var href = window.location.href; var dir = href.substring(0, href.lastIndexOf('/')) + "/"; - sendstr = dir+'?push=' + sid + sendstr; - viewstr = dir+'?view=' + sid + viewstr + title; - getById("container-setup").style.display="none"; - getById("container-links").style.display="block"; + var salt = location.hostname; // "obs.ninja" is the expected default. You will want to change this if hosting dock.html locally. + + if (getById("invite_password").value.trim().length){ + generateHash(getById("invite_password").value.trim().replace(/[\W]+/g,"_")+salt,4).then(function(hash){ + sendstr+="&hash="+hash; + viewstr+="&password="+getById("invite_password").value.trim(); + sendstr = dir+'?push=' + sid + sendstr; + viewstr = dir+'?view=' + sid + viewstr + title; + getById("container-setup").style.display="none"; + getById("container-links").style.display="block"; + + getById("guest-link").value = sendstr; + getById("obs-link").value = viewstr; + }); + } else { + sendstr = dir+'?push=' + sid + sendstr; + viewstr = dir+'?view=' + sid + viewstr + title; + getById("container-setup").style.display="none"; + getById("container-links").style.display="block"; + + getById("guest-link").value = sendstr; + getById("obs-link").value = viewstr; + } + - getById("guest-link").value = sendstr; - getById("obs-link").value = viewstr; } function goBack(){ @@ -158,10 +194,13 @@ function goBack(){ document.addEventListener("dragstart", event => { var url = event.target.href || event.target.value; + if (!url || !url.startsWith('https://')) return; if (event.target.dataset.drag!="1"){ return; } + //event.target.ondragend = function(){event.target.blur();} + var streamId = url.split('view='); var label = url.split('label='); @@ -173,8 +212,12 @@ document.addEventListener("dragstart", event => { url += '&layer-width=1920'; // this isn't always 100% correct, as the resolution can fluxuate, but it is probably good enough url += '&layer-height=1080'; - console.warn(url); + event.dataTransfer.setDragImage(document.querySelector('#dragImage'), 24, 24); event.dataTransfer.setData("text/uri-list", encodeURI(url)); + //event.dataTransfer.setData("url", encodeURI(url)); + + //warnlog(event); + }); @@ -248,5 +291,9 @@ document.addEventListener("dragstart", event => { (links are draggable) +
+ + +
\ No newline at end of file diff --git a/electron.html b/electron.html index 3ae2935..0f3a0c5 100644 --- a/electron.html +++ b/electron.html @@ -1,4 +1,5 @@ +
+ + @@ -129,7 +142,8 @@ input[type='checkbox']:checked { -


+
+

@@ -150,6 +164,10 @@ input[type='checkbox']:checked { * */ +if (navigator.userAgent.indexOf('Mac OS X') != -1){ + document.getElementById("warning4mac").style.display="block"; +} + var audioOutputSelect = document.querySelector('select#audioOutput'); audioOutputSelect.disabled = !('sinkId' in HTMLMediaElement.prototype); audioOutputSelect.onclick = getPermssions; @@ -178,7 +196,12 @@ function getPermssions(e=null){ listed=true; audioOutputSelect.focus(); - }).catch(function(){alert("Failed to list available output devices\n\nPlease ensure you allowed the microphone permissions.");}); + }).catch(function(){ + document.getElementById("messageDiv").innerHTML = "Failed to list available output devices\n\nPlease ensure you allowed the microphone permissions."; + document.getElementById("messageDiv").style.display="block"; + setTimeout(function(){document.getElementById("messageDiv").style.opacity="1.0";},0); + + }); } function gotDevices(deviceInfos) { @@ -310,10 +333,13 @@ function modURL(ele=false){ if (ele.id =="stereo"){ if (document.getElementById("stereo").checked){ - url=updateURLParameter(url, "stereo", ""); - alert('Audio bitrate increased to 256kbps.\n\nPlease note: the Video Publisher must also have the stereo flag enabled for stereo to work.'); + url=updateURLParameter(url, "proaudio", ""); + document.getElementById("messageDiv").innerHTML = "Audio bitrate increased to 256-kbps.\n\nPlease note that the Sender must also have the &proaudio flag added for full-effect"; + document.getElementById("messageDiv").style.display="block"; + setTimeout(function(){document.getElementById("messageDiv").style.opacity="1.0";},0); } else { - url=updateURLParameter(url, "stereo", false); + url=updateURLParameter(url, "proaudio", false); + setTimeout(function(){document.getElementById("messageDiv").style.opacity="0";},0); } } diff --git a/iframe.html b/iframe.html index 912b640..517c316 100644 --- a/iframe.html +++ b/iframe.html @@ -80,7 +80,7 @@ function loadIframe(){ var button = document.createElement("button"); button.innerHTML = "Mute Speaker"; - button.onclick = function(){iframe.contentWindow.postMessage({"mute":true}, '*');}; + button.onclick = function(){iframe.contentWindow.postMessage({"mute":true}, '*');}; // "speaker" also works in the same way. iframeContainer.appendChild(button); var button = document.createElement("button"); @@ -90,7 +90,7 @@ function loadIframe(){ var button = document.createElement("button"); button.innerHTML = "Toggle Speaker"; - button.onclick = function(){iframe.contentWindow.postMessage({"mute":"toggle"}, '*');} + button.onclick = function(){iframe.contentWindow.postMessage({"mute":"toggle"}, '*');}; // open to a better suggestion here. iframeContainer.appendChild(button); var button = document.createElement("button"); @@ -148,6 +148,15 @@ function loadIframe(){ button.onclick = function(){iframe.contentWindow.postMessage({"getStats":true}, '*');}; iframeContainer.appendChild(button); + var button = document.createElement("button"); + button.innerHTML = "Request Loudness Levels"; + button.onclick = function(){iframe.contentWindow.postMessage({"getLoudness":true}, '*');}; + iframeContainer.appendChild(button); + + var button = document.createElement("button"); + button.innerHTML = "Stop Sending Loudness Levels"; + button.onclick = function(){iframe.contentWindow.postMessage({"getLoudness":false}, '*');}; + iframeContainer.appendChild(button); var button = document.createElement("button"); button.innerHTML = "Say Hello"; @@ -178,7 +187,7 @@ function loadIframe(){ if (e.source != iframe.contentWindow){return} // reject messages send from other iframes if ("stats" in e.data){ - var outputWindow = document.createElement("outputWindow"); + var outputWindow = document.createElement("div"); console.log(e.data.stats); @@ -195,11 +204,38 @@ function loadIframe(){ } if ("gotChat" in e.data){ - var outputWindow = document.createElement("outputWindow"); + var outputWindow = document.createElement("div"); outputWindow.innerHTML = e.data.gotChat.msg; outputWindow.style.border="1px dotted black"; iframeContainer.appendChild(outputWindow); } + + if ("action" in e.data){ + var outputWindow = document.createElement("div"); + outputWindow.innerHTML = "child-page-action: "+e.data.action+"
"; + outputWindow.style.border="1px dotted black"; + iframeContainer.appendChild(outputWindow); + } + + if ("loudness" in e.data){ + console.log(e.data); + if (document.getElementById("loudness")){ + outputWindow = document.getElementById("loudness"); + } else { + var outputWindow = document.createElement("div"); + outputWindow.style.border="1px dotted black"; + iframeContainer.appendChild(outputWindow); + outputWindow.id = "loudness"; + } + outputWindow.innerHTML = "child-page-action: loudness
"; + for (var key in e.data.loudness) { + outputWindow.innerHTML += key + " Loudness: " + e.data.loudness[key] + "\n"; + } + outputWindow.style.border="1px black"; + + } + + }); } diff --git a/index.html b/index.html index 26cc246..c228458 100644 --- a/index.html +++ b/index.html @@ -47,14 +47,14 @@ - + - + - + @@ -62,10 +62,10 @@ - - + + -