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 APP: Object;
declare var interfaceConfig: 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 * StateListenerRegistry provides a reliable way of detecting changes to
* preferred layout state and dispatching additional actions. * preferred layout state and dispatching additional actions.
@ -31,8 +35,7 @@ StateListenerRegistry.register(
dispatch( dispatch(
setMaxReceiverVideoQuality(VIDEO_QUALITY_LEVELS.HIGH)); setMaxReceiverVideoQuality(VIDEO_QUALITY_LEVELS.HIGH));
if (typeof interfaceConfig === 'object' if (AUTO_PIN_LATEST_SCREEN_SHARE) {
&& interfaceConfig.AUTO_PIN_LATEST_SCREEN_SHARE) {
_updateAutoPinnedParticipant(store); _updateAutoPinnedParticipant(store);
} }
} }
@ -46,8 +49,7 @@ StateListenerRegistry.register(
StateListenerRegistry.register( StateListenerRegistry.register(
/* selector */ state => state['features/base/tracks'], /* selector */ state => state['features/base/tracks'],
/* listener */ (tracks, store) => { /* listener */ (tracks, store) => {
if (typeof interfaceConfig !== 'object' if (!AUTO_PIN_LATEST_SCREEN_SHARE) {
|| !interfaceConfig.AUTO_PIN_LATEST_SCREEN_SHARE) {
return; return;
} }
@ -56,8 +58,7 @@ StateListenerRegistry.register(
const knownSharingParticipantIds = tracks.reduce((acc, track) => { const knownSharingParticipantIds = tracks.reduce((acc, track) => {
if (track.mediaType === 'video' && track.videoType === 'desktop') { if (track.mediaType === 'video' && track.videoType === 'desktop') {
const skipTrack const skipTrack
= interfaceConfig.AUTO_PIN_LATEST_SCREEN_SHARE === 'remote-only' = AUTO_PIN_LATEST_SCREEN_SHARE === 'remote-only' && track.local;
&& track.local;
if (!skipTrack) { if (!skipTrack) {
acc.push(track.participantId); acc.push(track.participantId);