Skip to content

Commit

Permalink
Lint fix and change deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
danieltre23 committed Aug 19, 2020
1 parent 3a1bacf commit 774fd40
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 76 deletions.
2 changes: 0 additions & 2 deletions app.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
runtime: nodejs10

service: api

resources:
cpu: 1
memory_gb: 0.5
Expand Down
32 changes: 16 additions & 16 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,42 @@ server.listen(port, () => {

app.use(express.static(path.join(__dirname, './ubg/build')));

app.get("*", (req, res) => {
res.sendFile(path.join(__dirname, "./ubg/build", "index.html"));
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname, './ubg/build', 'index.html'));
});

io.on('connection', function (socket) {
console.log('connected to socket');
io.to(socket.id).emit("youJoined");
io.to(socket.id).emit('youJoined');

socket.on("joinSocketRoom", (roomId, uid) => {
io.to(socket.id).emit("youJoinedRoom");
socket.on('joinSocketRoom', (roomId, uid) => {
io.to(socket.id).emit('youJoinedRoom');
socket.join(roomId);
console.log("joined room " + roomId);
console.log('joined room ' + roomId);
socket.to(roomId).emit('newUser', socket.id, uid);
});

socket.on("sendOffer", (offer, socketId, uid) => {
socket.on('sendOffer', (offer, socketId, uid) => {
console.log('sendOffer');
io.to(socketId).emit("receiveOffer", offer, socket.id, uid);
io.to(socketId).emit('receiveOffer', offer, socket.id, uid);
})

socket.on("sendAnswer", (answer, socketId) => {
socket.on('sendAnswer', (answer, socketId) => {
console.log('sendAnswer');
io.to(socketId).emit("receiveAnswer", answer, socket.id);
io.to(socketId).emit('receiveAnswer', answer, socket.id);
})

socket.on("newICE", (candidate, socketId) => {
socket.on('newICE', (candidate, socketId) => {
console.log('newIce');
io.to(socketId).emit("receiveICE", candidate, socket.id);
io.to(socketId).emit('receiveICE', candidate, socket.id);
});

socket.on("leaveSocketRoom", (roomId) => {
socket.on('leaveSocketRoom', (roomId) => {
console.log('leave room');
io.to(roomId).emit("userLeft", socket.id);
io.to(roomId).emit('userLeft', socket.id);
})

socket.on("disconnect", () => {
console.log("Client disconnected");
socket.on('disconnect', () => {
console.log('Client disconnected');
});
});
49 changes: 28 additions & 21 deletions ubg/src/common/UserVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ const useStyles = makeStyles((theme) => ({
margin: '15px',
},
videoMirror: {
transform: 'rotateY(180deg)',
'transform': 'rotateY(180deg)',
'-webkit-transform': 'rotateY(180deg)',
'-moz-transform': 'rotateY(180deg)',
width: '100%',
'width': '100%',
},
video: {
width: '100%',
Expand All @@ -29,8 +29,8 @@ const useStyles = makeStyles((theme) => ({
*/
export default function UserVideo({user, video, local}) {
const classes = useStyles();
const setVideoRef = videoElement => {
if(videoElement){
const setVideoRef = (videoElement) => {
if (videoElement) {
videoElement.srcObject = video;
}
};
Expand All @@ -39,39 +39,39 @@ export default function UserVideo({user, video, local}) {
<div className={classes.videoDiv}>
{
video ?
<video
className={local ? classes.videoMirror : classes.video}
autoPlay={true}
ref={setVideoRef}
muted={local}
<video
className={local ? classes.videoMirror : classes.video}
autoPlay={true}
ref={setVideoRef}
muted={local}
/> :
null
}
<div>
{local ?
<IconButton
color="primary"
size="small"
onClick={local.toggleAudio}
>
{local.localAudio ?
color="primary"
size="small"
onClick={local.toggleAudio}
>
{local.localAudio ?
<MicIcon fontSize="inherit" /> :
<MicOffIcon fontSize="inherit" />
}
}
</IconButton> :
null
}
{user}
{local ?
<IconButton
color="primary"
size="small"
onClick={local.toggleVideo}
>
{local.localVideo ?
color="primary"
size="small"
onClick={local.toggleVideo}
>
{local.localVideo ?
<VideoCamIcon fontSize="inherit" /> :
<VideoCamOffIcon fontSize="inherit" />
}
}
</IconButton> :
null
}
Expand All @@ -82,4 +82,11 @@ export default function UserVideo({user, video, local}) {

UserVideo.propTypes = {
user: PropTypes.string,
video: PropTypes.object,
local: PropTypes.shape({
toggleAudio: PropTypes.func,
localAudio: PropTypes.bool,
toggleVideo: PropTypes.func,
localVideo: PropTypes.bool,
}),
};
Loading

0 comments on commit 774fd40

Please sign in to comment.