set iframe policy to enable camera and audio (#1433)

This commit is contained in:
Radamés Ajna 2022-05-31 14:53:28 -07:00 committed by GitHub
parent 4a944e6f9f
commit 7e796a3e17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -683,17 +683,21 @@ class Blocks(BlockContext):
"click the link to access the interface in a new tab."
)
try:
from IPython.display import IFrame, display # type: ignore
from IPython.display import HTML, display # type: ignore
if share:
while not networking.url_ok(self.share_url):
time.sleep(1)
display(
IFrame(self.share_url, width=self.width, height=self.height)
HTML(
f'<div><iframe src="{self.share_url}" width="{self.width}" height="{self.height}" allow="autoplay; camera; microphone;" frameborder="0" allowfullscreen></iframe></div>'
)
)
else:
display(
IFrame(self.local_url, width=self.width, height=self.height)
HTML(
f'<div><iframe src="{self.local_url}" width="{self.width}" height="{self.height}" allow="autoplay; camera; microphone;" frameborder="0" allowfullscreen></iframe></div>'
)
)
except ImportError:
pass