diff --git a/web-service/server/public/js/index.js b/web-service/server/public/js/index.js index 21f75e6ddaa3e8ec51d6dd3680f17207784c00d1..ebed7053076c10908f0cc750528b9f3d07143805 100644 --- a/web-service/server/public/js/index.js +++ b/web-service/server/public/js/index.js @@ -26,7 +26,7 @@ const handleLogin = () => { window.location.href="/google"; } -let current_uri = ''; +let current_data = {}; /** @@ -61,7 +61,7 @@ const renderThumbnails = async () => { console.log(containerDiv) for(var i=0; i<thumbnails.length; i++){ const encodedURI = encodeURIComponent(thumbnails[i]) - current_uri = encodedURI + current_data.uri = encodedURI console.log("THUMBNAIL[i]", thumbnails[i]) try{ const someData = await fetch(`http://localhost:8080/stream/rgb?uri=${encodedURI}`) @@ -129,9 +129,12 @@ const createCard = (url, viewers, uri) => { const connectToStream = () => { let ws = new WebSocket('ws://localhost:8080/', 'get_stream'); + current_data.frames = 24; + console.log() ws.onopen = (e) => { - ws.send("get_stream", current_uri, 0, ) + ws.send("get_stream", current_data.uri, current_data.frames, 9, current_data.uri); } + //setTimeout 1s, ask for the amount of frames user has selected } //FOR LAPTOP diff --git a/web-service/server/src/index.js b/web-service/server/src/index.js index 476eb81418a2da1b164d040fddf7280a2fe6b713..5f655967ba6361ab8a4a18baabd65f2e276f2086 100644 --- a/web-service/server/src/index.js +++ b/web-service/server/src/index.js @@ -274,11 +274,8 @@ app.get('/stream/config', async(req, res) => { app.get('/stream', (req, res) => { + //If wanted, this could render new html file dedicated to the actual livestream function let uri = req.query.uri; - console.log(uri_data[uri]); - - - console.log(uri) res.end(); }) @@ -456,7 +453,7 @@ app.ws('/', (ws, req) => { }); // Request from frames from a source - p.bind("get_stream", (uri, N, rate, pid, dest) => { + p.bind("get_stream", (uri, N, rate, /*pid,*/ dest) => { let peer = uri_data[uri].peer; if (peer) { uri_data[uri].addClient(p, N, rate, dest);