Repository: gradio-app/gradio

Issue:
Set IFrame feature policy for Colab environment 
### Describe the bug

Related to this discussion https://github.com/gradio-app/gradio/discussions/1389 

There are two issues here,

1. Gradio generated `IFrame` doesn't have the right feature policies such as `allow="camera;microphone;`

https://github.com/gradio-app/gradio/blob/2eaf61cf7652a3ebc70ea877c33b4a66e0e0e1ce/gradio/blocks.py#L686-L697

It would be easy to add the IFrame `extras=['allow="camera;microphone;"']` parameter, however Collab is stuck to IPython 5.5.0 which doesn't support the `extras` parameter.

https://github.com/googlecolab/colabtools/issues/1582 IPython 5.50

<img width="595" alt="Screen Shot 2022-05-27 at 10 45 21" src="https://user-images.githubusercontent.com/102277/170768957-35a511e1-a2a2-4336-acca-97fa89e14d9a.png">
ps. in the picture the `extra` is working because one can upgrade the IPython `pip install ipython -U` on colab



### Solution
One Solution is to use `IPython.display.HTML` instead of `IFrame` 

```python
 display(
    HTML(f'<iframe src="{self.share_url,}" width="{self.width}" height="{self.height}" allow="camera;microphone;">')
)
```

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Reproduction

https://colab.research.google.com/drive/1dqNIMngC1ZS7HmJvyDrsYdsBjH3P0Fpe

### Screenshot

_No response_

### Logs

_No response_

### System Info

```shell
gradio==3.0.6
```


### Severity

annoying


Discussion:
Thx for the detailed suggestion @radames, would you like to take this on an open a PR?
hi @FarukOzderim, yes I can do a PR if you think it's ok to replace the IFrame with HTML as I suggest, and do we add extra policies besides the camera, microphone, autoplay, here is my suggestion:

```html
<iframe allow="autoplay; camera; microphone;" src=""> </iframe>
```
I think it is okay 👍, we already ask for permissions afaik, there should be no problems.

Resolving patch:
diff --git a/gradio/blocks.py b/gradio/blocks.py
--- a/gradio/blocks.py
+++ b/gradio/blocks.py
@@ -683,17 +683,21 @@ def launch(
                     "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


Test patch: