mirror of
https://api.glitch.com/git/yaswvc
synced 2026-01-12 03:18:10 +00:00
🍬🎓 Checkpoint
./public/main.js:5975361/727 ./public/index.html:5975361/22
This commit is contained in:
parent
1d1ab6096e
commit
be3085973a
2 changed files with 17 additions and 3 deletions
|
|
@ -89,7 +89,7 @@
|
||||||
<button class="btn btn-sm btn-success" v-on:click="connectToPeer($refs.connectPeer.value);$refs.connectPeer.value = '';">
|
<button class="btn btn-sm btn-success" v-on:click="connectToPeer($refs.connectPeer.value);$refs.connectPeer.value = '';">
|
||||||
Connect
|
Connect
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-sm btn-danger" v-on:click="disconnectCall()">
|
<button class="btn btn-sm btn-danger" v-on:click="hangUp()">
|
||||||
Disconnect
|
Disconnect
|
||||||
</button>
|
</button>
|
||||||
<div class="messages"></div>
|
<div class="messages"></div>
|
||||||
|
|
|
||||||
|
|
@ -32,12 +32,21 @@ var app = new Vue({
|
||||||
|
|
||||||
let call = this.peer.call(peerId, this.stream);
|
let call = this.peer.call(peerId, this.stream);
|
||||||
call.on('stream', this.renderVideo);
|
call.on('stream', this.renderVideo);
|
||||||
|
call.on('close', () => {
|
||||||
|
console.log(`Call with ${peerId} was closed.`);
|
||||||
|
this.calls = this.calls.filter(c => c.connectionId === call.connectionId);
|
||||||
|
});
|
||||||
this.calls.push(call);
|
this.calls.push(call);
|
||||||
},
|
},
|
||||||
|
hangUp: function() {
|
||||||
|
this.calls.forEach(c => {
|
||||||
|
this.disconnectCall(c);
|
||||||
|
});
|
||||||
|
},
|
||||||
disconnectCall: function(call) {
|
disconnectCall: function(call) {
|
||||||
// if (!call) return;
|
if (!call) return;
|
||||||
console.log('CALLS', this.calls);
|
|
||||||
console.log('CALL', call);
|
console.log('CALL', call);
|
||||||
|
call.close();
|
||||||
},
|
},
|
||||||
listenForPeerEvents: function () {
|
listenForPeerEvents: function () {
|
||||||
this.peer.on('open', (id) => {
|
this.peer.on('open', (id) => {
|
||||||
|
|
@ -73,6 +82,11 @@ var app = new Vue({
|
||||||
call.answer(this.stream); // Answer the call with an A/V stream.
|
call.answer(this.stream); // Answer the call with an A/V stream.
|
||||||
// this.renderVideo(this.stream, '#localVideo');
|
// this.renderVideo(this.stream, '#localVideo');
|
||||||
call.on('stream', this.renderVideo);
|
call.on('stream', this.renderVideo);
|
||||||
|
call.on('close', () => {
|
||||||
|
console.log(`Call with ${call.peer} was closed.`);
|
||||||
|
this.calls = this.calls.filter(c => c.connectionId === call.connectionId);
|
||||||
|
});
|
||||||
|
this.calls.push(call);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
gotDevices: function gotDevices(deviceInfos) {
|
gotDevices: function gotDevices(deviceInfos) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue