nwjs/nw.js

[bug] Camera and microphone do not work in iframes

Opened this issue · 3 comments

Current/Missing Behavior

Neither camera nor microphone work in iframe.

Expected/Proposed Behavior

They should work

Additional Info

  • Operating System: any
  • NW.js Version: 0.93 (the latest)
  • Code snippet: see below

How to reproduce

package.json

{
	"main": "/main.html",
	"name": "demo"
}

main.html

<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>Demo</title>
	<script>
chrome.contentSettings.camera.set({
	primaryPattern:"https://webcamtests.com/*",
	scope: "regular",
	setting: "allow"
});
	</script>
</head>
<body style="width:100vw;height:100vh">
	<h2>Camera doesn't work in webviews and iframes:</h2>
	<iframe style="width:100%;height:100%" src="https://webcamtests.com" allow="camera https://webcamtests.com; microphone https://webcamtests.com"></iframe>
</body>
</html>

Demo opens Webcam Test which perfectly shows that neither camera nor microphone can be even detected.

https://blog.addpipe.com/camera-and-microphone-access-in-cross-oirigin-iframes-with-feature-policy/
A quick internet search brought me to this. Please go through this and see if it helps

@ayushmanchhabra No, that doesn't help. Everyhing is correct with my iframe definition: it works in a regular environment.

Clipboard also doesn't work in iframe. Have mentioned this in #8170