This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<link rel="stylesheet" href="style.css"></link> | |
<script type="text/javascript" src="script.js"></script> | |
<title>Week 1 : Self-Portrait</title> | |
</head> | |
<body> | |
<button id="yesButton" onMouseDown='approved()'>4 rEaL?</button> | |
<h1 id="header">This is Rachel</h1> | |
<div class="container"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener('DOMContentLoaded', (event) => { | |
const playingVideo = (currentVideo) => { | |
let video = document.getElementById(currentVideo); | |
video.muted = true; | |
let isPlaying = video.currentTime > 0 && !video.paused && !video.ended | |
&& video.readyState > 2 && video.muted; | |
if (!isPlaying) { | |
video.play(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<link rel="stylesheet" href="style.css"></link> | |
<script type="text/javascript" src="/socket.io/socket.io.js"></script> | |
<script type="text/javascript" src="script.js"></script> | |
</head> | |
<body onload="initCanvas();"> | |
<canvas width="500" height="500" id="mycanvas" /> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let socket = io.connect('http://165.22.177.152:8080/'); | |
socket.on('connect', function() { | |
console.log("Connected"); | |
}); | |
// Receive from any event | |
socket.on('othermouse', function (data) { | |
console.log(data.x + " " + data.y); | |
odraw(data.x,data.y); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// HTTP Portion | |
var http = require('http'); | |
var fs = require('fs'); // Using the filesystem module | |
var httpServer = http.createServer(requestHandler); | |
var url = require('url'); | |
httpServer.listen(8080); | |
function requestHandler(req, res) { | |
var parsedUrl = url.parse(req.url); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html { | |
background-color: #f7f5f5; | |
} | |
#mycanvas { | |
margin: 4em 20em; | |
box-shadow: 10px 10px 5px #ebc0c2; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<link rel="stylesheet" href="style.css"></link> | |
<script src="/socket.io/socket.io.js"></script> | |
<script type="text/javascript" src="script.js"></script> | |
</head> | |
<body> | |
<div class="container"> | |
<video id="thevideo" height="480" width="720"></video> | |
<canvas id="thecanvas"></canvas> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var https = require('https'); | |
var fs = require('fs'); // Using the filesystem module | |
var url = require('url'); | |
var options = { | |
key: fs.readFileSync('my-key.pem'), | |
cert: fs.readFileSync('my-cert.pem') | |
}; | |
function handleIt(req, res) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.container { | |
display: grid; | |
grid-template-columns: repeat(3, 1fr); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener('load', function() { | |
// The video element on the page to display the webcam | |
var video = document.getElementById('thevideo'); | |
// Constraints - what do we want? | |
let constraints = { audio: false, video: true }; | |
// Prompt the user for permission, get the stream | |
navigator.mediaDevices.getUserMedia(constraints).then(function(stream) { | |
// Attach to our video object |
OlderNewer