mirror of
https://api.glitch.com/git/yaswvc
synced 2026-01-12 03:18:10 +00:00
👌👰 Checkpoint
./public/main.js:5975361/800
This commit is contained in:
parent
a564d54fee
commit
2c99731d00
1 changed files with 11 additions and 6 deletions
|
|
@ -63,6 +63,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);
|
||||||
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(`[OUT] Call with ${peerId} was closed.`);
|
console.log(`[OUT] Call with ${peerId} was closed.`);
|
||||||
|
|
@ -187,13 +188,17 @@ var app = new Vue({
|
||||||
},
|
},
|
||||||
gotStream: function gotStream(stream) {
|
gotStream: function gotStream(stream) {
|
||||||
console.log('gotStream', this.stream, stream);
|
console.log('gotStream', this.stream, stream);
|
||||||
if (this.stream) {
|
if (this.calls && (this.calls.length > 0)) {
|
||||||
const oldVideo = this.stream.getTracks().find(track => track.kind === 'video');
|
this.calls.forEach(call => {
|
||||||
this.stream.removeTrack(oldVideo);
|
console.log('local streams',call.peerConnection.getLocalStreams());
|
||||||
// this.stream.addTrack(stream);
|
call.peerConnection.removeStream(this.stream);
|
||||||
} else {
|
console.log('local streams',call.peerConnection.getLocalStreams());
|
||||||
this.stream = stream; // make stream available to console
|
console.log('Adding stream', stream)
|
||||||
|
call.peerConenction.addStream(stream);
|
||||||
|
console.log('local streams',call.peerConnection.getLocalStreams());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
this.stream = stream; // make stream available to console
|
||||||
document.querySelector('#localVideo').srcObject = stream;
|
document.querySelector('#localVideo').srcObject = stream;
|
||||||
// Refresh button list in case labels have become available
|
// Refresh button list in case labels have become available
|
||||||
return navigator.mediaDevices.enumerateDevices();
|
return navigator.mediaDevices.enumerateDevices();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue