python-eel / Eel

A little Python library for making simple Electron-like HTML/JS GUI apps
MIT License
6.44k stars 587 forks source link

js async with python stdout #435

Closed neosin closed 3 years ago

neosin commented 3 years ago

I would like to pass a video stream from python via stdout to a video.js player embedded in an html page in eel.

How do I pass the stdout on the javascript side to the player? I would like to be able to start/stop/pause the stdout stream.

Are there any examples available of how to accomplish such a task? thank you

mrdotkg commented 2 years ago

@neosin Were you able to figure it out? I need a similar solution for below code.

import eel
import subprocess

@eel.expose
def init_infra():
    clone_command = "git clone <url>"
    try:
        subprocess.check_call(clone_command,shell=True)
        #? Capture STDOUT async and pass to a js function below
        # eel.rec_output(stdout) #js function 

    except subprocess.CalledProcessError as e:
        print(e.output)