1
0
Fork 0
mirror of https://api.glitch.com/git/yaswvc synced 2026-01-12 05:08:11 +00:00

💏 Checkpoint

./public/index.html:5975361/121
./public/main.js:5975361/79
This commit is contained in:
Glitch (peerjs-video) 2020-09-08 21:22:55 +00:00
parent be3085973a
commit 3e6c8cb779
2 changed files with 6 additions and 5 deletions

View file

@ -100,11 +100,11 @@
<!-- peers --> <!-- peers -->
<div class="row mt-3"> <div class="row mt-3">
<!-- peer --> <!-- peer -->
<div class="col-6"> <div v-for="call in calls" class="col-6">
<div class="card text-dark"> <div class="card text-dark">
<video id="remoteVideo" class="card-img-top" autoplay></video> <video v-bind:srcObject="call.remoteStream" class="card-img-top" autoplay></video>
<div class="card-body"> <div class="card-body">
<h5 class="card-title">Remote</h5> <h5 class="card-title">{{call.peer}}</h5>
</div> </div>
</div> </div>
</div> </div>

View file

@ -17,7 +17,8 @@ var app = new Vue({
document.querySelector('.messages').appendChild(newMessage); document.querySelector('.messages').appendChild(newMessage);
}, },
renderVideo:function(stream, selector = '#remoteVideo') { renderVideo:function(stream, selector = '#remoteVideo') {
document.querySelector(selector).srcObject = stream; console.log('renderVideo', stream);
// document.querySelector(selector).srcObject = stream;
}, },
connectToPeer: function(peerId) { connectToPeer: function(peerId) {
this.logMessage(`Connecting to ${peerId}...`); this.logMessage(`Connecting to ${peerId}...`);
@ -34,7 +35,7 @@ var app = new Vue({
call.on('stream', this.renderVideo); call.on('stream', this.renderVideo);
call.on('close', () => { call.on('close', () => {
console.log(`Call with ${peerId} was closed.`); console.log(`Call with ${peerId} 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);
}, },