Lightning disallows permission policy

Viewed 661

I have an iFrame inside an aura component, it works like a charm on Classic but on Lightning.

When I try to share my screen, I get this error:

ERROR: Failed to execute 'getDisplayMedia' on 'MediaDevices': Access to the feature "display-capture" is disallowed by permission policy.

This is the iFrame tag

<iframe aura:id="someId" allow="camera; microphone; fullscreen;display-capture" 
        src="someURL" onload="{!c.someAction}"/>
1 Answers

There is not enough information for exact answer. You need to know the nesting structure of the <iframe> and which Permissions/Feature Policy is valid in each of them, and whether there is a Feature-Policy header on the main page.
Because if the parent context does not have access to the feature, it will be prohibited in the nested frame despite the allow= attribute.

Nevertheless, the policy:

<iframe allow="camera; microphone; fullscreen;display-capture" src="someURL">

means camera 'src'; microphone 'src'; fullscreen 'src'; display-capture 'src' where 'src' is taking from the src="someURL" of iframe.
Therefore if you change src="toSomeAnotherURL" the Premission Policy will block access to allowed features.
So you also need to know the logic of the script.

Related