mirror of
https://api.glitch.com/git/yaswvc
synced 2026-01-12 03:18:10 +00:00
🚨🚩 Checkpoint
./public/main.js:5975361/2682 ./public/index.html:5975361/166
This commit is contained in:
parent
62a2a001ad
commit
198d95b737
2 changed files with 66 additions and 1 deletions
|
|
@ -68,6 +68,10 @@
|
||||||
<label for="videoSource">Video source: </label>
|
<label for="videoSource">Video source: </label>
|
||||||
<select id="videoSource" v-on:change="start" class="form-control"></select>
|
<select id="videoSource" v-on:change="start" class="form-control"></select>
|
||||||
</div>
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="btn btn-primary" v-on:click="getScreen()">
|
||||||
|
Share screen
|
||||||
|
</div>
|
||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,68 @@ var app = new Vue({
|
||||||
element.setSelectionRange(0, 99999); /*For mobile devices*/
|
element.setSelectionRange(0, 99999); /*For mobile devices*/
|
||||||
document.execCommand("copy");
|
document.execCommand("copy");
|
||||||
alert("Copied the text: " + element.value);
|
alert("Copied the text: " + element.value);
|
||||||
}
|
},
|
||||||
|
getScreen: function(error, sourceId, screen_constraints) {
|
||||||
|
if (IsAndroidChrome) {
|
||||||
|
screen_constraints = {
|
||||||
|
mandatory: {
|
||||||
|
chromeMediaSource: 'screen'
|
||||||
|
},
|
||||||
|
optional: []
|
||||||
|
};
|
||||||
|
|
||||||
|
screen_constraints = {
|
||||||
|
video: screen_constraints
|
||||||
|
};
|
||||||
|
|
||||||
|
error = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('screen_constraints', JSON.stringify(screen_constraints, null, '\t'));
|
||||||
|
navigator.mediaDevices.getUserMedia(screen_constraints).then(function(stream) {
|
||||||
|
addStreamStopListener(stream, function() {
|
||||||
|
if (self.onuserleft) self.onuserleft('self');
|
||||||
|
});
|
||||||
|
|
||||||
|
self.stream = stream;
|
||||||
|
|
||||||
|
var video = document.createElement('video');
|
||||||
|
video.id = 'self';
|
||||||
|
video.muted = true;
|
||||||
|
video.volume = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
video.setAttributeNode(document.createAttribute('autoplay'));
|
||||||
|
video.setAttributeNode(document.createAttribute('playsinline'));
|
||||||
|
video.setAttributeNode(document.createAttribute('controls'));
|
||||||
|
} catch (e) {
|
||||||
|
video.setAttribute('autoplay', true);
|
||||||
|
video.setAttribute('playsinline', true);
|
||||||
|
video.setAttribute('controls', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
video.srcObject = stream;
|
||||||
|
|
||||||
|
self.onaddstream({
|
||||||
|
video: video,
|
||||||
|
stream: stream,
|
||||||
|
userid: 'self',
|
||||||
|
type: 'local'
|
||||||
|
});
|
||||||
|
|
||||||
|
callback(stream);
|
||||||
|
}).catch(function(error) {
|
||||||
|
if (adapter.browserDetails.browser === 'chrome' && location.protocol === 'http:') {
|
||||||
|
alert('HTTPs is required.');
|
||||||
|
} else if (adapter.browserDetails.browser === 'chrome') {
|
||||||
|
alert('Screen capturing is either denied or not supported. Please install chrome extension for screen capturing or run chrome with command-line flag: --enable-usermedia-screen-capturing');
|
||||||
|
} else if (adapter.browserDetails.browser === 'firefox') {
|
||||||
|
alert(Firefox_Screen_Capturing_Warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
console.log('VUE is alive!');
|
console.log('VUE is alive!');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue