Add files via upload

This commit is contained in:
Steve Seguin 2021-04-29 03:04:48 -04:00 committed by GitHub
parent a296ba8417
commit e4e9398853
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 158 additions and 110 deletions

View File

@ -76,7 +76,6 @@
<font id="qos">O</font>BS.Ninja
</span>
</a>
<div id="head1" style="display: inline-block; padding:1px; position: relative;">
<input type="text" autocorrect="off" autocapitalize="none" id="joinroomID" name="joinroomID" size="22" placeholder="Join by Room Name here" alt="Enter a room name to join" title="Enter a room name to quick join" onkeyup="jumptoroom(event)"/>
<button onclick="jumptoroom();" role="button" aria-pressed="false" alt="Join room" title="Join room" >GO</button>
@ -111,6 +110,7 @@
</div>
<div id="controlButtons" >
<div id="obsState" class="advanced" style="border:red solid 2px;padding:10px;margin:10px;color: white; zIndex:2; background-color: #222D;display: block;top: 0;position: fixed;">ON AIR</div>
<div id="subControlButtons">
<div id="queuebutton" title="Load the next guest in queue" alt="Load the next guest in queue" onmousedown="event.preventDefault(); event.stopPropagation();" onclick="session.nextQueue()" tabindex="16" role="button" aria-pressed="false" onkeyup="enterPressedClick(event,this);" class="advanced float" style="cursor: pointer;" >
<i id="queuetoggle" class="toggleSize las la-stream my-float"></i>
@ -167,7 +167,7 @@
<span
id="helpbutton"
title="Show Help Info"
onclick="warnUser('For support, please browse https://reddit.com/r/obsninja or join the live chat on Discord at https://discord.obs.ninja.\n\nThe Wiki also contains many help guides and advanced settings, located at https://wiki.obs.ninja.\n\nTo access the video stats menu, hold CTRL (command) and Left-Click on a video. Most video issues can be fixed by using Wired Internet instead of Wi-Fi.')"
onclick="warnUser('For support, please browse https://reddit.com/r/obsninja or join the live chat on Discord at https://discord.obs.ninja.\n\nThe Docs also contains many help guides and advanced settings, located at https://docs.obs.ninja.\n\nTo access the video stats menu, hold CTRL (command) and Left-Click on a video. Most video issues can be fixed by using Wired Internet instead of Wi-Fi.')"
style="cursor: pointer; display:none;"
alt="How to Use This with OBS"
>
@ -594,7 +594,7 @@
</div>
</div>
<div>See the
<a style="text-decoration: none; color: blue;" target="_blank" href="https://docs.obs.ninja/advanced">documentation</a> for more options and info.
<a style="text-decoration: none; color: blue;" target="_blank" href="https://docs.obs.ninja/advanced-settings">documentation</a> for more options and info.
</div>
</div>
</div>
@ -715,7 +715,7 @@
<br />
<br />
<h3>
🛠 For support, see the <a href="https://www.reddit.com/r/OBSNinja/">sub-reddit <i class="lab la-reddit-alien"></i></a> or join the <a href="https://discord.gg/T4xpQVv">Discord <i class="lab la-discord"></i></a>. The <a href="https://github.com/steveseguin/obsninja/wiki/">Wiki is here</a> and my personal email is <i>steve@seguin.email</i>
🛠 For support, see the <a href="https://www.reddit.com/r/OBSNinja/">sub-reddit <i class="lab la-reddit-alien"></i></a> or join the <a href="https://discord.obs.ninja">Discord <i class="lab la-discord"></i></a>. The <a href="https://docs.obs.ninja">Docs are here</a> and my personal email is <i>steve@seguin.email</i>
</h3>
</span>
@ -1239,25 +1239,25 @@
</button>
<span id="sceneGroup1">
<button style="width: 35.2px" data-scene="2" data-action-type="addToScene" data-action-type="add-scene-2" title="Add to Scene 2" onclick="directEnable(this, event, 2);">
<button style="width: 35.2px" data-scene="2" data-action-type="addToScene" data-action-type="add-scene-2" title="Add to Scene 2" onclick="directEnable(this, event, 2, true);">
<span >S2</span>
</button>
<button style="width:35.2px;" data-scene="3" data-action-type="addToScene" data-action-type="add-scene-3" title="Add to Scene 3" onclick="directEnable(this, event, 3);">
<button style="width:35.2px;" data-scene="3" data-action-type="addToScene" data-action-type="add-scene-3" title="Add to Scene 3" onclick="directEnable(this, event, 3, true);">
<span >S3</span>
</button>
<button style="width: 35.2px" data-scene="4" data-action-type="addToScene" data-action-type="add-scene-4" title="Add to Scene 4" onclick="directEnable(this, event, 4);">
<button style="width: 35.2px" data-scene="4" data-action-type="addToScene" data-action-type="add-scene-4" title="Add to Scene 4" onclick="directEnable(this, event, 4, true);">
<span >S4</span>
</button>
</span>
<span id="sceneGroup2">
<button style="width: 35.2px" data-scene="5" data-action-type="addToScene" data-action-type="add-scene-5" title="Add to Scene 5" onclick="directEnable(this, event, 5);">
<button style="width: 35.2px" data-scene="5" data-action-type="addToScene" data-action-type="add-scene-5" title="Add to Scene 5" onclick="directEnable(this, event, 5, true);">
<span >S5</span>
</button>
<button style="width: 35.2px" data-scene="6" data-action-type="addToScene" data-action-type="add-scene-6" title="Add to Scene 6" onclick="directEnable(this, event, 6);">
<button style="width: 35.2px" data-scene="6" data-action-type="addToScene" data-action-type="add-scene-6" title="Add to Scene 6" onclick="directEnable(this, event, 6, true);">
<span >S6</span>
</button>
<button style="width: 35.2px" data-scene="7" data-action-type="addToScene" data-action-type="add-scene-7" title="Add to Scene 7" onclick="directEnable(this, event, 7);">
<button style="width: 35.2px" data-scene="7" data-action-type="addToScene" data-action-type="add-scene-7" title="Add to Scene 7" onclick="directEnable(this, event, 7, true);">
<span >S7</span>
</button>
</span>
@ -1506,7 +1506,7 @@
<div id="screenPopup" class="popup-screen">
<button onclick="getById('screenPopup').style.display='none';margin:0;padding:0;">Close Window</button>
<div>See the
<a style="text-decoration: none; color: blue;" target="_blank" href="https://docs.obs.ninja/advanced">documentation</a> for more options and info.
<a style="text-decoration: none; color: blue;" target="_blank" href="https://docs.obs.ninja/advanced-settings">documentation</a> for more options and info.
</div>
</div>

View File

@ -8,6 +8,7 @@
--olive-accent: #535D32;
--regular-margin: 10px;
--director-margin: 15px 20px 0 0;
--fit-style: contain;
}
* {
@ -226,7 +227,7 @@ button.white:active {
text-shadow: 0.05em 0.05em 0px rgba(0,0,0,1);
width:100%;
height:100vh;
z-index: 1;
z-index: 7;
vertical-align: top;
text-align: center;
top: 0;
@ -358,7 +359,7 @@ hr {
}
.tile {
object-fit: contain;
object-fit: var(--fit-style);
background-color: black;
width: 100%;
height: 100%;
@ -407,10 +408,11 @@ hr {
}
.directorsgrid .vidcon video {
max-width: 100%;
padding: 0 5px;
margin: 0 5px;
padding:0;
width: 100%;
height: 148px;
max-width: 260px;
}
.directorsgrid .vidcon {

234
main.js
View File

@ -496,6 +496,96 @@ if (urlParams.has('optimize')) {
session.optimize = parseInt(urlParams.get('optimize')) || 0;
}
document.addEventListener("visibilitychange", function() {
log(document.hidden, document.visibilityState);
if ((iOS) || (iPad)) { // fixes a bug on iOS devices. Not need with other devices?
if (document.visibilityState === 'visible') {
setTimeout(function() {
resetupAudioOut();
}, 500);
}
}
});
function obsSceneChanged(event){
log(event.detail.name);
window.obsstudio.getCurrentScene(function(scene) {
log("OBS SCENE");
log(scene);
});
window.obsstudio.getStatus(function(status) {
log("OBS STATUS:");
log(status);
});
};
function obsStreamingStarted(event){};
function obsStreamingStopped(event){};
function obsRecordingStarting(event){};
function obsRecordingStopped(event){};
function obsSourceActiveChanged(event){};
function obsSourceVisibleChanged(event){
try {
if (event===true){
var visibility = true; // manually triggered
} else if (event===false){
var visibility = false; // manually triggered
} else {
var visibility = event.detail.visible; // OBS triggered
}
log("OBS VISIBILITY:"+visibility);
if (session.disableOBS===false){
var bundle = {};
bundle.sceneUpdate = [];
for (var UUID in session.rpcs){
if (session.rpcs[UUID].visibility!==visibility){ // only move forward if there is a change; the event likes to double fire you see.
session.rpcs[UUID].visibility = visibility;
var msg = {};
msg.visibility = visibility;
if (session.rpcs[UUID].videoElement.style.display == "none"){ // Flag will be left alone, but message will say its disabled.
msg.visibility = false;
}
if (session.optimize!==false){
////////////// bandwidth stuff
var bandwidth = parseInt(session.rpcs[UUID].targetBandwidth); // we don't want to change the target bandwidth, as that's still the real goal and are point of reference for reverting this change.
log("bandwidth:"+bandwidth);
if (visibility==false){ // limit bandwidth if not visible
if ((bandwidth > session.optimize) || (bandwidth<0)){ // limit to optimized bitrate
bandwidth = session.optimize;
}
}
if (session.rpcs[UUID].bandwidth !== bandwidth){ // bandwidth already set correctly. don't resend.
msg.bitrate = bandwidth;
if (session.sendRequest(msg, UUID)){
session.rpcs[UUID].bandwidth=bandwidth; // this is letting the system know what the actual bandwidth is, even if it isn't the real target.
} else {
errorlog("Unable to set update OBS Visibility");
}
} else {
session.sendRequest(msg, UUID);
msg.UUID = UUID;
bundle.sceneUpdate.push(msg)
}
///////////////// end bandwidth stuff
} else {
session.sendRequest(msg, UUID);
msg.UUID = UUID;
bundle.sceneUpdate.push(msg)
}
}
}
for (var UUID in session.rpcs){
session.sendRequest(bundle, UUID);
}
}
} catch (e){errorlog(e)};
};
if (window.obsstudio) {
session.disableWebAudio = true; // default true; might be useful to disable on slow or old computers?
session.audioMeterGuest = false;
@ -505,16 +595,17 @@ if (window.obsstudio) {
log("OBS VERSION:" + window.obsstudio.pluginVersion);
log("macOS: " + navigator.userAgent.indexOf('Mac OS X') != -1);
log(window.obsstudio);
if (!(urlParams.has('streamlabs'))) {
var ver = window.obsstudio.pluginVersion;
ver1 = ver.split(".");
updateURL("streamlabs");
var cefVersion = getChromeVersion();
if (ver1.length == 3) { // Should be 3, but disabled3
if ((ver1.length == 3) && (parseInt(ver1[0]) == 2) && (cefVersion < 76) && (navigator.userAgent.indexOf('Mac OS X') != -1)) {
updateURL("streamlabs");
getById("main").innerHTML = "<div style='background-color:black;color:white;' data-translate='obs-macos-not-supported'><h1>Update OBS Studio to v26.1.2 or newer; older versions and StreamLabs OBS are not supported on macOS.\
<br /><i><small><small>download here: <a href='https://github.com/obsproject/obs-studio/releases/tag/26.1.2'>https://github.com/obsproject/obs-studio/releases/tag/26.1.2</a></small></small></i>\
</h1> <br /><br />\
@ -527,80 +618,29 @@ if (window.obsstudio) {
}
}
}
if (navigator.userAgent.indexOf('Mac OS X') != -1) {
session.codec = "h264"; // default the codec to h264 if OBS is on macOS (that's all it supports with hardware)
}
window.addEventListener("obsSourceVisibleChanged", obsSourceVisibleChanged);
window.addEventListener("obsSourceActiveChanged", obsSourceActiveChanged);
window.addEventListener("obsSceneChanged", obsSceneChanged);
window.addEventListener("obsStreamingStarted", obsStreamingStarted);
window.addEventListener("obsStreamingStopped", obsStreamingStopped);
window.addEventListener("obsRecordingStarting", obsRecordingStarting);
window.addEventListener("obsRecordingStopped", obsRecordingStopped);
} catch (e) {
errorlog(e);
}
if (navigator.userAgent.indexOf('Mac OS X') != -1) {
session.codec = "h264"; // default the codec to h264 if OBS and macOS
}
window.addEventListener('obsSceneChanged', function(event) {
log("OBS EVENT");
log(event.detail.name);
window.obsstudio.getCurrentScene(function(scene) {
log("OBS SCENE");
log(scene);
});
window.obsstudio.getStatus(function(status) {
log("OBS STATUS:");
log(status);
});
});
window.obsstudio.onVisibilityChange = function obsvisibility(visibility){
try {
log("OBS VISIBILITY:"+visibility);
if (session.disableOBS===false){
var bundle = {};
bundle.sceneUpdate = [];
for (var UUID in session.rpcs){
if (session.rpcs[UUID].visibility!==visibility){ // only move forward if there is a change; the event likes to double fire you see.
session.rpcs[UUID].visibility = visibility;
var msg = {};
msg.visibility = visibility;
if (session.rpcs[UUID].videoElement.style.display == "none"){ // Flag will be left alone, but message will say its disabled.
msg.visibility = false;
}
if (session.optimize!==false){
////////////// bandwidth stuff
var bandwidth = parseInt(session.rpcs[UUID].targetBandwidth); // we don't want to change the target bandwidth, as that's still the real goal and are point of reference for reverting this change.
log("bandwidth:"+bandwidth);
if (visibility==false){ // limit bandwidth if not visible
if ((bandwidth > session.optimize) || (bandwidth<0)){ // limit to optimized bitrate
bandwidth = session.optimize;
}
}
if (session.rpcs[UUID].bandwidth !== bandwidth){ // bandwidth already set correctly. don't resend.
msg.bitrate = bandwidth;
if (session.sendRequest(msg, UUID)){
session.rpcs[UUID].bandwidth=bandwidth; // this is letting the system know what the actual bandwidth is, even if it isn't the real target.
} else {
errorlog("Unable to set update OBS Visibility");
}
} else {
session.sendRequest(msg, UUID);
msg.UUID = UUID;
bundle.sceneUpdate.push(msg)
}
///////////////// end bandwidth stuff
} else {
session.sendRequest(msg, UUID);
msg.UUID = UUID;
bundle.sceneUpdate.push(msg)
}
}
}
for (var UUID in session.rpcs){
session.sendRequest(bundle, UUID);
}
}
} catch (e){errorlog(e)};
};
}
@ -1078,6 +1118,10 @@ if (urlParams.has('portrait') || urlParams.has('916') || urlParams.has('vertical
session.aspectratio = 2; // 9:16 (default of 0 is 16:9)
}
if (urlParams.has('cover')) {
document.documentElement.style.setProperty('--fit-style', 'cover');
}
if (urlParams.has('record')) {
if (safariVersion()) {
if (!(session.cleanOutput)) {
@ -1771,6 +1815,7 @@ if (urlParams.has('nocursor')) {
}
`;
document.head.appendChild(style);
}
if (urlParams.has('vbr')) {
@ -3746,7 +3791,7 @@ function updateMixerRun(e=false){ // this is the main auto-mixing code. It's a
}
vid.style.objectFit = "contain";
//vid.style.objectFit = "contain"; // set by .tile now
//vid.classList="";
vid.style.maxWidth = "100%";
vid.style.maxHeight = "100%";
@ -3940,9 +3985,9 @@ function updateMixerRun(e=false){ // this is the main auto-mixing code. It's a
button.style.minWidth ="15px";
button.style.minHeight = "15px";
button.style.position = "absolute";
//button.style.display="none";
button.style.display="none";
//button.style.opacity="10%";
button.style.zIndex="3";
button.style.zIndex="6";
button.style.right = "4vh";//(Math.ceil(w/rw) -30 - 30 + offsetx+Math.floor(((i%rw)+0)*w/rw))+"px";
button.style.top = "4vh";//( offsety + 30 + Math.floor((Math.floor(i/rw)+0)*h/rh + hi))+"px";
button.style.color = "white";
@ -5941,9 +5986,14 @@ function directEnable(ele, event, scene=1, director=false) { // A directing room
ele.classList.remove("pressed");
if (ele.children[1]){
ele.children[1].innerHTML = "Add to Scene "+scene;
if (director){
}
if (director){
if (getById("container_director").querySelectorAll('[data-action-type="addToScene"][data-value="1"]').length==0){
getById("container_director").style.backgroundColor = null;
} else {
}
} else {
// data-action-type="addToScene"
if (getById("container_" + ele.dataset.UUID).querySelectorAll('[data-action-type="addToScene"][data-value="1"]').length==0){
getById("container_" + ele.dataset.UUID).style.backgroundColor = null;
}
}
@ -5952,11 +6002,11 @@ function directEnable(ele, event, scene=1, director=false) { // A directing room
ele.classList.add("pressed");
if (ele.children[1]){
ele.children[1].innerHTML = "Remove";
if (director){
getById("container_director").style.backgroundColor = "#649166";
} else {
getById("container_" + ele.dataset.UUID).style.backgroundColor = "#649166";
}
}
if (director){
getById("container_director").style.backgroundColor = "#649166";
} else {
getById("container_" + ele.dataset.UUID).style.backgroundColor = "#649166";
}
}
}
@ -9604,16 +9654,7 @@ function obfuscateURL(input) {
return output;
}
document.addEventListener("visibilitychange", function() {
log(document.hidden, document.visibilityState);
if ((iOS) || (iPad)) { // fixes a bug on iOS devices. Not need with other devices?
if (document.visibilityState === 'visible') {
setTimeout(function() {
resetupAudioOut();
}, 500);
}
}
});
try {
navigator.mediaDevices.ondevicechange = reconnectDevices;
@ -9718,6 +9759,7 @@ async function toggleScreenShare(reload = false) { ////////////////////////////
});
if (added == false) {
session.pcs[UUID].addTrack(beforeScreenShare, stream);
setTimeout(function(uuid){session.optimizeBitrate(uuid);},2000, UUID);
}
}
} catch (e) {
@ -9990,6 +10032,7 @@ async function grabScreen(quality = 0, audio = true, videoOnEnd = false) {
});
if (added == false) {
session.pcs[UUID].addTrack(beforeScreenShare, stream);
setTimeout(function(uuid){session.optimizeBitrate(uuid);},2000, UUID);
}
}
} catch (e) {
@ -10040,6 +10083,7 @@ async function grabScreen(quality = 0, audio = true, videoOnEnd = false) {
});
if (added == false) {
session.pcs[UUID].addTrack(track, stream);
setTimeout(function(uuid){session.optimizeBitrate(uuid);},2000, UUID);
}
}
} catch (e) {
@ -10335,6 +10379,7 @@ async function grabVideo(quality = 0, eleName = 'previewWebcam', selector = "sel
});
if (added == false) {
session.pcs[UUID].addTrack(track, stream); // can't replace, so adding
setTimeout(function(uuid){session.optimizeBitrate(uuid);},2000, UUID);
}
}
@ -11616,6 +11661,7 @@ session.publishFile = function(ele, event, title="Video File Sharing Session"){
});
if (added==false){
session.pcs[UUID].addTrack(track, session.streamSrc);
setTimeout(function(uuid){session.optimizeBitrate(uuid);},2000, UUID);
}
}
} catch (e){
@ -14864,7 +14910,7 @@ function getChatMessage(msg, label = false, director = false, overlay = false) {
data.type = "recv";
if (overlay) {
if (!(session.cleanOutput)){
if (!(session.cleanOutput && session.cleanish==false)){
var textOverlay = getById("overlayMsgs");
if (textOverlay) {
var spanOverlay = document.createElement("span");

File diff suppressed because one or more lines are too long