WHEP PATCH tweak; media to file recording fix

This commit is contained in:
steveseguin
2024-05-25 14:13:36 -04:00
parent b0e453cea5
commit 80c332e520
12 changed files with 508 additions and 179 deletions

207
examples/switchmics.html Normal file
View File

@@ -0,0 +1,207 @@
<html>
<head><title>Toggle Two Mutes Controller</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
<style>
body{
padding:0;
margin:0;
background-color:#003;
width:100%;
height:100%;
color:white;
font-family: tahoma, arial;
}
a {
color:white
}
iframe {
width:100%;
height:100%;
border:0;
margin:0;
padding:0;
display:block;
}
input{
padding:10px;
width:80%;
font-size:1.2em;
z-index: 1000;
}
div{
border:0;
margin:0;
padding:0;
text-align: center;
}
button {
margin:40px;
padding:40px;
}
#container2 button{
margin: 5px min(10px, 1vh);
padding:10px min(100px, 10vh);
cursor:pointer;
height:100%;
font-size: max(30px, 4.5vh);
font-weight: 900;
}
iframe{
border:1px solid white;
}
span {
margin: 0 10px;
}
.selected{
border:3px solid lightblue;
}
</style>
</head>
<body>
<div id="container1" style="width:100%;height:89%;display:none;">
</div>
<div id="container2" style="width:100%;height:10%;display:none;">
<span>
<button id='a' onclick="mute('a')" style='background-color:green'>A</button>
<button id='c' onclick="mute('c')" style='background-color:red'>MUTE BOTH</button>
<button id='b' onclick="mute('b')" style='background-color:green'>B</button>
</span>
</div>
<div id="deleteme">
<h2>PTZ Remote Control interface</h2>
<input placeholder="Enter a push link. ie) https://vdo.ninja/?push=english123a&label=ENGLISH" id="viewlinka" type="text"><br>
<input placeholder="Enter a push link. ie) https://vdo.ninja/?push=french123b&label=FRENCH" id="viewlinkb" type="text" /><br>
<button onclick="loadIframes()">CONNECT</button>
<br>
This app is a toggle between two different inputs
</div>
<script>
var iframe;
function mute(target){
if (iframea && iframeb){
if (target=="a"){
document.getElementById("b").classList.remove("selected");
document.getElementById("c").classList.remove("selected");
document.getElementById("a").classList.add("selected");
iframea.contentWindow.postMessage({mic:true}, '*');
iframeb.contentWindow.postMessage({mic:false}, '*');
} else if (target=="b"){
document.getElementById("a").classList.remove("selected");
document.getElementById("c").classList.remove("selected");
document.getElementById("b").classList.add("selected");
iframea.contentWindow.postMessage({mic:false}, '*');
iframeb.contentWindow.postMessage({mic:true}, '*');
} else {
document.getElementById("a").classList.remove("selected");
document.getElementById("b").classList.remove("selected");
document.getElementById("c").classList.add("selected");
iframea.contentWindow.postMessage({mic:false}, '*');
iframeb.contentWindow.postMessage({mic:false}, '*');
}
}
}
var urlEdited = window.location.search.replace(/\?\?/g, "?");
urlEdited = urlEdited.replace(/\?/g, "&");
urlEdited = urlEdited.replace(/\&/, "?");
if (urlEdited !== window.location.search){
warnlog(window.location.search + " changed to " + urlEdited);
window.history.pushState({path: urlEdited.toString()}, '', urlEdited.toString());
}
var urlParams = new URLSearchParams(urlEdited);
if (urlParams.get("a")){
if (window.location.host){
var path = window.location.host+window.location.pathname.replace("/examples/","/").split("/").slice(0,-1).join("/");
} else {
var path = "vdo.ninja";
}
document.getElementById("viewlinka").value = "https://"+path+"/?push="+urlParams.get("a");
if (urlParams.get("la")){
document.getElementById("viewlinka").value += "&label="+urlParams.get("la");
document.getElementById("a").innerHTML = urlParams.get("la")
}
}
if (urlParams.get("b")){
if (window.location.host){
var path = window.location.host+window.location.pathname.replace("/examples/","/").split("/").slice(0,-1).join("/");
} else {
var path = "vdo.ninja";
}
document.getElementById("viewlinkb").value = "https://"+path+"/?push="+urlParams.get("b");
if (urlParams.get("lb")){
document.getElementById("viewlinkb").value += "&label="+urlParams.get("lb");
document.getElementById("b").innerHTML = urlParams.get("lb")
}
}
var iframeb = null;
var iframea = null;
function loadIframes(){
var iframesrca = document.getElementById("viewlinka").value;
var iframesrcb = document.getElementById("viewlinkb").value;
document.getElementById("deleteme").remove()
delete document.getElementById("deleteme");
document.getElementById("container1").style.display="flex";
document.getElementById("container2").style.display="inline-block";
var params = window.location.search || "";
if (iframesrca.includes("?")){
params = params.slice(1);
iframesrca = iframesrca + "&" + params
} else {
iframesrca = iframesrca + params
}
if (iframesrcb.includes("?")){
params = params.slice(1);
iframesrcb = iframesrcb + "&" + params
} else {
iframesrcb = iframesrcb + params
}
iframea = document.createElement("iframe");
iframea.allow = "encrypted-media;sync-xhr;usb;web-share;cross-origin-isolated;accelerometer;midi;geolocation;autoplay;camera;microphone;fullscreen;picture-in-picture;display-capture;gyroscope;";
iframea.src = iframesrca;
document.getElementById("container1").appendChild(iframea);
iframeb = document.createElement("iframe");
iframeb.allow = "encrypted-media;sync-xhr;usb;web-share;cross-origin-isolated;accelerometer;midi;geolocation;autoplay;camera;microphone;fullscreen;picture-in-picture;display-capture;gyroscope;";
iframeb.src = iframesrcb;
document.getElementById("container1").appendChild(iframeb);
}
window.addEventListener("message", function (e) {
if (iframeb && (e.source === iframeb.contentWindow)) {
console.log(e.data);
if (e.data.action == "this-label"){
document.getElementById("a").innerHTML = e.data.value;
}
} else if (iframea && (e.source === iframea.contentWindow)) {
if (e.data.action == "this-label"){
document.getElementById("b").innerHTML = e.data.value;
}
}
}, false);
</script>
</body>
</html>

View File

@@ -92,7 +92,7 @@
<script type="text/javascript" crossorigin="anonymous" src="./thirdparty/CodecsHandler.js?ver=10"></script>
<script type="text/javascript" crossorigin="anonymous" src="./thirdparty/aes.js"></script>
<script type="text/javascript" crossorigin="anonymous" src="./webrtc.js?ver=783"></script>
<script type="text/javascript" crossorigin="anonymous" src="./webrtc.js?ver=789"></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">
@@ -2634,7 +2634,7 @@
// if (!window.location.search){document.body.innerHTML = "";} // uncomment this line, if you wish to try it.
var session = WebRTC.Media; // session is a required global variable if configuring manually. Run before loading main.js but after webrtc.js.
session.version = "25.3";
session.version = "25.4";
session.streamID = session.generateStreamID(); // randomly generates a streamID for this session. You can set your own programmatically if needed
session.defaultPassword = "someEncryptionKey123"; // Change this password if self-deploying for added security/privacy
@@ -2756,7 +2756,7 @@
// session.decrypted = session.decodeInvite("U2FsdGVkX1+d58DFIHoO3EQZSuX86ch4PqW2ouztnJ0="); // get a code from invite.cam
</script>
<script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=1165"></script>
<script type="text/javascript" crossorigin="anonymous" id="main-js" src="./main.js?ver=879"></script>
<script type="text/javascript" crossorigin="anonymous" id="lib-js" src="./lib.js?ver=1168"></script>
<script type="text/javascript" crossorigin="anonymous" id="main-js" src="./main.js?ver=880"></script>
</body>
</html>

190
lib.js
View File

@@ -4222,7 +4222,7 @@ function setupIncomingScreenTracking(v, UUID) {
log("AUTO RECORD START");
setTimeout(
function (UUID, v) {
var videoKbps = 4000;
var videoKbps = session.recordDefault;
if (session.recordLocal !== false) {
videoKbps = session.recordLocal;
}
@@ -4601,7 +4601,7 @@ function setupIncomingVideoTracking(v, UUID) {
log("AUTO RECORD START");
setTimeout(
function (UUID, v) {
var videoKbps = 4000;
var videoKbps = session.recordDefault;
if (session.recordLocal !== false) {
videoKbps = session.recordLocal;
}
@@ -6593,21 +6593,26 @@ function updateMixerRun(e = false) {
// ANIMATED - CONTAINER ; width/height/z-index/cover///////////////
if (layout) {
var left = (w / 100) * layout[vid.dataset.sid].x || layout[vid.dataset.sid].xp || 0;
var top = (h / 100) * layout[vid.dataset.sid].y || layout[vid.dataset.sid].yp || 0;
top += hi;
var width = (w / 100) * layout[vid.dataset.sid].w || layout[vid.dataset.sid].wp || 0;
var height = (h / 100) * layout[vid.dataset.sid].h || layout[vid.dataset.sid].hp || 0;
if (layout[vid.dataset.sid].cover || layout[vid.dataset.sid].c) {
// this should be true/false
//vid.style.objectFit = "cover";
cover = true;
} else {
//vid.style.objectFit = "contain"; // this should fall back to sessio.cover if no layout supplied
cover = false;
try {
var left = (w / 100) * layout[vid.dataset.sid].x || layout[vid.dataset.sid].xp || 0;
var top = (h / 100) * layout[vid.dataset.sid].y || layout[vid.dataset.sid].yp || 0;
top += hi;
var width = (w / 100) * layout[vid.dataset.sid].w || layout[vid.dataset.sid].wp || 0;
var height = (h / 100) * layout[vid.dataset.sid].h || layout[vid.dataset.sid].hp || 0;
if (layout[vid.dataset.sid].cover || layout[vid.dataset.sid].c) {
// this should be true/false
//vid.style.objectFit = "cover";
cover = true;
} else {
//vid.style.objectFit = "contain"; // this should fall back to sessio.cover if no layout supplied
cover = false;
}
//container.style.zindex = 0;
container.style.zIndex = layout[vid.dataset.sid].zIndex || layout[vid.dataset.sid].z || 0;
} catch(e){
errorlog(e);
}
//container.style.zindex = 0;
container.style.zIndex = layout[vid.dataset.sid].zIndex || layout[vid.dataset.sid].z || 0;
} else {
var left = Math.max(offsetx + Math.floor((((i % rw) + 0) * w) / rw), 0);
var top = Math.max(offsety + Math.floor(((Math.floor(i / rw) + 0) * h) / rh + hi), 0);
@@ -13500,7 +13505,9 @@ function toggleMute(apply = false, event = false) {
track.enabled = true;
});
}
//if (event){ // this might be a good solution, if there is a problem.
refreshMicrophoneDevice(); // to address an issue with iOS/iPad devices losing audio when an inbound audio souce hits.
//}
//}
// toggleMute(false, event)
@@ -13516,7 +13523,7 @@ function toggleMute(apply = false, event = false) {
if (!apply) {
// only if they are changing states do we bother to spam.
data = {};
var data = {};
data.muteState = session.muted;
session.sendMessage(data);
log("SEND MUTE STATE TO PEERS");
@@ -16241,7 +16248,9 @@ async function publishScreen() {
if (session.echoCancellation === true) {
constraints.audio.echoCancellation = true; // the defaults for screen publishing should be off.
}
if (session.voiceIsolation === true){
constraint.audio.voiceIsolation = true;
}
try {
let supportedConstraints = navigator.mediaDevices.getSupportedConstraints();
if (supportedConstraints.cursor) {
@@ -23460,8 +23469,8 @@ function refreshVideoDevice() {
grabVideo(session.quality, "videosource", "select#videoSource3");
}
function refreshMicrophoneDevice() {
if (session.screenShareState) {
log("can't refresh a screenshare");
if (session.screenShareState || session.mediafileShare) {
log("can't refresh a screenshare or fileshare");
return;
}
log("refreshing microphone..");
@@ -23782,7 +23791,7 @@ async function getAudioOnly(selector, trackid = null, override = false) {
}
for (var i = 0; i < audioList.length; i++) {
if (session.echoCancellation !== false && session.autoGainControl !== false && session.noiseSuppression !== false) {
if (session.echoCancellation !== false && session.autoGainControl !== false && session.noiseSuppression !== false && (session.voiceIsolation !== true)) {
var constraint = {
audio: {
deviceId: {
@@ -23814,6 +23823,9 @@ async function getAudioOnly(selector, trackid = null, override = false) {
} else {
constraint.audio.noiseSuppression = true;
}
if (session.voiceIsolation === true){
constraint.audio.voiceIsolation = true;
}
}
constraint.video = false;
if (override !== false) {
@@ -25150,6 +25162,9 @@ async function grabScreen(quality = 0, audio = true, videoOnEnd = false) {
if (session.noiseSuppression === true) {
constraints.audio.noiseSuppression = true;
}
if (session.voiceIsolation === true){
constraint.audio.voiceIsolation = true;
}
if (audio == false) {
constraints.audio = false;
}
@@ -27887,7 +27902,7 @@ async function press2talk(clean = false) {
log("AUTO RECORD START");
setTimeout(
function (v) {
var videoKbps = 4000;
var videoKbps = session.recordDefault;
if (session.recordLocal !== false) {
videoKbps = session.recordLocal;
}
@@ -28246,7 +28261,7 @@ session.publishStream = function (v) {
log("AUTO RECORD START");
setTimeout(
function (v) {
var videoKbps = 4000;
var videoKbps = session.recordDefault;
if (session.recordLocal !== false) {
videoKbps = session.recordLocal;
}
@@ -28434,6 +28449,10 @@ async function publishScreen2(constraints, audioList = [], audio = true, overrid
} else {
constraint.audio.noiseSuppression = true;
}
if (session.voiceIsolation === true) {
constraint.audio.voiceIsolation = true;
}
if (session.audioInputChannels) {
if (constraint.audio === true) {
@@ -28866,7 +28885,7 @@ async function publishScreen2(constraints, audioList = [], audio = true, overrid
log("AUTO RECORD START");
setTimeout(
function (v) {
var videoKbps = 4000;
var videoKbps = session.recordDefault;
if (session.recordLocal !== false) {
videoKbps = session.recordLocal;
}
@@ -29316,6 +29335,7 @@ function nextFilePlaylist(vid) {
session.publishFile = function (ele, event) {
// webcam stream is used to generated an SDP
log("FILE STREAM SETUP");
if (session.transcript) {
setTimeout(function () {
@@ -29334,7 +29354,6 @@ session.publishFile = function (ele, event) {
var fileURL = URL.createObjectURL(files[0]);
var container = document.createElement("div");
container.id = "container";
//container.className = "vidcon";
if (session.cover) {
container.style.setProperty("height", "100%", "important");
@@ -29342,19 +29361,21 @@ session.publishFile = function (ele, event) {
var v = createVideoElement();
v.container = container;
if (session.cleanOutput) {
container.style.height = "100%";
v.style.maxWidth = "100%";
v.style.boxShadow = "none";
}
container.appendChild(v);
if (session.streamID) {
v.dataset.sid = session.streamID;
}
getById("gridlayout").appendChild(container);
if (session.roomid !== false) {
if (session.roomid === "" && (!session.view || session.view === "")) {
} else {
@@ -29371,13 +29392,12 @@ session.publishFile = function (ele, event) {
getById("head3a").classList.remove("hidden");
getById("logoname").style.display = "none";
}
getById("head1").className = "hidden";
updatePushId();
getById("head1").className = "hidden";
getById("head2").className = "hidden";
if (!session.cleanOutput) {
getById("chatbutton").className = "float";
getById("sharefilebutton").classList.remove("hidden"); // we won't override "display:none", if set, though.
@@ -29414,23 +29434,20 @@ session.publishFile = function (ele, event) {
var vid = getById("videosource");
nextFilePlaylist(vid);
}
v.id = "videosource"; // could be set to UUID in the future
v.dataset.menu = "context-menu-video";
v.setAttribute("playsinline", "");
v.src = fileURL;
v.playlist = files;
v.addEventListener("ended", myHandler, false); // only fires if the video doesn't loop.
v.setAttribute("playsinline", "");
v.src = fileURL;
v.className = "tile clean fileshare";
session.videoElement = v;
container.appendChild(v);
session.mirrorExclude = true;
v.addEventListener("click", function (e) {
v.addEventListener("click", (e) => {
log("click");
try {
if (e.ctrlKey || e.metaKey) {
@@ -29452,7 +29469,8 @@ session.publishFile = function (ele, event) {
v.touchTimeOut = null;
v.touchLastTap = 0;
v.touchCount = 0;
v.addEventListener("touchend", function (event) {
v.addEventListener("touchend", (event) => {
if (session.disableMouseEvents) {
return;
}
@@ -29501,7 +29519,7 @@ session.publishFile = function (ele, event) {
}
});
v.onerror = function () {
v.onerror = () => {
if (session.cleanOutput) {
errorlog("File failed to load.\n\nSelect a compatible media file.");
} else {
@@ -29509,16 +29527,19 @@ session.publishFile = function (ele, event) {
}
};
v.onloadeddata = function () {
v.onloadeddata = () => {
session.mediafileShare = true;
getById("mainmenu").remove();
if (Firefox) {
session.streamSrc = v.mozCaptureStream();
} else {
session.streamSrc = v.captureStream(); // gaaaaaaaaaaaahhhhhhhh!
}
toggleMute(true);
session.streamSrc = outboundAudioPipeline(session.streamSrc);
updateMixer();
if (session.director) {
} else if (session.scene !== false) {
} else if (session.roomid !== false) {
@@ -29571,6 +29592,9 @@ session.publishFile = function (ele, event) {
container.backgroundColor = "#666";
applyMirror(session.mirrorExclude);
}
//session.streamSrc = outboundAudioPipeline(session.streamSrc);
//updateMixer();
updateReshareLink();
pokeIframeAPI("started-fileshare"); // depreciated
@@ -34982,7 +35006,7 @@ function previewWebcam(miconly = false) {
var constraint = {
audio: false
};
} else if (session.echoCancellation !== false && session.autoGainControl !== false && session.noiseSuppression !== false) {
} else if ((session.echoCancellation !== false) && (session.autoGainControl !== false) && (session.noiseSuppression !== false) && (session.voiceIsolation !== true)) {
// AUTO
var constraint = {
audio: true
@@ -35013,6 +35037,10 @@ function previewWebcam(miconly = false) {
} else {
constraint.audio.noiseSuppression = false;
}
if (session.voiceIsolation===true){
constraint.audio.voiceIsolation = true;
}
}
if (session.videoDevice === 0 || miconly) {
@@ -35816,9 +35844,14 @@ function pauseVideo(videoEle, update = true) {
}
function positionMenu(e) {
var clickCoords = getPosition(e);
clickCoordsX = clickCoords.x;
clickCoordsY = clickCoords.y;
try {
var clickCoords = getPosition(e);
clickCoordsX = clickCoords.x;
clickCoordsY = clickCoords.y;
} catch(e){
errorlog(e);
return;
}
menuWidth = menu.offsetWidth + 4;
menuHeight = menu.offsetHeight + 4;
@@ -35881,7 +35914,7 @@ function pauseVideo(videoEle, update = true) {
} else if (taskItemInContext.startWriter) {
taskItemInContext.startWriter();
} else {
var videoKbps = 4000;
var videoKbps = session.recordDefault;
if (session.recordLocal !== false) {
videoKbps = session.recordLocal;
}
@@ -36732,7 +36765,32 @@ function createPopoutChat() {
errorlog(e);
};
}
window.open("./popout.html?id=" + session.broadcastChannelID, "popup", "width=600,height=480,toolbar=no,menubar=no,resizable=yes");
const popup = window.open("", "popup", "width=600,height=480,toolbar=no,menubar=no,resizable=yes");
popup.onload = () => {
const newUrl = "./HELLO"; // The new URL you want to show
popup.history.replaceState({}, "", newUrl);
};
const iframe = popup.document.createElement('iframe');
iframe.src = "./popout.html?id=" + session.broadcastChannelID;
iframe.style.width = "100%";
iframe.style.height = "100%";
iframe.style.border = "none";
iframe.style.overflow = "hidden";
iframe.style.position = "absolute";
iframe.style.top = "0";
iframe.style.left = "0";
popup.document.body.style.margin = "0";
popup.document.body.style.padding = "0";
popup.document.body.style.overflow = "hidden";
popup.document.body.appendChild(iframe);
popup.document.title = "Chat pop-out";
//window.open("./popout.html?id=" + session.broadcastChannelID, "popup", "width=600,height=480,toolbar=no,menubar=no,resizable=yes");
return false;
}
@@ -38175,7 +38233,7 @@ async function recordVideo(target, event = null, videoKbps = false) {
if (videoKbps === false) {
if (defaultRecordingBitrate == false) {
videoKbps = 4000;
videoKbps = session.recordDefault;
if (session.recordLocal !== false) {
videoKbps = session.recordLocal;
}
@@ -38436,8 +38494,8 @@ async function recordVideo(target, event = null, videoKbps = false) {
}
var writer = writable.getWriter();
readable.pipeTo(streamSaver.createWriteStream(filename.toString() + filext, video.recorder.stop));
video.recorder.writer = writer;
readable.pipeTo(streamSaver.createWriteStream(filename.toString() + filext, video.recorder.stop));
pokeIframeAPI("recording-started");
log(options);
@@ -38493,6 +38551,7 @@ async function recordVideo(target, event = null, videoKbps = false) {
video.recorder.mediaRecorder.onerror = function (event) {
errorlog(event);
console.log("It's possible using &recordcodec=vp8 might resolve recording errors if caused by an incompatible hardware encoder or codec");
video.recorder.stop();
session.requestRateLimit(35, UUID);
if (!session.cleanOutput) {
@@ -38518,7 +38577,9 @@ async function recordVideo(target, event = null, videoKbps = false) {
setTimeout(
function (v) {
v.recorder.mediaRecorder.start(1000);
if (v && v.recorder){
v.recorder.mediaRecorder.start(1000);
}
},
500,
video
@@ -39547,6 +39608,7 @@ async function recordLocalVideo(action = null, videoKbps = false, remote = false
video.recorder.mediaRecorder.onerror = function (event) {
errorlog(event);
console.log("It's possible using &recordcodec=vp8 might resolve recording errors if caused by an incompatible hardware encoder or codec");
if (event && event.error && event.error.name) {
video.recorder.stop(event.error.name);
} else {
@@ -42194,6 +42256,14 @@ async function startPublishing() {
session.noiseSuppression = false;
}
}
if (!getById("whipoutisolation").classList.contains("hidden")) {
if (getById("whipoutisolation").value === "1") {
session.voiceIsolation = true;
} else {
session.voiceIsolation = false;
}
}
if (!getById("whipoutautogain").classList.contains("hidden")) {
if (getById("whipoutautogain").value === "1") {
session.autoGainControl = true;
@@ -43386,7 +43456,7 @@ async function whepIn(whepInput = false, whepInputToken = false, UUID = false) {
"a=ice-pwd:" +
icePwd +
"\r\n" +
"m=audio RTP/AVP 0\r\n" +
"m=audio 9 RTP/AVP 0\r\n" +
"a=mid:0\r\n" +
"a=" +
event.candidate.candidate +
@@ -43557,7 +43627,7 @@ async function whepIn(whepInput = false, whepInputToken = false, UUID = false) {
"a=ice-pwd:" +
icePwd +
"\r\n" +
"m=audio RTP/AVP 0\r\n" +
"m=audio 9 RTP/AVP 0\r\n" +
"a=mid:0\r\n";
candidates.forEach(candidate => {
patchCandidates += "a=" + candidate.candidate + "\r\n";
@@ -44963,6 +45033,9 @@ addEventToAll(".column", "click", function (e, ele) {
} catch (e) {
return;
}
if (!bounding_box){
errorlog("No bounding box for ele found");
}
ele.style.top = bounding_box.top + "px";
ele.style.left = bounding_box.left - 20 + "px";
ele.classList.add("in-animation");
@@ -45666,6 +45739,9 @@ async function createSecondStream() {
if (session.noiseSuppression === true) {
constraints.audio.noiseSuppression = true;
}
if (session.voiceIsolation === true){
constraint.audio.voiceIsolation = true;
}
//if (audio == false) {
// constraints.audio = false;
//}
@@ -45929,7 +46005,7 @@ async function createSecondStream() {
ele.classList.add("hidden");
ele.vid = null;
} else {
var videoKbps = 4000;
var videoKbps = session.recordDefault;
if (session.recordLocal !== false) {
videoKbps = session.recordLocal;
}

50
main.js
View File

@@ -1489,9 +1489,11 @@ async function main() {
session.record = false;
session.recordLocal = false;
} else if (session.recordLocal != parseInt(session.recordLocal)) {
session.recordLocal = 6000;
} else {
session.recordLocal = session.recordDefault;
} else if (session.recordLocal !== null){
session.recordLocal = parseInt(session.recordLocal);
} else {
session.recordLocal = session.recordDefault;
}
}
@@ -1516,10 +1518,10 @@ async function main() {
session.autorecord = true;
if (session.recordLocal === false) {
let bitautorec = urlParams.get("autorecord");
if (bitautorec !== null) {
if (bitautorec !== "") {
session.recordLocal = parseInt(bitautorec);
} else {
session.recordLocal = 6000;
session.recordLocal = session.recordDefault;
}
}
}
@@ -1528,9 +1530,11 @@ async function main() {
if (session.recordLocal === false) {
session.recordLocal = urlParams.get("autorecordlocal");
if (session.recordLocal != parseInt(session.recordLocal)) {
session.recordLocal = 6000;
} else {
session.recordLocal = session.recordDefault;
} else if (session.recordLocal !== ""){
session.recordLocal = parseInt(session.recordLocal);
} else {
session.recordLocal = session.recordDefault;
}
}
}
@@ -1539,9 +1543,11 @@ async function main() {
if (session.recordLocal === false) {
session.recordLocal = urlParams.get("autorecordremote");
if (session.recordLocal != parseInt(session.recordLocal)) {
session.recordLocal = 6000;
} else {
session.recordLocal = session.recordDefault;
} else if (session.recordLocal !== ""){
session.recordLocal = parseInt(session.recordLocal);
} else {
session.recordLocal = session.recordDefault;
}
}
}
@@ -2198,6 +2204,10 @@ async function main() {
}
}
}
if (session.label){
pokeIframeAPI("this-label", session.label);
}
if (urlParams.has("transparent") || urlParams.has("transparency")) {
// sets the window to be transparent - useful for IFRAMES?
@@ -2418,7 +2428,29 @@ async function main() {
session.noiseSuppression = true;
}
}
if (urlParams.has("isolation") || urlParams.has("voiceisolation") || urlParams.has("vi")) {
session.voiceIsolation = urlParams.get("isolation") || urlParams.get("voiceisolation") || urlParams.get("vi");
if (session.voiceIsolation) {
session.voiceIsolation = session.voiceIsolation.toLowerCase();
}
if (session.voiceIsolation == "false") {
session.voiceIsolation = false;
} else if (session.voiceIsolation == "0") {
session.voiceIsolation = false;
} else if (session.voiceIsolation == "no") {
session.voiceIsolation = false;
} else if (session.voiceIsolation == "off") {
session.voiceIsolation = false;
} else {
session.voiceIsolation = true;
}
}
if (session.voiceIsolation !== null) {
getById("whipoutvoiceisolation").classList.add("hidden");
}
if (session.noiseSuppression !== null) {
getById("whipoutdenoise").classList.add("hidden");
}
@@ -7646,7 +7678,7 @@ async function main() {
// blob mode not needed since iOS 15.6
script.src = "./thirdparty/StreamSaver_legacy.js?v=2"; // blob mode for Safari
} else {
script.src = "./thirdparty/StreamSaver.js?v=24"; // do not use blob mode
script.src = "./thirdparty/StreamSaver.js?v=29"; // do not use blob mode
}
};
script.src = "./thirdparty/polyfill.min.js"; // dynamically load this only if its needed. Keeps loading time down.

BIN
media/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
media/overlay1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

BIN
media/overlay2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -2230,6 +2230,9 @@
}
var injectCSS = `
#directorLinks1,#directorLinks2 {
display:none!important;
}
.directorsgrid .vidcon {
display: inline-block !important;
width: 293.7px !important;
@@ -2970,12 +2973,15 @@
document.querySelectorAll(".inviteLink").forEach(ele=>{
if (ele.tagName == "A"){
ele.href = inviteURL
ele.title = "Copy link to clipboard";
ele.onclick = function(evt){copyFunction(inviteURL, evt);};
} else if (document.getElementById("obfuscateInvites").checked){
ele.innerHTML = inviteURL;
ele.onclick = function(evt){copyFunction(inviteURL, evt);};
ele.title = "Copy link to clipboard";
} else if (ele.tagName == "I"){
ele.innerHTML = "URL + ?room="+roomname+additional+additionalParams;
}
ele.onclick = function(evt){copyFunction(this, evt);};
});
if (event){

View File

@@ -1,126 +1,128 @@
<html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="theme-color" content="#ffffff" />
<!-- <link rel="stylesheet" href="./main.css?ver=22" /> -->
<style>
<title>VDO.Ninja Chat Pop-out</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#ffffff" />
<style>
:root {
--discord-grey-0: #121212;
--discord-grey-1: #1e1f22;
--discord-grey-1a: #1e1f22;
--discord-grey-2: #232428;
--discord-grey-3: #2b2d31;
--discord-grey-4: #2e3035;
--discord-grey-5: #313338;
--discord-grey-6: #383a40;
--discord-grey-7: #404249;
--discord-grey-8: #5e6064;
--discord-text: hsl( 210 calc(1 * 9.1%) 87.1% /1);
:root {
--discord-grey-0: #121212;
--discord-grey-1: #1e1f22;
--discord-grey-1a: #1e1f22;
--discord-grey-2: #232428;
--discord-grey-3: #2b2d31;
--discord-grey-4: #2e3035;
--discord-grey-5: #313338;
--discord-grey-6: #383a40;
--discord-grey-7: #404249;
--discord-grey-8: #5e6064;
--discord-text: hsl( 210 calc(1 * 9.1%) 87.1% /1);
--baby-blue: #BCF;
}
--baby-blue: #BCF;
}
* {
padding: 0;
margin: 0;
border: 0;
box-sizing: border-box;
}
* {
padding: 0;
margin: 0;
border: 0;
box-sizing: border-box;
}
body{
background-color: var(--discord-grey-0);
height: 100vh;
width: 100vw;
}
body{
background-color: var(--discord-grey-0);
height: 100%;
width: 100%;
}
#chatModule{
display: flex;
flex-direction: column;
padding: 5px;
height: 100%;
gap: 5px;
justify-content: flex-end;
}
#chatModule{
display: flex;
flex-direction: column;
padding: 5px;
height: 100%;
gap: 5px;
justify-content: flex-end;
}
#chatBody {
display: flex;
flex-direction: column;
gap: 5px;
overflow-y: auto;
}
#chatBody {
display: flex;
flex-direction: column;
gap: 5px;
overflow-y: auto;
}
.outMessage, .inMessage {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 5px;
.outMessage, .inMessage {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 5px;
font-family: 'Roboto';
font-size: 14px;
text-align: right;
background-color: var(--baby-blue);
border-radius: 4px;
padding: 2px 5px;
}
font-family: 'Roboto';
font-size: 14px;
text-align: right;
background-color: var(--baby-blue);
border-radius: 4px;
padding: 2px 5px;
}
.inMessage {
color: var(--discord-text);
background-color: var(--discord-grey-7);
}
.inMessage {
color: var(--discord-text);
background-color: var(--discord-grey-7);
}
.outMessage .chat_message {
font-weight: bold;
}
.outMessage .chat_message {
font-weight: bold;
}
::-webkit-input-placeholder {
color: #ccc !important;
}
::-webkit-input-placeholder {
color: #ccc !important;
}
.controls {
display: flex;
flex-direction: row;
gap: 5px;
height: 25px;
flex-shrink: 0;
}
.controls {
display: flex;
flex-direction: row;
gap: 5px;
height: 25px;
flex-shrink: 0;
}
.controls input {
border-radius: 4px;
flex: 3;
color: var(--discord-text);
background-color: var(--discord-grey-5);
border: 1px solid var(--discord-grey-8);
padding: 0px 5px;
}
.controls input {
border-radius: 4px;
flex: 3;
color: var(--discord-text);
background-color: var(--discord-grey-5);
border: 1px solid var(--discord-grey-8);
padding: 0px 5px;
}
.controls button {
border-radius: 4px;
flex: 1;
color: var(--discord-text);
background-color: var(--discord-grey-2);
border: 1px solid var(--discord-grey-8);
}
.controls button {
border-radius: 4px;
flex: 1;
color: var(--discord-text);
background-color: var(--discord-grey-2);
border: 1px solid var(--discord-grey-8);
}
/* SCROLL BAR STYLING */
::-webkit-scrollbar {
width: 12px;
}
/* SCROLL BAR STYLING */
::-webkit-scrollbar {
width: 12px;
}
::-webkit-scrollbar-track {
background-color: var(--discord-grey-1);
border-radius: 4px;
}
::-webkit-scrollbar-track {
background-color: var(--discord-grey-1);
border-radius: 4px;
}
::-webkit-scrollbar-thumb {
background-color: var(--discord-grey-7);
border-radius: 4px;
}
::-webkit-scrollbar-thumb {
background-color: var(--discord-grey-7);
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background-color: var(--discord-grey-8);
}
::-webkit-scrollbar-thumb:hover {
background-color: var(--discord-grey-8);
}
</style>
</style>
</head>
<body>
<div id="chatModule" >

View File

@@ -98,7 +98,7 @@ function streamSaverFunction(){
}
channel.port1.onmessage = evt => {
console.log(evt);
//console.log(evt);
// Service worker sent us a link that we should open.
if (evt.data.download) {
// Special treatment for popup...
@@ -213,7 +213,7 @@ function streamSaverFunction(){
WritableStream: global.WritableStream || ponyfill.WritableStream,
supported: true,
version: { full: '2.0.7', major: 2, minor: 0, dot: 7 },
mitm: './thirdparty/mitm.html?v=3'
mitm: './thirdparty/mitm.html?v=4'
}
//console.log(streamSaver);
@@ -232,6 +232,7 @@ function streamSaverFunction(){
iframe.loaded = false
iframe.name = 'iframe'
iframe.isIframe = true
iframe.credentialless = true
iframe.postMessage = (...args) => iframe.contentWindow.postMessage(...args)
iframe.addEventListener('load', () => {
iframe.loaded = true

View File

@@ -41,7 +41,7 @@ let scope = ''
function registerWorker() {
return navigator.serviceWorker.getRegistration('./').then(swReg => {
return swReg || navigator.serviceWorker.register('sw.js', { scope: './' })
return swReg || navigator.serviceWorker.register('sw.js?v=2', { scope: './' })
}).then(swReg => {
const swRegTmp = swReg.installing || swReg.waiting
@@ -63,6 +63,11 @@ function registerWorker() {
function onMessage (event) {
let { data, ports, origin } = event
// Ignore messages other than from iframe parent (e.g. extensions)
if (event.source !== window.parent) {
return
}
// It's important to have a messageChannel, don't want to interfere
// with other simultaneous downloads
if (!ports || !ports.length) {

File diff suppressed because one or more lines are too long