gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
34.37k stars 2.61k forks source link

Unable to display video in a gr.HTML() component #10122

Closed HamoonJafarianTR closed 9 hours ago

HamoonJafarianTR commented 9 hours ago

Describe the bug

I want to display a video in gr.HTML(). It works with Gradio==4.44.0, But as soon as I upgrade to the newest version it stops working and the video is not shown. When I downgrade to 4.44.0 version, it works, so the code and paths and permissions are correct. I also tried static folder and set_static_paths solutions, but it doesn't work. I want to show a video in HTML component because it allows me to display the video at a specific start and end time which is unavailable in gr.Video() as far as I know.

Have you searched existing issues? 🔎

Reproduction

import gradio as gr  
html = """    
        <div class='myVideo'>    
            <video controls>    
                <source src='file/shots/output.MP4' type='video/mp4'>    
                Your browser does not support the video tag.    
            </video>    
        </div>    
"""  
with gr.Blocks() as demo:  
    with gr.Row():  
        gr.HTML(html)  
demo.launch(allowed_paths=["/Users/a612/Desktop/Hj/"])  

Screenshot

No response

Logs

No response

System Info

Gradio Environment Information:
------------------------------
Operating System: Darwin
gradio version: 4.44.0
gradio_client version: 1.3.0

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
anyio: 4.4.0
fastapi: 0.115.5
ffmpy: 0.4.0
gradio-client==1.3.0 is not installed.
httpx: 0.27.0
huggingface-hub: 0.25.1
importlib-resources: 6.4.5
jinja2: 3.1.4
markupsafe: 2.1.5
matplotlib: 3.9.0
numpy: 1.26.4
orjson: 3.10.7
packaging: 24.0
pandas: 2.2.2
pillow: 10.3.0
pydantic: 2.7.3
pydub: 0.25.1
python-multipart: 0.0.12
pyyaml: 6.0.2
ruff: 0.6.8
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.12.5
typing-extensions: 4.11.0
urllib3: 2.2.3
uvicorn: 0.31.0
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.

gradio_client dependencies in your environment:

fsspec: 2024.9.0
httpx: 0.27.0
huggingface-hub: 0.25.1
packaging: 24.0
typing-extensions: 4.11.0
websockets: 12.0

Severity

I can work around it

abidlabs commented 9 hours ago

Please use src='/gradio_api/file/shots/output.MP4'

abidlabs commented 9 hours ago

see https://github.com/gradio-app/gradio/issues/9463

image