mirror of
https://api.glitch.com/git/yaswvc
synced 2026-01-12 01:48:11 +00:00
🎋🐲 Checkpoint
./public/main.js:5975361/1262 ./views/index.ejs:5975361/235
This commit is contained in:
parent
ad8d5bbc75
commit
22fffe6960
2 changed files with 23 additions and 1 deletions
|
|
@ -186,11 +186,31 @@ var app = new Vue({
|
|||
this.attachSinkId(document.querySelector('#localVideo'), audioDestination);
|
||||
},
|
||||
gotStream: function gotStream(stream) {
|
||||
this.stream = stream; // make stream available to console
|
||||
console.log('gotStream', this.stream, stream);
|
||||
if (this.stream) {
|
||||
const oldVideo = this.stream.getTracks().find(track => track.kind === 'video');
|
||||
this.stream.removeTrack(oldVideo);
|
||||
this.stream.addTrack(stream);
|
||||
} else {
|
||||
this.stream = stream; // make stream available to console
|
||||
}
|
||||
document.querySelector('#localVideo').srcObject = stream;
|
||||
// Refresh button list in case labels have become available
|
||||
return navigator.mediaDevices.enumerateDevices();
|
||||
},
|
||||
shareScreen: async function shareScreen() {
|
||||
// if (!displayMediaStream) {
|
||||
const displayMediaStream = await navigator.mediaDevices.getDisplayMedia();
|
||||
// }
|
||||
// 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';
|
||||
},
|
||||
handleError: function handleError(error) {
|
||||
console.log('navigator.MediaDevices.getUserMedia error: ', error.message, error.name);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -72,6 +72,8 @@
|
|||
<label for="videoSource">Video source: </label>
|
||||
<select id="videoSource" v-on:change="start" class="form-control"></select>
|
||||
</div>
|
||||
<!-- share screen -->
|
||||
<span class="btn btn-primary" v-on:click="shareScreen()">Share screen</span>
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue