rn: enable auto-pinning on screenshare on mobile

This commit is contained in:
Saúl Ibarra Corretgé 2019-07-25 12:10:31 +02:00 committed by Saúl Ibarra Corretgé
parent 35f934e197
commit 6943659dc9
1 changed files with 7 additions and 6 deletions

View File

@ -16,6 +16,10 @@ import { setParticipantsWithScreenShare } from './actions';
declare var APP: Object;
declare var interfaceConfig: Object;
// TODO: interfaceConfig should be in redux so we didn't have to do this.
const AUTO_PIN_LATEST_SCREEN_SHARE
= typeof interfaceConfig === 'object' ? interfaceConfig.AUTO_PIN_LATEST_SCREEN_SHARE : 'remote-only';
/**
* StateListenerRegistry provides a reliable way of detecting changes to
* preferred layout state and dispatching additional actions.
@ -31,8 +35,7 @@ StateListenerRegistry.register(
dispatch(
setMaxReceiverVideoQuality(VIDEO_QUALITY_LEVELS.HIGH));
if (typeof interfaceConfig === 'object'
&& interfaceConfig.AUTO_PIN_LATEST_SCREEN_SHARE) {
if (AUTO_PIN_LATEST_SCREEN_SHARE) {
_updateAutoPinnedParticipant(store);
}
}
@ -46,8 +49,7 @@ StateListenerRegistry.register(
StateListenerRegistry.register(
/* selector */ state => state['features/base/tracks'],
/* listener */ (tracks, store) => {
if (typeof interfaceConfig !== 'object'
|| !interfaceConfig.AUTO_PIN_LATEST_SCREEN_SHARE) {
if (!AUTO_PIN_LATEST_SCREEN_SHARE) {
return;
}
@ -56,8 +58,7 @@ StateListenerRegistry.register(
const knownSharingParticipantIds = tracks.reduce((acc, track) => {
if (track.mediaType === 'video' && track.videoType === 'desktop') {
const skipTrack
= interfaceConfig.AUTO_PIN_LATEST_SCREEN_SHARE === 'remote-only'
&& track.local;
= AUTO_PIN_LATEST_SCREEN_SHARE === 'remote-only' && track.local;
if (!skipTrack) {
acc.push(track.participantId);