aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2020-07-25 11:21:36 +0000
committerdakkar <dakkar@thenautilus.net>2020-07-25 11:56:19 +0000
commit1d37665c0cb77b86ff3d8556b4c67c28d674a9aa (patch)
treee4718932ecbf9d57d3d02283176d0ee33d999e2e
parentmove HTML+JS to separate file (diff)
downloadrtwatch-1d37665c0cb77b86ff3d8556b4c67c28d674a9aa.tar.gz
rtwatch-1d37665c0cb77b86ff3d8556b4c67c28d674a9aa.tar.bz2
rtwatch-1d37665c0cb77b86ff3d8556b4c67c28d674a9aa.zip
random js tweaks
-rw-r--r--index.html9
1 files changed, 5 insertions, 4 deletions
diff --git a/index.html b/index.html
index ab9b120..fc641bf 100644
--- a/index.html
+++ b/index.html
@@ -30,7 +30,7 @@
pc.ontrack = function (event) {
if (event.track.kind === 'audio') {
- return
+ //return
}
var el = document.getElementById('video1')
el.srcObject = event.streams[0]
@@ -41,12 +41,13 @@
conn.onopen = () => {
navigator.mediaDevices.getUserMedia({video: true, audio: true}).then(g => {
for (const track of g.getTracks()) {
- pc.addTrack(track);
+ pc.addTrack(track,g);
}
pc.createOffer({offerToReceiveVideo: true, offerToReceiveAudio: true}).then(offer => {
- pc.setLocalDescription(offer)
- conn.send(JSON.stringify({event: 'offer', data: JSON.stringify(offer)}))
+ return pc.setLocalDescription(offer);
+ }).then(() => {
+ conn.send(JSON.stringify({event: 'offer', data: JSON.stringify(pc.localDescription)}))
})
}).catch(e => { console.log(`failed getUserMedia: ${e}`) });
}