mirror of
https://github.com/ianramzy/decentralized-video-chat.git
synced 2024-11-23 18:49:21 +08:00
auto swap back to webcam after screen share
This commit is contained in:
parent
4c8c7fd37b
commit
124e49947c
@ -493,7 +493,7 @@ function swap() {
|
|||||||
navigator.mediaDevices
|
navigator.mediaDevices
|
||||||
.getDisplayMedia({
|
.getDisplayMedia({
|
||||||
video: true,
|
video: true,
|
||||||
audio: true,
|
audio: false,
|
||||||
})
|
})
|
||||||
.then(function (stream) {
|
.then(function (stream) {
|
||||||
mode = "screen";
|
mode = "screen";
|
||||||
@ -524,6 +524,9 @@ function swap() {
|
|||||||
|
|
||||||
function switchStreamHelper(stream) {
|
function switchStreamHelper(stream) {
|
||||||
let videoTrack = stream.getVideoTracks()[0];
|
let videoTrack = stream.getVideoTracks()[0];
|
||||||
|
videoTrack.onended = function () {
|
||||||
|
swap();
|
||||||
|
};
|
||||||
if (VideoChat.connected) {
|
if (VideoChat.connected) {
|
||||||
const sender = VideoChat.peerConnection.getSenders().find(function (s) {
|
const sender = VideoChat.peerConnection.getSenders().find(function (s) {
|
||||||
return s.track.kind === videoTrack.kind;
|
return s.track.kind === videoTrack.kind;
|
||||||
|
Loading…
Reference in New Issue
Block a user