mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-05 23:42:58 +02:00
cleaned up logs and old code
This commit is contained in:
parent
4962e26664
commit
239ca45754
3 changed files with 24 additions and 85 deletions
|
@ -15,7 +15,6 @@
|
|||
}"
|
||||
*/
|
||||
|
||||
var isBrowser = false;
|
||||
const imageWidth = 265;
|
||||
const imageHeight = 165;
|
||||
|
||||
|
@ -36,14 +35,11 @@ for (let index = 0; index < images; index++) {
|
|||
testSources.push(test);
|
||||
}
|
||||
|
||||
// if (!isBrowser) {
|
||||
const electron = require('electron');
|
||||
// }
|
||||
const electron = require('electron');
|
||||
|
||||
let currentScreensharePickID = "";
|
||||
function screensharePicked(id){
|
||||
currentScreensharePickID = id;
|
||||
console.log(currentScreensharePickID);
|
||||
document.getElementById("share_pick").innerHTML = "";
|
||||
addSource(sourceMap[id], "share_pick");
|
||||
togglePage();
|
||||
|
@ -77,13 +73,12 @@ function togglePage(){
|
|||
// UI
|
||||
function addSource(source, type) {
|
||||
let sourceBody = document.createElement('div')
|
||||
let thumbnail = isBrowser ? source.thumbnail : source.thumbnail.toDataURL();
|
||||
let thumbnail = source.thumbnail.toDataURL();
|
||||
sourceBody.classList.add("box")
|
||||
if (type === "share_pick") {
|
||||
sourceBody.style.marginLeft = "0px";
|
||||
}
|
||||
|
||||
let circle = `<div class="circle" onclick="screensharePicked('${source.id}')"}></div>`
|
||||
let image = "";
|
||||
if (source.appIcon) {
|
||||
image = `<img class="icon" src="${source.appIcon.toDataURL()}" />`;
|
||||
|
@ -97,7 +92,6 @@ function togglePage(){
|
|||
<img src="${thumbnail}" />
|
||||
</div>
|
||||
`
|
||||
// console.log(sourceBody.innerHTML);
|
||||
if (type === "selects") {
|
||||
document.getElementById("selects").appendChild(sourceBody);
|
||||
} else {
|
||||
|
@ -110,34 +104,23 @@ function togglePage(){
|
|||
let sourceMap = {};
|
||||
function showSources() {
|
||||
document.getElementById("selects").innerHTML="";
|
||||
if (isBrowser) {
|
||||
for (let source of testSources) {
|
||||
sourceMap[source.id] = source;
|
||||
addSource(source, "selects");
|
||||
electron.desktopCapturer.getSources({
|
||||
types:['window', 'screen'],
|
||||
thumbnailSize: {
|
||||
width: imageWidth,
|
||||
height: imageHeight
|
||||
},
|
||||
fetchWindowIcons: true
|
||||
}, (error, sources) => {
|
||||
if (error) {
|
||||
console.log("Error getting sources", error);
|
||||
}
|
||||
} else {
|
||||
electron.desktopCapturer.getSources({
|
||||
types:['window', 'screen'],
|
||||
thumbnailSize: {
|
||||
width: imageWidth,
|
||||
height: imageHeight
|
||||
},
|
||||
fetchWindowIcons: true
|
||||
}, (error, sources) => {
|
||||
if (error) {
|
||||
console.log("Error getting sources", error);
|
||||
}
|
||||
|
||||
for (let source of sources) {
|
||||
// console.log(JSON.stringify(sources,null,4));
|
||||
sourceMap[source.id] = source;
|
||||
//*if (source.id.indexOf("screen") > -1) {
|
||||
// console.log("Adding:", source.id)
|
||||
addSource(source, "selects");
|
||||
//}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for (let source of sources) {
|
||||
sourceMap[source.id] = source;
|
||||
addSource(source, "selects");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -174,7 +157,6 @@ function togglePage(){
|
|||
showSources();
|
||||
document.getElementById('screenshare').style.visibility = "block";
|
||||
desktopSharing = true;
|
||||
console.log("Desktop sharing started.. desktop_id:" + desktop_id);
|
||||
navigator.webkitGetUserMedia({
|
||||
audio: false,
|
||||
video: {
|
||||
|
@ -193,9 +175,6 @@ function togglePage(){
|
|||
// Tokbox
|
||||
|
||||
function initializeTokboxSession() {
|
||||
console.log("\n\n\n\n #$######\n TRYING TO START SESSION")
|
||||
console.log("projectAPIKey: " + projectAPIKey)
|
||||
console.log("sessionId: " + sessionID)
|
||||
session = OT.initSession(projectAPIKey, sessionID);
|
||||
session.on('sessionDisconnected', (event) => {
|
||||
console.log('You were disconnected from the session.', event.reason);
|
||||
|
@ -213,8 +192,6 @@ function togglePage(){
|
|||
var publisher;
|
||||
function startTokboxPublisher(stream){
|
||||
publisher = document.createElement("div");
|
||||
console.log("publisher pushed")
|
||||
|
||||
var publisherOptions = {
|
||||
videoSource: stream.getVideoTracks()[0],
|
||||
audioSource: null,
|
||||
|
@ -240,7 +217,6 @@ function togglePage(){
|
|||
|
||||
|
||||
function stopTokBoxPublisher(){
|
||||
console.log("TOK BOX STOPPED!")
|
||||
publisher.destroy();
|
||||
}
|
||||
|
||||
|
@ -253,11 +229,8 @@ function togglePage(){
|
|||
let session;
|
||||
|
||||
ipcRenderer.on('connectionInfo', function(event, message){
|
||||
console.log("event:" + event);
|
||||
console.log("MESSAGE FROM MAIN:" + message);
|
||||
const connectionInfo = JSON.parse(message);
|
||||
projectAPIKey = connectionInfo.projectAPIKey;
|
||||
console.log()
|
||||
sessionID = connectionInfo.sessionID;
|
||||
token = connectionInfo.token;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
const {app, BrowserWindow, ipcMain} = require('electron');
|
||||
const gotTheLock = app.requestSingleInstanceLock()
|
||||
const argv = require('yargs').argv;
|
||||
|
||||
// ./screenshare.exe --userName=miladN ...
|
||||
const connectionInfo = {
|
||||
token: argv.token || "token",
|
||||
|
@ -10,6 +11,8 @@ const connectionInfo = {
|
|||
sessionID: argv.sessionID || "sessionID"
|
||||
}
|
||||
|
||||
|
||||
// Mac and Pc need slightly different width and height sizes.
|
||||
const osType = require('os').type();
|
||||
let width;
|
||||
let height;
|
||||
|
@ -21,6 +24,7 @@ if (osType == "Darwin" || osType == "Linux") {
|
|||
height = 740;
|
||||
}
|
||||
|
||||
|
||||
if (!gotTheLock) {
|
||||
console.log("Another instance of the screenshare is already running - this instance will quit.");
|
||||
app.exit(0);
|
||||
|
@ -30,7 +34,6 @@ if (!gotTheLock) {
|
|||
let window;
|
||||
const zoomFactor = 1.0;
|
||||
function createWindow(){
|
||||
console.log("Creating window")
|
||||
window = new BrowserWindow({
|
||||
backgroundColor: "#000000",
|
||||
width: width,
|
||||
|
@ -47,9 +50,7 @@ function createWindow(){
|
|||
window.loadURL('file://' + __dirname + '/index.html');
|
||||
window.setMenu(null);
|
||||
|
||||
window.webContents.on("did-finish-load", function(){
|
||||
console.log("connectionInfo:", connectionInfo)
|
||||
console.log("in did finish loading");
|
||||
window.webContents.on("did-finish-load", () => {
|
||||
window.webContents.send('connectionInfo', JSON.stringify(connectionInfo));
|
||||
});
|
||||
|
||||
|
@ -57,10 +58,7 @@ function createWindow(){
|
|||
|
||||
// This method will be called when Electron has finished
|
||||
// initialization and is ready to create browser windows.
|
||||
console.log("setting up on ready");
|
||||
app.on('ready', function() {
|
||||
console.log("app ready");
|
||||
createWindow();
|
||||
console.log("sending info");
|
||||
window.webContents.send('connectionInfo', JSON.stringify(connectionInfo))
|
||||
});
|
||||
|
|
|
@ -10,7 +10,6 @@ body {
|
|||
}
|
||||
|
||||
#confirmation_screen {
|
||||
/* background-color: orange; */
|
||||
width: 100%;
|
||||
display: flex;
|
||||
text-align: center;
|
||||
|
@ -219,35 +218,4 @@ img {
|
|||
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
|
||||
background-color: #848484;
|
||||
width: 9px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
button {
|
||||
display: inline-block;
|
||||
background: -webkit-linear-gradient(#F9F9F9 40%, #E3E3E3 70%);
|
||||
background: linear-gradient(#F9F9F9 40%, #E3E3E3 70%);
|
||||
border: 1px solid #999;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
padding: 5px 8px;
|
||||
outline: none;
|
||||
white-space: nowrap;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
text-shadow: 1px 1px #fff;
|
||||
font-weight: 700;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
button:hover,
|
||||
button.active {
|
||||
border-color: black;
|
||||
}
|
||||
button:active,
|
||||
button.active {
|
||||
background: -webkit-linear-gradient(#E3E3E3 40%, #F9F9F9 70%);
|
||||
background: linear-gradient(#E3E3E3 40%, #F9F9F9 70%);
|
||||
} */
|
||||
}
|
Loading…
Reference in a new issue