diff options
Diffstat (limited to 'public')
| -rw-r--r-- | public/assets/js/app.js | 10 | ||||
| -rw-r--r-- | public/index.html | 2 |
2 files changed, 4 insertions, 8 deletions
diff --git a/public/assets/js/app.js b/public/assets/js/app.js index af37bc4..83cbefe 100644 --- a/public/assets/js/app.js +++ b/public/assets/js/app.js @@ -1,4 +1,4 @@ -const container = document.querySelector('#container') +const player = document.querySelector('#player') let socket = io.connect('/client') let got_frame = false @@ -21,17 +21,13 @@ socket.on('res', (data) => { socket.on('frame', (data) => { got_frame = true - // console.log('frame', data.fn) - // console.log(data.frame) - // return const blob = new Blob([data.frame], { type: 'image/jpg' }) const url = URL.createObjectURL(blob) - const img = new Image () img.onload = function() { URL.revokeObjectURL(url) - container.innerHTML = '' - container.appendChild(img) + player.innerHTML = '' + player.appendChild(img) } img.src = url }) diff --git a/public/index.html b/public/index.html index 04817a1..fef1a7f 100644 --- a/public/index.html +++ b/public/index.html @@ -10,7 +10,7 @@ <link rel="stylesheet" href="/assets/css/css.css"> </head> <body> - <div id="container"></div> + <div id="player"></div> </body> <script src="/socket.io/socket.io.js"></script> <script> |
