multiple video stream WiP

This commit is contained in:
Pawel Domas 2021-08-12 13:05:05 -05:00
parent 29eb9452c0
commit bfd37bb087
2 changed files with 33 additions and 1 deletions

View File

@ -105,6 +105,7 @@ import {
updateSettings
} from './react/features/base/settings';
import {
addLocalTrack,
createLocalPresenterTrack,
createLocalTracksF,
destroyLocalTracks,
@ -1911,7 +1912,24 @@ export default {
if (desktopVideoStream) {
logger.debug(`_switchToScreenSharing is using ${desktopVideoStream} for useVideoStream`);
await this.useVideoStream(desktopVideoStream);
await new Promise((resolve, reject) => {
_replaceLocalVideoTrackQueue.enqueue(onFinish => {
APP.store.dispatch(
addLocalTrack(desktopVideoStream))
.then(() => {
this._setSharingScreen(desktopVideoStream);
// TODO FIXME
// this.setVideoMuteStatus();
})
.then(resolve)
.catch(error => {
logger.error(`_switchToScreenSharing failed: ${error}`);
reject(error);
})
.then(onFinish);
});
});
}
if (this._desktopAudioStream) {

View File

@ -5,6 +5,7 @@ import {
sendAnalytics
} from '../../analytics';
import { NOTIFICATION_TIMEOUT_TYPE, showErrorNotification, showNotification } from '../../notifications';
import { getCurrentConference } from '../conference';
import { JitsiTrackErrors, JitsiTrackEvents, createLocalTrack } from '../lib-jitsi-meet';
import {
CAMERA_FACING_MODE,
@ -312,6 +313,19 @@ export function replaceLocalTrack(oldTrack, newTrack, conference) {
};
}
// eslint-disable-next-line require-jsdoc
export function addLocalTrack(newTrack) {
return async (dispatch, getState) => {
const conference = getCurrentConference(getState());
if (conference) {
await conference.addTrack(newTrack);
}
return dispatch(_addTracks([ newTrack ]));
};
}
/**
* Replaces a stored track with another.
*