{"record":{"id":"5c21c72d2968dd61","repo":"transloadit/uppy","slug":"screen-capture-is-not-supported","errorCode":null,"errorMessage":"Screen capture is not supported","messagePattern":"Screen capture is not supported","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@uppy/screen-capture/src/ScreenCapture.tsx","lineNumber":535,"sourceCode":"        ),\n      )\n    }\n\n    const name = `screencap-${Date.now()}.${fileExtension}`\n    const blob = new Blob(this.recordingChunks!, { type: mimeType })\n    const file = {\n      source: this.id,\n      name,\n      data: new Blob([blob], { type: mimeType }),\n      type: mimeType,\n    }\n\n    return Promise.resolve(file)\n  }\n\n  async captureScreenshot(): Promise<void> {\n    if (!this.mediaDevices?.getDisplayMedia) {\n      throw new Error('Screen capture is not supported')\n    }\n\n    try {\n      let stream = this.videoStream\n\n      // Only request new stream if we don't have one\n      if (!stream) {\n        const newStream = await this.selectVideoStreamSource()\n        if (!newStream) {\n          throw new Error('Failed to get screen capture stream')\n        }\n        stream = newStream\n      }\n\n      const video = document.createElement('video')\n      video.srcObject = stream\n\n      await new Promise((resolve) => {","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/transloadit/uppy/blob/5d4dedd02a1ac0ae022c75c54aca76558f88e256/packages/@uppy/screen-capture/src/ScreenCapture.tsx#L517-L553","documentation":"captureScreenshot throws this when navigator.mediaDevices.getDisplayMedia is missing, i.e. the current environment does not support the Screen Capture API. The plugin guards explicitly before attempting to capture a screenshot of the shared screen.","triggerScenarios":"Calling captureScreenshot() (or clicking the screenshot button from getScreenshotButtonProps) in a browser or context where mediaDevices.getDisplayMedia is undefined: insecure http origins, some WebView/embedded browsers, or older Safari/Firefox.","commonSituations":"App served over plain http, iframes without the allow=\"display-capture\" permission policy, corporate WebViews, or unit tests in jsdom where the API doesn't exist.","solutions":["Serve the app over HTTPS (or localhost) so getDisplayMedia is exposed","Add allow=\"display-capture\" to any iframe embedding the app","Feature-detect and hide/disable the screenshot button when the API is absent"],"exampleFix":"// before\n<button {...plugin.getScreenshotButtonProps()} />\n\n// after\nconst canScreenshot = typeof navigator.mediaDevices?.getDisplayMedia === 'function'\n{canScreenshot && <button {...plugin.getScreenshotButtonProps()} />}","handlingStrategy":"type-guard","validationCode":"if (typeof navigator.mediaDevices?.getDisplayMedia !== 'function') {\n  // hide screenshot UI\n}","typeGuard":"const hasDisplayMedia = (md?: MediaDevices): md is MediaDevices & { getDisplayMedia: () => Promise<MediaStream> } =>\n  typeof md?.getDisplayMedia === 'function'","tryCatchPattern":"try { await plugin.captureScreenshot() } catch (e) { if (e.message === 'Screen capture is not supported') { /* disable feature */ } }","preventionTips":["Feature-detect before rendering the screenshot button","Serve over HTTPS and add allow=\"display-capture\" to iframes","Keep a browser-support matrix check for screen capture features"],"tags":["screen-capture","feature-detection","browser-support","https"],"backgroundTag":"getdisplaymedia-unavailable","analyzedSha":"5d4dedd02a1ac0ae022c75c54aca76558f88e256","analyzedAt":"2026-08-28T12:18:41.267Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}