Skip to content

Commit

Permalink
feat(ShareControl): disable share screen on mobile browsers and Inter…
Browse files Browse the repository at this point in the history
…net Explorer browser
  • Loading branch information
karinasigartau0798 authored and cipak committed Mar 23, 2022
1 parent 04de0c1 commit 454db60
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ global.MediaStream = jest.fn(function MockMediaStream(tracksOrStream = []) {
global.navigator = {
mediaDevices: {
enumerateDevices: () => Promise.resolve(mockDevices),
getDisplayMedia: () => Promise.resolve(new MediaStream()),
},
userAgent: ''
};
Expand Down
14 changes: 12 additions & 2 deletions src/MeetingsSDKAdapter/controls/ShareControl.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Observable} from 'rxjs';
import {Observable, of} from 'rxjs';
import {distinctUntilChanged, map, tap} from 'rxjs/operators';
import {MeetingControlState} from '@webex/component-adapter-interfaces';
import logger from '../../logger';
Expand Down Expand Up @@ -47,8 +47,18 @@ export default class ShareControl extends MeetingControl {
text: 'Stop sharing',
tooltip: 'Stop sharing content',
};
const notSupported = {
ID: this.ID,
type: 'TOGGLE',
state: MeetingControlState.DISABLED,
icon: 'share-screen-presence-stroke',
text: 'Start sharing',
tooltip: 'Share screen not supported',
};

const browserSupport = navigator.mediaDevices && navigator.mediaDevices.getDisplayMedia;

return this.adapter.getMeeting(meetingID).pipe(
return !browserSupport ? of(notSupported) : this.adapter.getMeeting(meetingID).pipe(
map(({localShare: {stream}}) => (stream ? active : inactive)),
distinctUntilChanged(),
tap((display) => logger.debug('MEETING', meetingID, 'ShareControl::display()', ['emitting', display])),
Expand Down

0 comments on commit 454db60

Please sign in to comment.