code: function getScreenConstraints(callback, audioPlusTab) {
          var firefoxScreenConstraints = {
              mozMediaSource: 'window',
              mediaSource: 'window'
          };
  
          if (DetectRTC.browser.name === 'Firefox') return callback(null, firefoxScreenConstraints);
  
          // support recapture again & again
          sourceId = null;
  
          isChromeExtensionAvailable(function(isAvailable) {
              // this statement defines getUserMedia constraints
              // that will be used to capture content of screen
              var screen_constraints = {
                  mandatory: {
                      chromeMediaSource: chromeMediaSource,
                      maxWidth: screen.width,
                      maxHeight: screen.height,
                      minWidth: screen.width,
                      minHeight: screen.height,
                      minAspectRatio: getAspectRatio(screen.width, screen.height),
                      maxAspectRatio: getAspectRatio(screen.width, screen.height),
                      minFrameRate: 64,
                      maxFrameRate: 128
                  },
                  optional: []
              };
  
              if (window.IsAndroidChrome) {
                  // now invoking native getUserMedia API
                  callback(null, screen_constraints);
                  return;
              }
  
              // this statement verifies chrome extension availability
              // if installed and available then it will invoke extension API
              // otherwise it will fallback to command-line based screen capturing API
              if (chromeMediaSource == 'desktop' && !sourceId) {
                  getSourceId(function() {
                      screen_constraints.mandatory.chromeMediaSourceId = sourceId;
                      callback(sourceId == 'PermissionDeniedError' ? sourceId : null, screen_constraints);
                      sourceId = null;
                  }, audioPlusTab);
                  return;
              }
  
              // this statement sets gets 'sourceId" and sets "chromeMediaSourceId"
              if (chromeMediaSource == 'desktop') {
                  screen_constraints.mandatory.chromeMediaSourceId = sourceId;
              }
  
              sourceId = null;
              chromeMediaSource = 'screen'; // maybe this line is redundant?
              screenCallback = null;
  
              // now invoking native getUserMedia API
              callback(null, screen_constraints);
          });
      }
docs: this function explains how to use above methods/objects