<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>186294</bug_id>
          
          <creation_ts>2018-06-04 17:52:05 -0700</creation_ts>
          <short_desc>Implement getDisplayMedia, the Screen Capture API</short_desc>
          <delta_ts>2022-02-25 10:43:12 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebRTC</component>
          <version>Safari 11</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Lee Ho">lee</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>argggh</cc>
    
    <cc>ben</cc>
    
    <cc>daginge</cc>
    
    <cc>eric.carlson</cc>
    
    <cc>hispejukke</cc>
    
    <cc>jer.noble</cc>
    
    <cc>jespertheend</cc>
    
    <cc>jomluvukni</cc>
    
    <cc>jonlee</cc>
    
    <cc>ldenoue</cc>
    
    <cc>lee</cc>
    
    <cc>mancas.f.george</cc>
    
    <cc>m.kurz+webkitbugs</cc>
    
    <cc>netemowihe</cc>
    
    <cc>niklasmerz</cc>
    
    <cc>octavian</cc>
    
    <cc>philipp.weissensteiner</cc>
    
    <cc>reducecode</cc>
    
    <cc>shahraship</cc>
    
    <cc>szmydadam</cc>
    
    <cc>wilhelm.wanecek</cc>
    
    <cc>youennf</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1429977</commentid>
    <comment_count>0</comment_count>
    <who name="Lee Ho">lee</who>
    <bug_when>2018-06-04 17:52:05 -0700</bug_when>
    <thetext>This is a request for implementing getDisplayMedia, the Screen Capture API that is an extension to the Media Capture API. This allows a display surface to be used as a source for a media stream.

Examples of display surfaces that may be supported include: monitor, window, application (entire collection of windows for an application), or browser (single browser window). Having the ability to capture and share a monitor display would be a great start.

The specification is here: https://w3c.github.io/mediacapture-screen-share/

Microsoft Edge (EdgeHTML 17) added support for the Screen Capture API as part of the Windows 10 April 2018 update: https://blogs.windows.com/msedgedev/2018/05/02/bringing-screen-capture-to-microsoft-edge-media-capture-api/
Google Chrome and Mozilla Firefox have already had support for non-standard screen capture APIs for years. They have bugs tracking migrations to the standard getDisplayMedia API (Chrome: https://bugs.chromium.org/p/chromium/issues/detail?id=326740, Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1321221).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1430208</commentid>
    <comment_count>1</comment_count>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2018-06-05 13:50:37 -0700</bug_when>
    <thetext>getDisplayMedia is implemented (for displays only, not window, or application) on macOS behind the ScreenCapture runtime flag (off by default). See bugs 181070, 181291, and 181333.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1430359</commentid>
    <comment_count>2</comment_count>
    <who name="Lee Ho">lee</who>
    <bug_when>2018-06-05 21:50:39 -0700</bug_when>
    <thetext>That&apos;s great to hear! How do we go about enabling this ScreenCapture runtime flag? What (minimum) version of Safari is required?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1430470</commentid>
    <comment_count>3</comment_count>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2018-06-06 09:28:59 -0700</bug_when>
    <thetext>There is no UI to enable this setting yet because the (complex) user prompt for getDisplayMedia hasn&apos;t been added to Safari yet.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1450254</commentid>
    <comment_count>4</comment_count>
    <who name="">wilhelm.wanecek</who>
    <bug_when>2018-08-15 01:22:38 -0700</bug_when>
    <thetext>Are there any plans to extend the implementation to include window or application? If possible, it would also be really valuable to get any sort of estimate about when the UI work for Safari is planned.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1474041</commentid>
    <comment_count>5</comment_count>
    <who name="Adam Szmyd">szmydadam</who>
    <bug_when>2018-11-01 00:36:12 -0700</bug_when>
    <thetext>(In reply to Eric Carlson from comment #1)
&gt; getDisplayMedia is implemented (for displays only, not window, or
&gt; application) on macOS behind the ScreenCapture runtime flag (off by
&gt; default). See bugs 181070, 181291, and 181333.

How to enable this `ScreenCapture` runtime flag to prepare code for this implementation and see how it works for now?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1474070</commentid>
    <comment_count>6</comment_count>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2018-11-01 04:58:00 -0700</bug_when>
    <thetext>(In reply to Adam Szmyd from comment #5)
&gt; How to enable this `ScreenCapture` runtime flag to prepare code for this
&gt; implementation and see how it works for now?

It can only be enabled at build time currently.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1477359</commentid>
    <comment_count>7</comment_count>
    <who name="Raship Shah">shahraship</who>
    <bug_when>2018-11-10 22:47:25 -0800</bug_when>
    <thetext>+1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1481123</commentid>
    <comment_count>8</comment_count>
    <who name="octavn">octavian</who>
    <bug_when>2018-11-23 07:47:57 -0800</bug_when>
    <thetext>+1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1500125</commentid>
    <comment_count>9</comment_count>
    <who name="">m.kurz+webkitbugs</who>
    <bug_when>2019-01-30 12:59:00 -0800</bug_when>
    <thetext>Please ship this!

Chrome 72 supports it by default since yesterday: https://addpipe.com/blog/standards-compliant-screen-capture-in-chrome-72/

Firefox 66 supports this too:
https://bugzilla.mozilla.org/show_bug.cgi?id=1321221

Edge supports this already since EdgeHTML 17: https://blogs.windows.com/msedgedev/2018/05/02/bringing-screen-capture-to-microsoft-edge-media-capture-api/#Amr4BHB73ZQfDKLq.97</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1521213</commentid>
    <comment_count>10</comment_count>
    <who name="Skip">reducecode</who>
    <bug_when>2019-03-25 22:29:53 -0700</bug_when>
    <thetext>+1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1526352</commentid>
    <comment_count>11</comment_count>
    <who name="">netemowihe</who>
    <bug_when>2019-04-11 05:02:24 -0700</bug_when>
    <thetext>Even Edge has this functionality. Please implement!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1526885</commentid>
    <comment_count>12</comment_count>
    <who name="Jon Lee">jonlee</who>
    <bug_when>2019-04-12 13:08:30 -0700</bug_when>
    <thetext>It is now available as an experimental feature in Safari Technology Preview. Please give it a try. We welcome your feedback!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1526909</commentid>
    <comment_count>13</comment_count>
    <who name="netemowihe">jomluvukni</who>
    <bug_when>2019-04-12 14:31:51 -0700</bug_when>
    <thetext>I tried it out. Works great for sharing the entire screen! 

Would be nice if the feature allowed the user to select whether they want to share their entire screen(s), a particular window or a safari browser tab. Similar functionality exists in Chrome, Firefox and Edge.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1540381</commentid>
    <comment_count>14</comment_count>
    <who name="netemowihe">hispejukke</who>
    <bug_when>2019-05-30 11:07:21 -0700</bug_when>
    <thetext>Some of the functionality appears to have been broken in Tech Preview 83. Granting an application permission to capture the screen works, however, even after stopping the sharing indicator continues to appear in the web address as well as in the menu bar. Attempting to &quot;Pause&quot;, which is the only available action, does not do anything.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1540390</commentid>
    <comment_count>15</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2019-05-30 11:25:43 -0700</bug_when>
    <thetext>(In reply to netemowihe from comment #14)
&gt; Some of the functionality appears to have been broken in Tech Preview 83.
&gt; Granting an application permission to capture the screen works, however,
&gt; even after stopping the sharing indicator continues to appear in the web
&gt; address as well as in the menu bar. Attempting to &quot;Pause&quot;, which is the only
&gt; available action, does not do anything.

netemowihe, would you be able to file a separate bug?
Testing locally on STP83/MacOS10.14.5, I do not see any menu/address bar icons showing up for either getDisplayMedia or getUserMedia. I can see the tab icons though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1543696</commentid>
    <comment_count>16</comment_count>
    <who name="">philipp.weissensteiner</who>
    <bug_when>2019-06-11 07:37:14 -0700</bug_when>
    <thetext>Hi,

I noticed that a MediaStream returned by

getDisplayMedia({ audio: true, video: true })

does not contain an audio track.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1543720</commentid>
    <comment_count>17</comment_count>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2019-06-11 08:59:48 -0700</bug_when>
    <thetext>(In reply to philipp.weissensteiner from comment #16)
&gt; Hi,
&gt; 
&gt; I noticed that a MediaStream returned by
&gt; 
&gt; getDisplayMedia({ audio: true, video: true })
&gt; 
&gt; does not contain an audio track.

That is by design, and is something the spec allows:

Unlike getUserMedia with regards to audio+video, the user agent is allowed not to return audio even if the audio constraint is present. If the user agent knows no audio will be shared for the lifetime of the stream it MUST NOT include an audio track in the resulting stream. The user agent MAY accept a request for audio and video by only returning a video track in the resulting stream, or it MAY accept the request by returning both an audio track and a video track in the resulting stream.

https://w3c.github.io/mediacapture-screen-share/#mediadevices-additions</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1543999</commentid>
    <comment_count>18</comment_count>
    <who name="">philipp.weissensteiner</who>
    <bug_when>2019-06-12 01:28:39 -0700</bug_when>
    <thetext>Thanks for the clarification, Eric.

Since the spec also mentions:

&gt; In the case of audio, the user agent MAY present the end-user with audio sources to share. Which choices are available to choose from is up to the user agent, and the audio source(s) are not necessarily the same as the video source(s)

I&apos;m wondering are there plans to introduce a selectable audio source for gDM?

As of right now, if you were developing a screen sharing application
you would have to add the audio track manually, correct?

displayStream = gDM({ video: true });
audioStream = gUM({ audio: true });

displayStream.addTrack(audioStream.getAudioTracks()[0]);</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1544030</commentid>
    <comment_count>19</comment_count>
    <who name="octavn">octavian</who>
    <bug_when>2019-06-12 04:35:16 -0700</bug_when>
    <thetext>&gt; As of right now, if you were developing a screen sharing application
&gt; you would have to add the audio track manually, correct?
&gt; 
&gt; displayStream = gDM({ video: true });
&gt; audioStream = gUM({ audio: true });
&gt; 
&gt; displayStream.addTrack(audioStream.getAudioTracks()[0]);

That&apos;s how we&apos;re doing it in Chrome and Firefox but I&apos;ve never tested it with Safari.

https://blog.addpipe.com/screen-recording/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1544139</commentid>
    <comment_count>20</comment_count>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2019-06-12 09:32:02 -0700</bug_when>
    <thetext>(In reply to philipp.weissensteiner from comment #18)
&gt; Thanks for the clarification, Eric.
&gt; 
&gt; Since the spec also mentions:
&gt; 
&gt; &gt; In the case of audio, the user agent MAY present the end-user with audio sources to share. Which choices are available to choose from is up to the user agent, and the audio source(s) are not necessarily the same as the video source(s)
&gt; 
&gt; I&apos;m wondering are there plans to introduce a selectable audio source for gDM?
&gt; 
&gt; As of right now, if you were developing a screen sharing application
&gt; you would have to add the audio track manually, correct?
&gt; 
&gt; displayStream = gDM({ video: true });
&gt; audioStream = gUM({ audio: true });
&gt; 
&gt; displayStream.addTrack(audioStream.getAudioTracks()[0]);

We aren&apos;t currently planning to add support for capturing microphone audio to getDisplayMedia. I see two problems, 1) microphone capture and screen capture are conceptually quite different, and 2) adding microphone capture to gDM would require something in the user prompt to make it clear to the user that the page was asking for both, and I&apos;m afaid that it would be easy for a user to overlook the extra request. This will be especially in the much more complicated user prompt required once we support screen capture from a monitor or window.

It *would* make sense to allow screen+audio capture if the audio captured was the  audio output from the machine (for screen capture) or application (for window capture), but we don&apos;t have system API for that.

Thanks for the feedback! We&apos;re always happy to hear about feature requests, bugs, etc - even if we aren&apos;t able to do anything as is the case here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1715892</commentid>
    <comment_count>21</comment_count>
    <who name="Raship Shah">shahraship</who>
    <bug_when>2020-12-18 22:02:28 -0800</bug_when>
    <thetext>Now that Safari on iPadOS claims to support desktop class browsing, would we expect to see this available there as well?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1823991</commentid>
    <comment_count>22</comment_count>
    <who name="Laurent Denoue">ldenoue</who>
    <bug_when>2021-12-14 07:24:15 -0800</bug_when>
    <thetext>&gt; We aren&apos;t currently planning to add support for capturing microphone audio
&gt; to getDisplayMedia.

Are people working on window sharing?
All other engines support picking an individual window to share instead of the entire screen, which I find useful for privacy reasons.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1846089</commentid>
    <comment_count>23</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2022-02-25 10:43:12 -0800</bug_when>
    <thetext>Closing this as fixed given this shipped in Safari 13 in 2019.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>