toDesktopMediaConstraints_(sourceId = undefined) {
    const constraints = /** @type {!MediaStreamConstraints}  */
        ({'audio': false, 'video': false});

    if (this.mirrorSettings.shouldCaptureVideo) {
      mr.Assertions.assert(sourceId);
      constraints['video'] = {
        'mandatory': {
          'chromeMediaSource': 'desktop',
          'chromeMediaSourceId': sourceId,
        }
      };
      this.setCommonVideoConstraints_(constraints['video']['mandatory']);

      if (mr.mirror.Config.isDesktopAudioCaptureAvailable &&
          this.mirrorSettings.shouldCaptureAudio) {
        // NOTE(mfoltz): Nothing in Chrome seems to consume the audio sourceId;
        // however, continuing to pass it in case something changes in the
        // future.
        constraints['audio'] = {
          'mandatory': {
            'chromeMediaSource': 'system',
            'chromeMediaSourceId': sourceId,
          }
        };
      }
    } else if (this.mirrorSettings.shouldCaptureAudio) {
      mr.Assertions.assert(!sourceId);
      mr.Assertions.assert(mr.mirror.Config.isDesktopAudioCaptureAvailable);
      constraints['audio'] = {
        'mandatory': {
          'chromeMediaSource': 'system',
        }
      };
    }

    return constraints;
  }
/**
   * @param {string=} sourceId The source id of the desktop media. Only required
   *      if capturing video.
   * @return {!MediaStreamConstraints} Media constraints for use with platform
   *     capture APIs.
   * @private
   */
@param {string=} sourceId The source id of the desktop media. Only required
if capturing video.
@return {!MediaStreamConstraints} Media constraints for use with platform
capture APIs.
@private
@param { string = } sourceId The source id of the desktop media . Only required if capturing video . @return { !MediaStreamConstraints } Media constraints for use with platform capture APIs . @private
toDesktopMediaConstraints_(sourceId = undefined) {
    const constraints = 
        ({'audio': false, 'video': false});
    if (this.mirrorSettings.shouldCaptureVideo) {
      mr.Assertions.assert(sourceId);
      constraints['video'] = {
        'mandatory': {
          'chromeMediaSource': 'desktop',
          'chromeMediaSourceId': sourceId,
        }
      };
      this.setCommonVideoConstraints_(constraints['video']['mandatory']);
      if (mr.mirror.Config.isDesktopAudioCaptureAvailable &&
          this.mirrorSettings.shouldCaptureAudio) {
        constraints['audio'] = {
          'mandatory': {
            'chromeMediaSource': 'system',
            'chromeMediaSourceId': sourceId,
          }
        };
      }
    } else if (this.mirrorSettings.shouldCaptureAudio) {
      mr.Assertions.assert(!sourceId);
      mr.Assertions.assert(mr.mirror.Config.isDesktopAudioCaptureAvailable);
      constraints['audio'] = {
        'mandatory': {
          'chromeMediaSource': 'system',
        }
      };
    }
    return constraints;
  }
toDesktopMediaConstraints_ ( sourceId = undefined ) { const constraints = ( { 'audio' : false , 'video' : false } ) ; if ( this . mirrorSettings . shouldCaptureVideo ) { mr . Assertions . assert ( sourceId ) ; constraints [ 'video' ] = { 'mandatory' : { 'chromeMediaSource' : 'desktop' , 'chromeMediaSourceId' : sourceId , } } ; this . setCommonVideoConstraints_ ( constraints [ 'video' ] [ 'mandatory' ] ) ; if ( mr . mirror . Config . isDesktopAudioCaptureAvailable && this . mirrorSettings . shouldCaptureAudio ) { constraints [ 'audio' ] = { 'mandatory' : { 'chromeMediaSource' : 'system' , 'chromeMediaSourceId' : sourceId , } } ; } } else if ( this . mirrorSettings . shouldCaptureAudio ) { mr . Assertions . assert ( ! sourceId ) ; mr . Assertions . assert ( mr . mirror . Config . isDesktopAudioCaptureAvailable ) ; constraints [ 'audio' ] = { 'mandatory' : { 'chromeMediaSource' : 'system' , } } ; } return constraints ; }
@param {string=} sourceId The source id of the desktop media.
@param { string = } sourceId The source id of the desktop media .
/** @type {!MediaStreamConstraints}  */ // NOTE(mfoltz): Nothing in Chrome seems to consume the audio sourceId; // however, continuing to pass it in case something changes in the // future.