mirror of
https://api.glitch.com/git/yaswvc
synced 2026-01-12 01:38:10 +00:00
😻⛰ Checkpoint
./public/main.js:5975361/3858
This commit is contained in:
parent
8b086b1fa2
commit
88dbb0458a
1 changed files with 24 additions and 21 deletions
|
|
@ -64,12 +64,7 @@ var app = new Vue({
|
|||
|
||||
let call = this.peer.call(peerId, this.stream);
|
||||
console.log('Started call', call);
|
||||
call.on('stream', (stream) => this.renderVideo(stream, '#video-'+call.connectionId));
|
||||
call.on('close', () => {
|
||||
console.log(`[OUT] Call with ${peerId} was closed.`);
|
||||
this.calls = this.calls.filter(c => c.connectionId === call.connectionId);
|
||||
});
|
||||
this.calls.push(call);
|
||||
this.handleCall(call);
|
||||
},
|
||||
hangUp: function() {
|
||||
this.calls.forEach(c => {
|
||||
|
|
@ -122,17 +117,24 @@ var app = new Vue({
|
|||
this.peer.on('call', (call) => {
|
||||
console.log('INCOMING CALL', call);
|
||||
call.answer(this.stream); // Answer the call with an A/V stream.
|
||||
call.on('stream', (stream) => this.renderVideo(stream, '#video-'+call.connectionId));
|
||||
call.on('close', () => {
|
||||
console.log(`[INC] Call with ${call.peer} was closed.`);
|
||||
this.calls = this.calls.filter(c => c.connectionId === call.connectionId);
|
||||
});
|
||||
this.calls.push(call);
|
||||
// TOOD vereinheitlichen mit selbstgestartetem stream
|
||||
call.peerConnection.onTrack();
|
||||
this.handleCall(call);
|
||||
});
|
||||
},
|
||||
handleStream; function handleStream
|
||||
handleCall: function handleCall(call) {
|
||||
call.on('stream', (stream) => this.renderVideo(stream, '#video-'+call.connectionId));
|
||||
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);
|
||||
console.log('Call', call);
|
||||
call.peerConnection.onaddstream = (a,b) => {
|
||||
console.log('stream add', a, b)
|
||||
};
|
||||
call.peerConnection.onremovestream =(a,b) => {
|
||||
console.log('stream remove', a, b)
|
||||
};
|
||||
},
|
||||
gotDevices: function gotDevices(deviceInfos) {
|
||||
const selectors = [document.querySelector('select#audioSource'), document.querySelector('select#audioOutput'), document.querySelector('select#videoSource')];
|
||||
// Handles being called several times to update labels. Preserve values.
|
||||
|
|
@ -193,12 +195,13 @@ var app = new Vue({
|
|||
console.log('gotStream', this.stream, stream);
|
||||
if (this.calls && (this.calls.length > 0)) {
|
||||
this.calls.forEach(call => {
|
||||
console.log('local streams',call.peerConnection.getLocalStreams());
|
||||
call.peerConnection.removeStream(this.stream);
|
||||
console.log('local streams',call.peerConnection.getLocalStreams());
|
||||
console.log('Adding stream', stream)
|
||||
call.peerConnection.addStream(stream);
|
||||
console.log('local streams',call.peerConnection.getLocalStreams());
|
||||
// console.log('local streams',call.peerConnection.getLocalStreams());
|
||||
// call.peerConnection.removeStream(this.stream);
|
||||
// console.log('local streams',call.peerConnection.getLocalStreams());
|
||||
// console.log('Adding stream', stream)
|
||||
// call.peerConnection.addStream(stream);
|
||||
// console.log('local streams',call.peerConnection.getLocalStreams());
|
||||
console.log(call.peerConnection, stream.getTracks())
|
||||
});
|
||||
}
|
||||
this.stream = stream; // make stream available to console
|
||||
|
|
|
|||
Loading…
Reference in a new issue