SlideShare a Scribd company logo
WebRTC Standards Webinar & Q&A
Amir Zmora
TheNewDialTone
Jan-Ivar Bruaroey
Mozilla
Watch video recording of this session
http://ccst.io/e/webrtcstandards28
Jan-Ivar Bruaroey
jib on irc.mozilla.org #media
@jibrewery on Twitter
On the Firefox Media team, working to implement WebRTC:
getUserMedia(), getDisplayMedia(), RTCPeerConnection().
W3C editor of mediacapture-main and webrtc-pc.
Contributor to mediacapture-screen-share and other specs.
I’m currently implementing getDisplayMedia() in Firefox, and
contributing to finish off its specification.
Session sponsored by
WebRTC.ventures is a custom design and development shop dedicated to building WebRTC based applications
for web and mobile. We have built end-to-end broadcast solutions for events and entertainment clients,
telehealth solutions for multiple clients, live support tools, as well as communication tools for a variety of other
applications. WebRTC.ventures is a recognized development partner of TokBox and has also built native
WebRTC solutions
We use CrowdCast….It’s WebRTC
getDisplayMedia 1.0
Standard Screen-sharing
Outline
1. Introduction to getDisplayMedia()
2. Constraints for downscaling
3. Finalizing the spec.
4. Security concerns. Full-screen/browser tab-sharing is
“scary”.
5. Permissions
6. Iframe permissions (Feature Policy)
History
Since 2013-14,Chrome and Firefox have supported screen capture through incompatible
proprietary and non-standard extensions of getUserMedia().
Firefox with the mediaSource constraint (dropped white-list in 52).
Chrome requires an extension be installed; with chromeMediaSource constraint.
Progress lingered on standard specification, until recently.
Chrome to drop inline installation of extensions soon; new friction injects urgency.
W3C Screen Capture specification
Spec doc: mediacapture-screen-share.
Standard way to let websites request the end-user to share their display of choice.
Nearing completion. Implementations available:
• Edge: Yes (early 2018 draft)
• Chrome: In development (yes behind pref in Canary, early 2018 draft)
• Safari: In development
• Firefox: In development. Targeting 64 or 65.
• Adapter.js: Yes (early 2018 draft), w/setup in Firefox/Chrome w/Chrome plugin.
Screen-sharing with getDisplayMedia()
Early 2018:
video.srcObject = await navigator.getDisplayMedia({video: true});
Downscaling with track.applyConstraints()
Early 2018: constraints on gDM forbidden. Mustn’t influence user-selection. Instead:
const stream = video.srcObject = await navigator.getDisplayMedia({video: true});
// Got it! Now downscale to not be huge
await stream.getVideoTracks()[0].applyConstraints({width: 320, height: 200});
Downscaling with getDisplayMedia()
Late 2018: constraints allowed, but browsers MUST apply only after user selection.
stream = await navigator.getDisplayMedia({video: {width: 320, height: 200}});
// Got it! And it’s downscaled already.
Simpler. But what about OverconstrainedError? Would stink post-prompt (more later).
Downscaling with getDisplayMedia()
Of course you can still use applyConstraints and the rest of the API:
stream = await navigator.getDisplayMedia({video: {width: 320, height: 200}});
const [track] = stream.getVideoTracks();
const halve = async () => {
const {width, height} = track.getSettings();
await track.applyConstraints({width: width / 2, height: height / 2});
}
halve();
Constraints in getDisplayMedia() 1.0
Some differences from camera. Constraints are for downscaling, not discovery.
Therefore, the following constraint keywords are disallowed:
await navigator.getDisplayMedia({video: {width: {min: 320}}); // TypeError
await navigator.getDisplayMedia({video: {width: {exact: 320}}); // TypeError
await navigator.getDisplayMedia({video: {advanced: [{width: 320}]}); // TypeError
But the ideal and max constraints are allowed (more on this later).
This eliminates the risk of post-prompt OverconstrainedError.
Again, getDisplayMedia() is not for discovery.
Captured windows may have surprising aspect.
await gDM({video: {width: 320, height: 200}});
Downscaling always preserves aspect, never crops
Best effort based on fitness distance.
There’s some question whether fitness distance alone
gives good results.
Firefox uses-area-based approximation when aspects
differ. Allowed to go out of bounds.
ideal
Why? End-user might resize window extremely tall or wide during live capture.
await gDM({video: {width: {ideal:320, max:320}, height: {ideal:200, max:340}}});
Use max constraint to define outer bounds
Having two forms of constraints allows room for aspect
changes within limits.
If end-user makes window any taller, it’s always
downscaled to fit within outer bounds.
ideal
max
User resizes live. Video stays inside bounds
How to detect Retina displays
These render at 2x size. Unexpected? Detectable? The plan is to downscale these to ½ by default to
render at the expected same scale. This also makes it detectable:
stream = await navigator.getDisplayMedia({video: true}); // unconstrained
const [track] = stream.getVideoTracks();
const isRetina = track.getSettings().resizeMode != ‘none’; // already downscaled?
// I have 1 gigabit upload, no defaults for me, I want the whole enchilada
await track.applyConstraints({width: 9999, height: 9999}); // no worry no upscale
How to detect Retina displays (alternative)
Another approach that could someday work with other constraints applied:
stream = await navigator.getDisplayMedia({video: myConstraints}); // constrained
const [track] = stream.getVideoTracks();
const {width, height} = track.getSettings();
const cap = track.getCapabilities();
const isRetina = width < cap.width.max || height < cap.height.max;
await track.applyConstraints({width: cap.width.max, height: cap.height.max});
But this depends on expectations of getCapabilities() for windows that change size.
Adapter.js polyfill
Works in Firefox (and Edge of course): https://jsfiddle.net/jib1/q75yb8pf/
adapter.browserShim.shimGetDisplayMedia(window, ‘window’); // or ‘screen’
const stream = video.srcObject = await navigator.getDisplayMedia({video: true});
We will combine “screen” and “window” choices in Firefox Nightly soon.
Constraint support demo: https://jsfiddle.net/jib1/dkt5wexz/
Works with Firefox and Canary (Edge does not allow constraints on getDisplayMedia)
Shim for Chrome plugin is more involved. Google “adapter.js getDisplayMedia”.
Finalizing the spec: How to ask for audio?
This isn’t in the spec yet. But Chrome apparently has this ability, but only for browser tabs. Maybe:
await navigator.getDisplayMedia({video: true, audio: true});
Should this fail immediately with OverconstrainedError if audio is unsupported, or just return a
video track with no audio?
Some sources may have audio, others may not. How to handle that? Silence?
What about:
await navigator.getDisplayMedia({audio: true});
?
Security concerns
Full-screen/browser sharing is scary!
Not just passive threats.
If a web surface under site control is
captured, that website has keys to the car,
and can iframe-navigate as the logged-in
user effectively.
Sidesteps cross-origin protections.
Firefox warns, but hard to explain !
Google “share screen trust” for more
SecureContext
getDisplayMedia() will be https only, pending w3c/mediacapture-screen-share#77
if (!(‘getDisplayMedia’ in navigator)) {
// http or unsupported in browser
return;
}
Persistent “granted” permissions are forbidden.
Persistent “denied” permissions are allowed.
Prompts user before every access.
Website cannot narrow user choice,
(to avoid steering them toward scary sources).
Spec recommends elevated permission for scary sources.
Question: How to prompt for video + audio?
Permissions
How to tackle requests from iframes?
Users don’t read URLs in prompts! Too hard.
wicg.github.io/feature-policy to the rescue.
Says: All grants to top-level domain.
It’s up to top-level domain to delegate to iframes.
Similar to camera and microphone:
<iframe allow="camera; microphone; display">
Disallow by default. navigator.getDisplayMedia remains but throws SecurityError
Should “display” cover both video and related audio?
Iframe permissions (Feature Policy) Cross-origin domain!
“screen” or
“display”?
Questions? Use-cases?
We’re interested in hearing of screen-sharing use-cases we haven’t thought of.
For instance, appear.in uses screen-sharing to record a WebRTC meeting.
Audio use-cases? Any not covered by web-audio? Audio-only?
Do security measures seem sufficient? Expect any different in Private Browsing?
?
Session sponsored by
WebRTC Standards Webinar & Q&A
Amir Zmora
TheNewDialTone
Jan-Ivar Bruaroey
Mozilla

More Related Content

PPT
Building an HTML5 Video Player
PDF
[rwdsummit2012] Adaptive Images in Responsive Web Design
PDF
[cssdevconf] Adaptive Images in RWD
PDF
[refreshaustin] Adaptive Images in Responsive Web Design
PDF
HTML5 Multimedia Accessibility
PDF
audio, video and canvas in HTML5 - standards>next Manchester 29.09.2010
PDF
[HEWEBAR 2012] Adaptive Images in Responsive Web Design
PDF
HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012
Building an HTML5 Video Player
[rwdsummit2012] Adaptive Images in Responsive Web Design
[cssdevconf] Adaptive Images in RWD
[refreshaustin] Adaptive Images in Responsive Web Design
HTML5 Multimedia Accessibility
audio, video and canvas in HTML5 - standards>next Manchester 29.09.2010
[HEWEBAR 2012] Adaptive Images in Responsive Web Design
HTML5 multimedia - browser-native video and audio - JSDay / Verona / 17 May 2012

What's hot (20)

PDF
Making the HTML5 Video element interactive
PDF
HTML5 APIs - The New Frontier
PDF
[peachpit] Adaptive Images in Responsive Web Design
PDF
[CSSDevConf] Adaptive Images in Responsive Web Design 2014
KEY
Video.js - How to build and HTML5 Video Player
PPTX
Amp by Google: The Present And Future Of Quick Content Delivery
PDF
Microservices: Improving the autonomy of our teams with Event-Driven Architec...
PDF
[wvbcn] Adaptive Images in Responsive Web Design
PDF
Avoiding the domino effect in our [micro]services (SOLID at macro-design level)
PDF
[funka] Adaptive Images in Responsive Web Design
PDF
JS Days HTML5 Flash and the Battle for Faster Cat Videos
PDF
[parisweb] Adaptive Images in Responsive Web Design
PDF
[rwdsummit] Adaptive Images in Responsive Web Design
PPTX
DoctypeHTML5 (Hyderabad) Presentation on Multimedia
PDF
State of Media Accessibility in HTML5
PDF
JS Days Mobile Meow
PDF
Taking HTML5 video a step further
PDF
Html5 Open Video Tutorial
PDF
[convergese] Adaptive Images in Responsive Web Design
KEY
Web Apps
Making the HTML5 Video element interactive
HTML5 APIs - The New Frontier
[peachpit] Adaptive Images in Responsive Web Design
[CSSDevConf] Adaptive Images in Responsive Web Design 2014
Video.js - How to build and HTML5 Video Player
Amp by Google: The Present And Future Of Quick Content Delivery
Microservices: Improving the autonomy of our teams with Event-Driven Architec...
[wvbcn] Adaptive Images in Responsive Web Design
Avoiding the domino effect in our [micro]services (SOLID at macro-design level)
[funka] Adaptive Images in Responsive Web Design
JS Days HTML5 Flash and the Battle for Faster Cat Videos
[parisweb] Adaptive Images in Responsive Web Design
[rwdsummit] Adaptive Images in Responsive Web Design
DoctypeHTML5 (Hyderabad) Presentation on Multimedia
State of Media Accessibility in HTML5
JS Days Mobile Meow
Taking HTML5 video a step further
Html5 Open Video Tutorial
[convergese] Adaptive Images in Responsive Web Design
Web Apps
Ad

Similar to WebRTC Standards & Implementation Q&A - getDisplayMedia 1.0 (20)

PDF
WebRTC Live Q&A and Screen Capture session 3
PDF
[html5tx] Adaptive Images in Responsive Web Design
PDF
WebRTC Standards & Implementation Q&A - All about browser interoperability
PDF
Web rtc standards live session #13 - The Browser-Standards Gap
PPTX
Introduction to WebRTC
PDF
HTML5 Intoduction for Web Developers
PDF
soft-shake.ch - Introduction to HTML5
PPTX
How to Develop Progressive Web Apps in Flutter – Step by Step Guide.pptx
PDF
WebRTC ... GWT & in-browser computation
PDF
Isolating GPU Access in its Own Process
PDF
[workshop] The Revolutionary WebRTC
PDF
Bring Continuous Integration to Your Laptop With the Drone CI Docker Extensio...
PPTX
SkyViewer: An in-browser solution to fast video calling
PPTX
01 - Velociraptor Installation and Overview.pptx
PPTX
01 - Velociraptor Installation and Overview.pptx
PDF
The future of WebRTC - Sept 2021
PDF
WebKit, HTML5 media and GStreamer on multiple platforms (GStreamer Conference...
PDF
WebKit, HTML5 media and GStreamer on multiple platforms
PDF
No drama here - E2E-testing django with playwright
PDF
DIY: Computer Vision with GWT.
WebRTC Live Q&A and Screen Capture session 3
[html5tx] Adaptive Images in Responsive Web Design
WebRTC Standards & Implementation Q&A - All about browser interoperability
Web rtc standards live session #13 - The Browser-Standards Gap
Introduction to WebRTC
HTML5 Intoduction for Web Developers
soft-shake.ch - Introduction to HTML5
How to Develop Progressive Web Apps in Flutter – Step by Step Guide.pptx
WebRTC ... GWT & in-browser computation
Isolating GPU Access in its Own Process
[workshop] The Revolutionary WebRTC
Bring Continuous Integration to Your Laptop With the Drone CI Docker Extensio...
SkyViewer: An in-browser solution to fast video calling
01 - Velociraptor Installation and Overview.pptx
01 - Velociraptor Installation and Overview.pptx
The future of WebRTC - Sept 2021
WebKit, HTML5 media and GStreamer on multiple platforms (GStreamer Conference...
WebKit, HTML5 media and GStreamer on multiple platforms
No drama here - E2E-testing django with playwright
DIY: Computer Vision with GWT.
Ad

More from Amir Zmora (20)

PDF
FlexiWAN Webinar - The Role of Open Source in Your SD-WAN Strategy
PDF
WebRTC Standards & Implementation Q&A - All You Wanted to Know About W3C TPAC...
PDF
WebRTC Standards & Implementation Q&A - IP address privacy revisited
PDF
WebRTC Standards & Implementation Q&A - WebRTC NV planning face-to-face meeting
PDF
WebRTC Standards & Implementation Q&A - Implications of WebRTC 1.0 changes an...
PDF
WebRTC Standards & Implementation Q&A - Testing WebRTC 1.0
PDF
WebRTC Standards & Implementation Q&A - The Future is Now2!
PDF
WebRTC Standards & Implementation Q&A - The Future is Now!
PDF
WebRTC Standards & Implementation Q&A - WebRTC Standards Feature Complete 
No...
PDF
WebRTC Standards & Implementation Q&A - WebRTC Constrains
PDF
WebRTC Standards & Implementation Q&A - The Internals of WebRTC Browsers Impl...
PDF
WebRTC Standards & Implementation Q&A - Legacy API Support Changes
PDF
WebRTC Webinar & Q&A - Standards Update
PDF
WebRTC Webinar & Q&A - All About Microsoft & WebRTC Hosting Guest Speaker Ja...
PDF
WebRTC Webinar & Q&A - Sending DTMF in WebRTC the standard way
PDF
WebRTC Webinar & Q&A - W3C WebRTC W3C MediaStream Recording
PDF
WebRTC Webinar & Q&A - W3C WebRTC JS API Test Platform & Updates from W3C Lis...
PDF
WebRTC Webinar & Q&A - Debugging Networking Issues in WebRTC
PDF
WebRTC Webinar & Q&A - Sumilcast Standards & Implementation
PDF
WebRTC Webinar and Q&A - IP Address Privacy and Microsoft Edge Interoperability
FlexiWAN Webinar - The Role of Open Source in Your SD-WAN Strategy
WebRTC Standards & Implementation Q&A - All You Wanted to Know About W3C TPAC...
WebRTC Standards & Implementation Q&A - IP address privacy revisited
WebRTC Standards & Implementation Q&A - WebRTC NV planning face-to-face meeting
WebRTC Standards & Implementation Q&A - Implications of WebRTC 1.0 changes an...
WebRTC Standards & Implementation Q&A - Testing WebRTC 1.0
WebRTC Standards & Implementation Q&A - The Future is Now2!
WebRTC Standards & Implementation Q&A - The Future is Now!
WebRTC Standards & Implementation Q&A - WebRTC Standards Feature Complete 
No...
WebRTC Standards & Implementation Q&A - WebRTC Constrains
WebRTC Standards & Implementation Q&A - The Internals of WebRTC Browsers Impl...
WebRTC Standards & Implementation Q&A - Legacy API Support Changes
WebRTC Webinar & Q&A - Standards Update
WebRTC Webinar & Q&A - All About Microsoft & WebRTC Hosting Guest Speaker Ja...
WebRTC Webinar & Q&A - Sending DTMF in WebRTC the standard way
WebRTC Webinar & Q&A - W3C WebRTC W3C MediaStream Recording
WebRTC Webinar & Q&A - W3C WebRTC JS API Test Platform & Updates from W3C Lis...
WebRTC Webinar & Q&A - Debugging Networking Issues in WebRTC
WebRTC Webinar & Q&A - Sumilcast Standards & Implementation
WebRTC Webinar and Q&A - IP Address Privacy and Microsoft Edge Interoperability

Recently uploaded (20)

PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Spectroscopy.pptx food analysis technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Empathic Computing: Creating Shared Understanding
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Review of recent advances in non-invasive hemoglobin estimation
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
20250228 LYD VKU AI Blended-Learning.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
sap open course for s4hana steps from ECC to s4
Network Security Unit 5.pdf for BCA BBA.
Spectroscopy.pptx food analysis technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
Diabetes mellitus diagnosis method based random forest with bat algorithm
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Empathic Computing: Creating Shared Understanding
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
NewMind AI Weekly Chronicles - August'25 Week I
Encapsulation_ Review paper, used for researhc scholars
Understanding_Digital_Forensics_Presentation.pptx
Programs and apps: productivity, graphics, security and other tools
MIND Revenue Release Quarter 2 2025 Press Release
Review of recent advances in non-invasive hemoglobin estimation

WebRTC Standards & Implementation Q&A - getDisplayMedia 1.0

  • 1. WebRTC Standards Webinar & Q&A Amir Zmora TheNewDialTone Jan-Ivar Bruaroey Mozilla
  • 2. Watch video recording of this session http://ccst.io/e/webrtcstandards28
  • 3. Jan-Ivar Bruaroey jib on irc.mozilla.org #media @jibrewery on Twitter On the Firefox Media team, working to implement WebRTC: getUserMedia(), getDisplayMedia(), RTCPeerConnection(). W3C editor of mediacapture-main and webrtc-pc. Contributor to mediacapture-screen-share and other specs. I’m currently implementing getDisplayMedia() in Firefox, and contributing to finish off its specification.
  • 4. Session sponsored by WebRTC.ventures is a custom design and development shop dedicated to building WebRTC based applications for web and mobile. We have built end-to-end broadcast solutions for events and entertainment clients, telehealth solutions for multiple clients, live support tools, as well as communication tools for a variety of other applications. WebRTC.ventures is a recognized development partner of TokBox and has also built native WebRTC solutions
  • 7. Outline 1. Introduction to getDisplayMedia() 2. Constraints for downscaling 3. Finalizing the spec. 4. Security concerns. Full-screen/browser tab-sharing is “scary”. 5. Permissions 6. Iframe permissions (Feature Policy)
  • 8. History Since 2013-14,Chrome and Firefox have supported screen capture through incompatible proprietary and non-standard extensions of getUserMedia(). Firefox with the mediaSource constraint (dropped white-list in 52). Chrome requires an extension be installed; with chromeMediaSource constraint. Progress lingered on standard specification, until recently. Chrome to drop inline installation of extensions soon; new friction injects urgency.
  • 9. W3C Screen Capture specification Spec doc: mediacapture-screen-share. Standard way to let websites request the end-user to share their display of choice. Nearing completion. Implementations available: • Edge: Yes (early 2018 draft) • Chrome: In development (yes behind pref in Canary, early 2018 draft) • Safari: In development • Firefox: In development. Targeting 64 or 65. • Adapter.js: Yes (early 2018 draft), w/setup in Firefox/Chrome w/Chrome plugin.
  • 10. Screen-sharing with getDisplayMedia() Early 2018: video.srcObject = await navigator.getDisplayMedia({video: true});
  • 11. Downscaling with track.applyConstraints() Early 2018: constraints on gDM forbidden. Mustn’t influence user-selection. Instead: const stream = video.srcObject = await navigator.getDisplayMedia({video: true}); // Got it! Now downscale to not be huge await stream.getVideoTracks()[0].applyConstraints({width: 320, height: 200});
  • 12. Downscaling with getDisplayMedia() Late 2018: constraints allowed, but browsers MUST apply only after user selection. stream = await navigator.getDisplayMedia({video: {width: 320, height: 200}}); // Got it! And it’s downscaled already. Simpler. But what about OverconstrainedError? Would stink post-prompt (more later).
  • 13. Downscaling with getDisplayMedia() Of course you can still use applyConstraints and the rest of the API: stream = await navigator.getDisplayMedia({video: {width: 320, height: 200}}); const [track] = stream.getVideoTracks(); const halve = async () => { const {width, height} = track.getSettings(); await track.applyConstraints({width: width / 2, height: height / 2}); } halve();
  • 14. Constraints in getDisplayMedia() 1.0 Some differences from camera. Constraints are for downscaling, not discovery. Therefore, the following constraint keywords are disallowed: await navigator.getDisplayMedia({video: {width: {min: 320}}); // TypeError await navigator.getDisplayMedia({video: {width: {exact: 320}}); // TypeError await navigator.getDisplayMedia({video: {advanced: [{width: 320}]}); // TypeError But the ideal and max constraints are allowed (more on this later). This eliminates the risk of post-prompt OverconstrainedError. Again, getDisplayMedia() is not for discovery.
  • 15. Captured windows may have surprising aspect. await gDM({video: {width: 320, height: 200}}); Downscaling always preserves aspect, never crops Best effort based on fitness distance. There’s some question whether fitness distance alone gives good results. Firefox uses-area-based approximation when aspects differ. Allowed to go out of bounds. ideal
  • 16. Why? End-user might resize window extremely tall or wide during live capture. await gDM({video: {width: {ideal:320, max:320}, height: {ideal:200, max:340}}}); Use max constraint to define outer bounds Having two forms of constraints allows room for aspect changes within limits. If end-user makes window any taller, it’s always downscaled to fit within outer bounds. ideal max User resizes live. Video stays inside bounds
  • 17. How to detect Retina displays These render at 2x size. Unexpected? Detectable? The plan is to downscale these to ½ by default to render at the expected same scale. This also makes it detectable: stream = await navigator.getDisplayMedia({video: true}); // unconstrained const [track] = stream.getVideoTracks(); const isRetina = track.getSettings().resizeMode != ‘none’; // already downscaled? // I have 1 gigabit upload, no defaults for me, I want the whole enchilada await track.applyConstraints({width: 9999, height: 9999}); // no worry no upscale
  • 18. How to detect Retina displays (alternative) Another approach that could someday work with other constraints applied: stream = await navigator.getDisplayMedia({video: myConstraints}); // constrained const [track] = stream.getVideoTracks(); const {width, height} = track.getSettings(); const cap = track.getCapabilities(); const isRetina = width < cap.width.max || height < cap.height.max; await track.applyConstraints({width: cap.width.max, height: cap.height.max}); But this depends on expectations of getCapabilities() for windows that change size.
  • 19. Adapter.js polyfill Works in Firefox (and Edge of course): https://jsfiddle.net/jib1/q75yb8pf/ adapter.browserShim.shimGetDisplayMedia(window, ‘window’); // or ‘screen’ const stream = video.srcObject = await navigator.getDisplayMedia({video: true}); We will combine “screen” and “window” choices in Firefox Nightly soon. Constraint support demo: https://jsfiddle.net/jib1/dkt5wexz/ Works with Firefox and Canary (Edge does not allow constraints on getDisplayMedia) Shim for Chrome plugin is more involved. Google “adapter.js getDisplayMedia”.
  • 20. Finalizing the spec: How to ask for audio? This isn’t in the spec yet. But Chrome apparently has this ability, but only for browser tabs. Maybe: await navigator.getDisplayMedia({video: true, audio: true}); Should this fail immediately with OverconstrainedError if audio is unsupported, or just return a video track with no audio? Some sources may have audio, others may not. How to handle that? Silence? What about: await navigator.getDisplayMedia({audio: true}); ?
  • 21. Security concerns Full-screen/browser sharing is scary! Not just passive threats. If a web surface under site control is captured, that website has keys to the car, and can iframe-navigate as the logged-in user effectively. Sidesteps cross-origin protections. Firefox warns, but hard to explain ! Google “share screen trust” for more
  • 22. SecureContext getDisplayMedia() will be https only, pending w3c/mediacapture-screen-share#77 if (!(‘getDisplayMedia’ in navigator)) { // http or unsupported in browser return; }
  • 23. Persistent “granted” permissions are forbidden. Persistent “denied” permissions are allowed. Prompts user before every access. Website cannot narrow user choice, (to avoid steering them toward scary sources). Spec recommends elevated permission for scary sources. Question: How to prompt for video + audio? Permissions
  • 24. How to tackle requests from iframes? Users don’t read URLs in prompts! Too hard. wicg.github.io/feature-policy to the rescue. Says: All grants to top-level domain. It’s up to top-level domain to delegate to iframes. Similar to camera and microphone: <iframe allow="camera; microphone; display"> Disallow by default. navigator.getDisplayMedia remains but throws SecurityError Should “display” cover both video and related audio? Iframe permissions (Feature Policy) Cross-origin domain! “screen” or “display”?
  • 25. Questions? Use-cases? We’re interested in hearing of screen-sharing use-cases we haven’t thought of. For instance, appear.in uses screen-sharing to record a WebRTC meeting. Audio use-cases? Any not covered by web-audio? Audio-only? Do security measures seem sufficient? Expect any different in Private Browsing?
  • 26. ?
  • 28. WebRTC Standards Webinar & Q&A Amir Zmora TheNewDialTone Jan-Ivar Bruaroey Mozilla