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

🎒👻 Checkpoint

./views/index.ejs:5975361/57
./public/main.js:5975361/864
This commit is contained in:
Glitch (peerjs-video) 2020-09-12 23:10:13 +00:00
parent ea2e8dc595
commit 9a33ce12fc
2 changed files with 12 additions and 15 deletions

View file

@ -25,6 +25,9 @@ var app = new Vue({
videoCalls:[],
connections: [],
chatInput: '',
displayMediaStrean: false,
outgoingScreenShareCalls: [],
incomingScreenShareCalls: [],
},
methods: {
logMessage: function(message) {
@ -299,10 +302,9 @@ var app = new Vue({
},
getAudioStream: async function getAudioStream() {
const audioSource = document.querySelector('select#audioSource').value;
// const videoSource = document.querySelector('select#videoSource').value;
const constraints = {
audio: {deviceId: audioSource ? {exact: audioSource} : undefined},
// video: {deviceId: undefined}
video: null
};
const audioStream = await navigator.mediaDevices.getUserMedia(constraints).catch(this.handleError);
console.log('GOT AUDIO STREAM', audioStream);
@ -320,18 +322,13 @@ var app = new Vue({
return videoStream;
},
shareScreen: async function shareScreen() {
// if (!displayMediaStream) {
if (!this.displayMediaStream) {
const displayMediaStream = await navigator.mediaDevices.getDisplayMedia();
console.log('screenShare', displayMediaStream)
// }
// senders.find(sender => sender.track.kind === 'video').replaceTrack(displayMediaStream.getTracks()[0]);
//show what you are showing in your "self-view" video.
// document.getElementById('self-view').srcObject = displayMediaStream;
//hide the share button and display the "stop-sharing" one
// document.getElementById('share-button').style.display = 'none';
// document.getElementById('stop-share-button').style.display = 'inline';
} else {
// TODO stop stream
this.displayMediaStream = false;
}
},
handleError: function handleError(error) {
console.log('navigator.MediaDevices.getUserMedia error: ', error.message, error.name);

View file

@ -51,7 +51,7 @@
<div id="app" class="container pt-3">
<div class="row">
<!-- self -->
<div class="col-6">
<div class="col-12 col-sm-6 order-2 order-sm-1">
<div class="card text-dark">
<video id="localVideo" class="card-img-top" autoplay muted></video>
<div class="card-body">
@ -79,7 +79,7 @@
</div>
</div>
<!-- control -->
<div class="col-12 order-1 col-sm-6 order-sm-2">
<div class="col-12 order-1 col-sm-6 order-sm-2 mb-3">
<div class="card text-dark">
<div class="card-body">
<h5 class="card-title">Control</h5>
@ -121,7 +121,7 @@
<!-- peers -->
<div class="row mt-3">
<!-- audio calls -->
<div class="col-6">
<div class="col-12 col-sm-6 mb-3">
<div class="card text-dark">
<div class="card-body">
<h5 class="card-title">Audio connections</h5>