fix for screen share; &nomeshcast added

This commit is contained in:
steveseguin 2023-05-11 07:50:18 -04:00
parent e8a672de77
commit a7bd36e46b
5 changed files with 115 additions and 96 deletions

View File

@ -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=640"></script>
<script type="text/javascript" crossorigin="anonymous" src="./webrtc.js?ver=642"></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">
@ -2484,11 +2484,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=807"></script>
<script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=817"></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=633"></script>
<script type="text/javascript" crossorigin="anonymous" id="main-js" src="./main.js?ver=637"></script>
</body>
</html>

133
lib.js
View File

@ -4272,7 +4272,7 @@ function updateMixerRun(e=false){ // this is the main auto-mixing code. It's a
}
} else if (session.rpcs[i].videoElement.srcObject && ((session.rpcs[i].videoElement.srcObject.getVideoTracks().length==0) || session.rpcs[i].videoMuted)){
if (session.rpcs[i].screenShareState){
doNotPush = true;;
doNotPush = true;
}
}
//} else if (!session.directorList.indexOf(i)>=0){ // director is never audio-only. Video if need, yes, but not visualized-audio.
@ -5158,21 +5158,6 @@ function updateMixerRun(e=false){ // this is the main auto-mixing code. It's a
var hrh = (h/rh);
}
/* } else {
holder.style.borderRadius = borderRadius+"px";
holder.style.borderColor = borderColor;
holder.style.backgroundColor = borderColor;
holder.style.borderWidth = borderOffset+"px";
if (session.colorVideosBackground){
holder.style.backgroundColor = session.colorVideosBackground;
} else if (borderOffset){
holder.style.backgroundColor = borderColor;
}
} */
if (backgroundMedia){
container.style.backgroundImage = "url("+backgroundMedia+")";
if (cover){
@ -5227,22 +5212,21 @@ function updateMixerRun(e=false){ // this is the main auto-mixing code. It's a
if (cover){
if ((("rotated" in vid) && ((vid.rotated==90) || (vid.rotated==270)))){
holder.style.left = borderOffset + "px";
holder.style.top = borderOffset + "px";
holder.style.height = "calc(100% - "+(videoMargin+borderOffset)+"px)";
holder.style.width = "calc(100% - "+(videoMargin+borderOffset)+"px)";
holder.style.height = "calc(100% - "+(videoMargin*2)+"px)";
holder.style.width = "calc(100% - "+(videoMargin*2)+"px)";
vid.style.width = (height - (borderOffset + videoMargin)*2) + "px";
vid.style.height = (width - (borderOffset + videoMargin)*2) + "px";
vid.style.left = 0;
vid.style.top = 0;
} else {
holder.style.left = borderOffset + videoMargin + "px";
holder.style.top = borderOffset + videoMargin +"px";
holder.style.height = "calc(100% - "+(videoMargin*2+borderOffset)+"px)";
holder.style.width = "calc(100% - "+(videoMargin*2+borderOffset)+"px)";
holder.style.left = videoMargin + "px";
holder.style.top = videoMargin +"px";
holder.style.height = "calc(100% - "+(videoMargin*2)+"px)";
holder.style.width = "calc(100% - "+(videoMargin*2)+"px)";
vid.style.width = "100%";
vid.style.height = "100%";
vid.style.left = 0;
@ -5276,6 +5260,12 @@ function updateMixerRun(e=false){ // this is the main auto-mixing code. It's a
}
}
vid.style.borderColor = borderColor;
vid.style.borderWidth = borderOffset+"px";
vid.style.borderRadius = borderRadius+"px";
holder.style.borderColor = borderColor;
holder.style.borderWidth = "0px";
holder.style.borderRadius = borderRadius+"px";
} else if ((vw && vh) || (vid.width && vid.height) || vid.dataset.aspectRatio){
if (("rotated" in vid) && ((vid.rotated==90) || (vid.rotated==270))){
@ -5307,8 +5297,8 @@ function updateMixerRun(e=false){ // this is the main auto-mixing code. It's a
}
}
var asw = wrw/vvw; // (window.innerWidth/ N) / vid.videoHeight;
var ash = hrh/vvh;
var asw = (wrw - videoMargin*2 - borderOffset*2)/vvw; // (window.innerWidth/ N) / vid.videoHeight;
var ash = (hrh - videoMargin*2 - borderOffset*2)/vvh;
if (session.structure){
// wrw x hrh
@ -5318,29 +5308,25 @@ function updateMixerRun(e=false){ // this is the main auto-mixing code. It's a
//var arH = 9.0;
if (arx>tarx){ // width is too long
var hsw = hrh*tarx - videoMargin*2*tarx - borderOffset*2;
var hsl = (wrw - hsw) / 2;
var hst = videoMargin;
var hsh = (hrh - videoMargin*2 );
} else {
var hsh = (wrw - videoMargin*2 + borderOffset*2)/tarx;
var hst = (hrh - hsh) / 2;
var hsl = videoMargin;
var hsw = (wrw - videoMargin*2);
}
} else {
if (asw < ash){
var hsw = wrw - videoMargin*2;
var hsl = videoMargin;
var hsh = hsw/(vvw/vvh) + borderOffset*2 - borderOffset*2/(vvw/vvh);
var hst = (hrh - hsh - videoMargin - borderOffset)/2 + videoMargin;
} else {
} else if (asw > ash){
var hsh = hrh - videoMargin*2;
var hst = videoMargin;
var hsw = hsh*vvw/vvh + borderOffset*2 - borderOffset*2*(vvw/vvh);
var hsl = (wrw - hsw - videoMargin - borderOffset)/2;
}
var hsw = (hsh - borderOffset)*(vvw/vvh);
var hsl = (wrw - hsw)/2;
} else {
var hsw = wrw - videoMargin*2;
var hsl = videoMargin;
var hsh = hsw/(vvw/vvh) + borderOffset;
var hst = (hrh - hsh)/2;
}
@ -5350,7 +5336,10 @@ function updateMixerRun(e=false){ // this is the main auto-mixing code. It's a
holder.style.height = Math.ceil(hsh) + 'px';
//holder.style.padding = videoMargin + "px";
holder.style.borderColor = borderColor;
holder.style.borderWidth = borderOffset+"px";
holder.style.borderRadius = borderRadius+"px";
vid.style.borderWidth = "0px";
if (("rotated" in vid) && ((vid.rotated==90) || (vid.rotated==270))){
@ -5429,7 +5418,7 @@ function updateMixerRun(e=false){ // this is the main auto-mixing code. It's a
}
}
///////////////
} else {
holder.style.left = (borderOffset + videoMargin) + "px";
@ -5463,12 +5452,15 @@ function updateMixerRun(e=false){ // this is the main auto-mixing code. It's a
}
}
///////////////
holder.style.borderColor = borderColor;
holder.style.borderWidth = borderOffset+"px";
holder.style.borderRadius = borderRadius+"px";
vid.style.borderWidth = "0px";
}
vid.style.borderRadius = borderRadius+"px";
vid.style.borderColor = borderColor;
vid.style.borderWidth = borderOffset+"px";
if (session.colorVideosBackground){
vid.style.backgroundColor = session.colorVideosBackground;
} else {
@ -12056,22 +12048,19 @@ function issueLayout(layout=false, scene=false, UUID=false) { // A directing roo
c:true
}
}; */
if (UUID){
if (session.pcs[UUID] && (scene!==false) && (session.pcs[UUID].scene===(scene+""))){
if (!session.pcs[UUID].solo){
if (session.pcs[UUID] && (scene!==false) && (session.pcs[UUID].scene===(scene+"")) && !session.pcs[UUID].solo && session.pcs[UUID].layout){ // scene specified
session.sendMessage(msg, UUID);
}
} else if (session.pcs[UUID] && session.pcs[UUID].layout){
} else if (session.pcs[UUID] && session.pcs[UUID].layout && !session.pcs[UUID].solo){ // no scene targetted
session.sendMessage(msg, UUID);
log("broadcast");
}
} else {
for (var uuid in session.pcs){
if ((scene!==false) && (session.pcs[uuid].scene===(scene+""))){
if (!session.pcs[uuid].solo){
if ((scene!==false) && (session.pcs[uuid].scene===(scene+"")) && !session.pcs[uuid].solo && session.pcs[uuid].layout){
session.sendMessage(msg, uuid);
}
} else if (session.pcs[uuid].layout){
} else if (session.pcs[uuid].layout && !session.pcs[uuid].solo){
session.sendMessage(msg, uuid);
log("broadcast");
}
@ -12871,7 +12860,7 @@ function applyMuteState(UUID){ // this is the mute state of PLAYBACK audio; not
if (session.noaudio===true){
muteOutcome = true;
} else if (session.noaudio.length){
if (("streamID" in session.rpcs[UUID].streamID) && session.rpcs[UUID].streamID && !session.noaudio.includes(session.rpcs[UUID].streamID)){
if (("streamID" in session.rpcs[UUID]) && session.rpcs[UUID].streamID && !session.noaudio.includes(session.rpcs[UUID].streamID)){
muteOutcome = true;
}
} else {
@ -16155,7 +16144,7 @@ function requestInfocus(ele, evt=null, value=null) {
ele.classList.remove("altpress");
var actionMsg = {};
actionMsg.infocus = false;
session.sendMessage(actionMsg);
//session.sendMessage(actionMsg);
} else {
var actionMsg = {};
if (special){
@ -16163,7 +16152,7 @@ function requestInfocus(ele, evt=null, value=null) {
} else {
actionMsg.infocus = sid;
}
session.sendMessage(actionMsg);
//session.sendMessage(actionMsg);
var eles = document.querySelectorAll('[data-action-type="solo-video"]');
for (var i=0;i<eles.length;i++) {
@ -16183,6 +16172,13 @@ function requestInfocus(ele, evt=null, value=null) {
getById("highlightDirector").checked=false;
}
}
for (var uuid in session.pcs){
if (!session.pcs[uuid].solo && !session.pcs[uuid].layout){ // only issue highlight commands to non-solo and non-layout links
session.sendMessage(actionMsg, uuid);
}
}
syncDirectorState(ele);
if (ele.value==1){
@ -31529,7 +31525,7 @@ session.onTrack = function(event, UUID){
if ((session.novideo !== false) && (!session.novideo.includes(session.rpcs[UUID].streamID))){
newTracks.splice(index,1);
continue;
} else if (session.rpcs[UUID].settings && session.rpcs[UUID].settings.allowscreen && screenshare){
} else if (session.rpcs[UUID].settings && session.rpcs[UUID].settings.allowscreenvideo && screenshare){
//newTracks.splice(index,1);
continue;
} else if (session.rpcs[UUID].settings && !session.rpcs[UUID].settings.video){
@ -31540,7 +31536,7 @@ session.onTrack = function(event, UUID){
if ((session.noaudio !== false) && (!session.noaudio.includes(session.rpcs[UUID].streamID))){
newTracks.splice(index,1);
continue;
} else if (session.rpcs[UUID].settings && session.rpcs[UUID].settings.allowscreen && screenshare){
} else if (session.rpcs[UUID].settings && session.rpcs[UUID].settings.allowscreenaudio && screenshare){
//newTracks.splice(index,1);
continue;
} else if (session.rpcs[UUID].settings && !session.rpcs[UUID].settings.audio){
@ -35656,8 +35652,7 @@ function getReceiversMC(UUID){
}
async function createSecondStream2(UUID){
if (!("allowScreen" in session.pcs[UUID])){return false;}
if (session.pcs[UUID].allowScreen===false){return false;}
if (session.pcs[UUID].allowScreenVideo===false && session.pcs[UUID].allowScreenAudio===false){return false;}
if ("realUUID" in session.pcs[UUID]){return false;} // we don't want to attach to an existing screen share obviously
if (!session.screenStream){return false;}
@ -35669,6 +35664,8 @@ async function createSecondStream2(UUID){
session.pcs[UUID+"_screen"].sceneDisplay = null;
session.pcs[UUID+"_screen"].sceneMute = null;
session.pcs[UUID+"_screen"].solo = null;
session.pcs[UUID+"_screen"].allowVideo = session.pcs[UUID].allowScreenVideo;
session.pcs[UUID+"_screen"].allowAudio = session.pcs[UUID].allowScreenAudio;
session.pcs[UUID+"_screen"].layout = null;
session.pcs[UUID+"_screen"].obsState = {};
session.pcs[UUID+"_screen"].obsState.visibility = null;
@ -35702,6 +35699,8 @@ async function createSecondStream2(UUID){
session.pcs[UUID+"_screen"].preferVideoCodec = false;
session.pcs[UUID+"_screen"].startTime = Date.now();
// we will use allowVideo/allowAudio from the main UUID parent
session.pcs[UUID+"_screen"].getStats = function(){
return new Promise((resolve, reject) => {
resolve([]);
@ -35726,10 +35725,18 @@ async function createSecondStream2(UUID){
for (var i=0;i<tracks.length;i++){
var track = tracks[i];
if (session.audioContentHint && (track.kind === "audio")){
try {
track.contentHint = session.audioContentHint;
if (track.kind === "audio" && (session.pcs[UUID+"_screen"].allowAudio===false)){
continue;
} else if (track.kind === "video" && (session.pcs[UUID+"_screen"].allowVideo===false)){
continue;
}
} catch(e){errorlog(e);}
if (session.audioContentHint && (track.kind === "audio")){
try {
track.contentHint = session.audioContentHint; // this gets triggered too often I think
} catch(e){
errorlog(e);
}
@ -35737,13 +35744,13 @@ async function createSecondStream2(UUID){
if (session.screenshareContentHint && (track.kind === "video")){
try {
track.contentHint = session.screenshareContentHint;
track.contentHint = session.screenshareContentHint; // this gets triggered too often I think
} catch(e){
errorlog(e);
}
} else if (session.contentHint && (track.kind === "video")){
try {
track.contentHint = session.contentHint;
track.contentHint = session.contentHint; // this gets triggered too often I think
} catch(e){
errorlog(e);
}

View File

@ -241,6 +241,39 @@ th {
user-select: none;
}
a:link {
color: var(--a-link);
}
a:visited {
color: var(--a-visited);
}
a:hover {
color: var(--a-hover);
}
a:focus {
color: var(--a-focus);
}
a:active {
color: var(--a-active);
}
a.soloLink:link {
cursor: grab;
font-size: 1.2em;
font-weight: 700;
padding: 4px 0 2px 0;
border-radius: 5px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #b4d7f6;
}
a.soloLink:visited{
color: #b4d7f6;
}
/* Links */
a {
-webkit-app-region: no-drag;
@ -311,21 +344,6 @@ a {
}
a:link {
color: var(--a-link);
}
a:visited {
color: var(--a-visited);
}
a:hover {
color: var(--a-hover);
}
a:focus {
color: var(--a-focus);
}
a:active {
color: var(--a-active);
}
input {
border-radius: 4px;
@ -3739,17 +3757,7 @@ div#roomnotes2 {
top: 1px;
}
a.soloLink:link {
cursor: grab;
font-size: 1.2em;
font-weight: 700;
padding: 4px 0 2px 0;
border-radius: 5px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #b4d7f6;
}
.vidcon>h2 {
font-size: 1em;
margin-top: 20px;

View File

@ -464,6 +464,10 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
meshcast(true);
}
if (urlParams.has('nomeshcast')) {
session.noMeshcast = urlParams.get('nomeshcast') || true;
}
var filename = false;
try {
@ -2351,7 +2355,7 @@ async function main(){ // main asyncronous thread; mostly initializes the user s
getById("audioScreenShare1").style.display = "none";
}
if (session.audioDevice!==false){
if (session.audioDevice){ // 0 or false, do not triger
log("requestAudioStream..()");
try {
await requestAudioStream();

File diff suppressed because one or more lines are too long