-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsultant.html
107 lines (95 loc) · 3.59 KB
/
consultant.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
105
106
107
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Consultant</title>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
}
h2,
.input-container,
.btn-container,
.video-container {
text-align: center;
}
.video-container {
margin-top: 2rem;
}
#video {
max-width: 100%;
object-fit: contain;
}
</style>
</head>
<body>
<h2>Консультант</h2>
<div class="input-container">
<input id="input-id" type="text" placeholder="Client id" />
</div>
<br />
<div class="btn-container">
<button id="btn-call">Вызов</button>
</div>
<div class="video-container">
<video id="video" controls muted autoplay></video>
</div>
<script src="https://unpkg.com/[email protected]/dist/peerjs.min.js"></script>
<script>
(function () {
var inputId = document.getElementById('input-id');
var btnCall = document.getElementById('btn-call');
var callOptions = {
'iceServers': [
{ url: 'stun:stun01.sipphone.com' },
{ url: 'stun:stun.ekiga.net' },
{ url: 'stun:stun.fwdnet.net' },
{ url: 'stun:stun.ideasip.com' },
{ url: 'stun:stun.iptel.org' },
{ url: 'stun:stun.rixtelecom.se' },
{ url: 'stun:stun.schlund.de' },
{ url: 'stun:stun.l.google.com:19302' },
{ url: 'stun:stun1.l.google.com:19302' },
{ url: 'stun:stun2.l.google.com:19302' },
{ url: 'stun:stun3.l.google.com:19302' },
{ url: 'stun:stun4.l.google.com:19302' },
{ url: 'stun:stunserver.org' },
{ url: 'stun:stun.softjoys.com' },
{ url: 'stun:stun.voiparound.com' },
{ url: 'stun:stun.voipbuster.com' },
{ url: 'stun:stun.voipstunt.com' },
{ url: 'stun:stun.voxgratia.org' },
{ url: 'stun:stun.xten.com' },
{
url: 'turn:numb.viagenie.ca',
credential: 'muazkh',
username: '[email protected]'
},
{
url: 'turn:192.158.29.39:3478?transport=udp',
credential: 'JZEOEt2V3Qb0y27GRntt2u2PAYA=',
username: '28224511:1379330808'
},
{
url: 'turn:192.158.29.39:3478?transport=tcp',
credential: 'JZEOEt2V3Qb0y27GRntt2u2PAYA=',
username: '28224511:1379330808'
}
]
};
var peer = new Peer({ config: callOptions });
btnCall.addEventListener('click', function () {
navigator.mediaDevices.getUserMedia({ audio: true, video: true })
.then(function (mediaStream) {
var video = document.getElementById('video');
peercall = peer.call(inputId.value, mediaStream);
video.srcObject = mediaStream;
}).catch(function (err) {
console.log(err.name + ": " + err.message);
});
});
})();
</script>
</body>
</html>