Use mediaDevices API in Jira forge app not allowed

I want to use mediaDevices.getUserMedia() to capture screen, but in new version of browsers it disallowed by permission policy.
I use this code for capturing:

desktopStream = await navigator.mediaDevices.getDisplayMedia({ video:true, audio: true });

the container iframe has not allow directive for “display-capture”. the console throw this error:

Uncaught (in promise) DOMException: Failed to execute 'getDisplayMedia' on 'MediaDevices': Access to the feature "display-capture" is disallowed by permission policy.

Hi @naseriimahmoud,

I don’t think the media API is publicly available. How did you come across it? Can you point me to the documentation you see on it?


Hi @dmorrow
Thanks for the reply
I intend to use Media Device using this. But because using it in the form of Ifram (where the Jira app runs) requires access from the parent page (Jira), and this access is not defined in Ifram, the new version of Google Chrome (version 94) does not allow its use. And it returns the error I mentioned in the text of the topic in the console.
Is there a solution to this problem?

1 Like

@dmorrow The problem is lack of appropriate http header or feature in allow attribute: Using the Screen Capture API - Web APIs | MDN

We already have microphone, and camera there, so screen capture should be also fine.

1 Like

Hi @Grzegorz.Tanczyk and @naseriimahmoud ,

When I first saw this post I was assuming we were talking about Atlassian’s internal media API.

Providing the ability to access the browser’s media API within a CustomUI iframe seems reasonable so I’ve created FRGE-555: Enable display-capture access for CustomUI.