mirror of
https://api.glitch.com/git/yaswvc
synced 2026-01-12 05:08:11 +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);
|
let call = this.peer.call(peerId, this.stream);
|
||||||
console.log('Started call', call);
|
console.log('Started call', call);
|
||||||
call.on('stream', (stream) => this.renderVideo(stream, '#video-'+call.connectionId));
|
this.handleCall(call);
|
||||||
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);
|
|
||||||
},
|
},
|
||||||
hangUp: function() {
|
hangUp: function() {
|
||||||
this.calls.forEach(c => {
|
this.calls.forEach(c => {
|
||||||
|
|
@ -122,17 +117,24 @@ var app = new Vue({
|
||||||
this.peer.on('call', (call) => {
|
this.peer.on('call', (call) => {
|
||||||
console.log('INCOMING CALL', call);
|
console.log('INCOMING CALL', call);
|
||||||
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.handleCall(call);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleCall: function handleCall(call) {
|
||||||
call.on('stream', (stream) => this.renderVideo(stream, '#video-'+call.connectionId));
|
call.on('stream', (stream) => this.renderVideo(stream, '#video-'+call.connectionId));
|
||||||
call.on('close', () => {
|
call.on('close', () => {
|
||||||
console.log(`[INC] Call with ${call.peer} was closed.`);
|
console.log(`Call with ${call.peer} was closed.`);
|
||||||
this.calls = this.calls.filter(c => c.connectionId === call.connectionId);
|
this.calls = this.calls.filter(c => c.connectionId === call.connectionId);
|
||||||
});
|
});
|
||||||
this.calls.push(call);
|
this.calls.push(call);
|
||||||
// TOOD vereinheitlichen mit selbstgestartetem stream
|
console.log('Call', call);
|
||||||
call.peerConnection.onTrack();
|
call.peerConnection.onaddstream = (a,b) => {
|
||||||
});
|
console.log('stream add', a, b)
|
||||||
|
};
|
||||||
|
call.peerConnection.onremovestream =(a,b) => {
|
||||||
|
console.log('stream remove', a, b)
|
||||||
|
};
|
||||||
},
|
},
|
||||||
handleStream; function handleStream
|
|
||||||
gotDevices: function gotDevices(deviceInfos) {
|
gotDevices: function gotDevices(deviceInfos) {
|
||||||
const selectors = [document.querySelector('select#audioSource'), document.querySelector('select#audioOutput'), document.querySelector('select#videoSource')];
|
const selectors = [document.querySelector('select#audioSource'), document.querySelector('select#audioOutput'), document.querySelector('select#videoSource')];
|
||||||
// Handles being called several times to update labels. Preserve values.
|
// Handles being called several times to update labels. Preserve values.
|
||||||
|
|
@ -193,12 +195,13 @@ var app = new Vue({
|
||||||
console.log('gotStream', this.stream, stream);
|
console.log('gotStream', this.stream, stream);
|
||||||
if (this.calls && (this.calls.length > 0)) {
|
if (this.calls && (this.calls.length > 0)) {
|
||||||
this.calls.forEach(call => {
|
this.calls.forEach(call => {
|
||||||
console.log('local streams',call.peerConnection.getLocalStreams());
|
// console.log('local streams',call.peerConnection.getLocalStreams());
|
||||||
call.peerConnection.removeStream(this.stream);
|
// call.peerConnection.removeStream(this.stream);
|
||||||
console.log('local streams',call.peerConnection.getLocalStreams());
|
// console.log('local streams',call.peerConnection.getLocalStreams());
|
||||||
console.log('Adding stream', stream)
|
// console.log('Adding stream', stream)
|
||||||
call.peerConnection.addStream(stream);
|
// call.peerConnection.addStream(stream);
|
||||||
console.log('local streams',call.peerConnection.getLocalStreams());
|
// console.log('local streams',call.peerConnection.getLocalStreams());
|
||||||
|
console.log(call.peerConnection, stream.getTracks())
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.stream = stream; // make stream available to console
|
this.stream = stream; // make stream available to console
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue