-
Notifications
You must be signed in to change notification settings - Fork 7
/
record.html
104 lines (86 loc) · 3.11 KB
/
record.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<html>
<head>
<title>Screen Recorder</title>
<meta name="description" content="Records your Android Screen">
<meta name="viewport" content="width=device-width">
<meta name="twitter:creator" content="@Paul_Kinlan">
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Person",
"name": "Paul Kinlan",
"url": "https://paul.kinlan.me/",
"sameAs": [
"https://twitter.com/paul_kinlan",
"https://www.instagram.com/paul_kinlan/",
"https://www.linkedin.com/in/paulkinlan",
"https://plus.google.com/+paulkinlan",
"https://github.com/paulkinlan"
]
}
</script>
<link rel="stylesheet" href="./css/main.css">
<meta name="theme-color" content="#FF9800">
<link rel="manifest" href="./manifest.json">
<script src="scripts/peer.js"></script>
<script>
if(navigator.serviceWorker) {
navigator.serviceWorker.register('./sw.js')
.then(() => {
console.log('installed');
})
}
let peer;
onload = function() {
navigator.getUserMedia = navigator.getUserMedia ||
navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
var constraints = {
audio: false,
video: {'mandatory': {'chromeMediaSource':'screen'}}
};
function successCallback(stream) {
let peerId = location.hash.slice(1)
let peer = new Peer({
host: 'screen-record-peerjs.herokuapp.com',
secure: true,
port:443,
config: {'iceServers': [
{ url: 'stun:stun.devicefra.me' },
{ url: 'turn:turn.devicefra.me:443',
username: 'whatausername',
credential: 'whatapassword' }
]}
});
peer.on('open', function(id) {
console.log('My peer ID is: ' + id);
});
peer.on('disconnected', function() {
console.log('disconnected');
});
peer.on('error', function(err) {
console.log('Err: ' + err);
});
var call = peer.call(peerId, stream);
call.on('stream', function(remoteStream) {
// Show stream in some video/canvas element.
});
}
function errorCallback(error) {
console.log('navigator.getUserMedia error: ', error);
}
navigator.getUserMedia(constraints, successCallback, errorCallback);
};
</script>
</head>
<body>
<p id="recordError">Enable chrome://flags#enable-usermedia-screen-capturing</p>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-88398808-2', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>