NeuralNine / vidstream

Streaming video data via networks
https://pypi.org/project/vidstream/
MIT License
263 stars 148 forks source link

Doesn't work on MacOS #4

Open codinginpython123 opened 3 years ago

codinginpython123 commented 3 years ago

On MacOS there is a limitation: You can't run a gui outside the MAIN Thread. @NeuralNine please find a way to run the the gui in the Main Thread to have compatability with MacOS.

NeuralNine commented 3 years ago

Thanks for the information. I don't have any MacOS systems I can test this package on at the moment. I will work on it once I have the possibility. Of course I am also happy to accept pull requests from Mac users that are able to fix this issue.

codinginpython123 commented 3 years ago

Thanks for the information. I don't have any MacOS systems I can test this package on at the moment. I will work on it once I have the possibility. Of course I am also happy to accept pull requests from Mac users that are able to fix this issue.

Thanks for replying to my issue. I also have a Windows machine but my mac is my main programming computer! I will also try it on the Windows machine. I will try to make the library work in MacOS myself too. Also huge fan of your Youtube Channel!

codinginpython123 commented 3 years ago

I studied the source code of vidstream and if i find a way to not put the __client_connection function on the StreamingServer class inside a Thread it may work on MacOS

chatLong commented 1 year ago

I studied the source code of vidstream and if i find a way to not put the __client_connection function on the StreamingServer class inside a Thread it may work on MacOS

Hello, I'm also a mac user. Do you can share your solution ?

YanivFalik commented 4 months ago

Hi, Had this bug also :) This helped me - https://github.com/opencv/opencv/issues/22602 The thing is macOs doesn't allow UI actions from threads other then main thread. Meaning in StreamingServer.start_server program initiate new thread of __server_listening. So when we try to do UI action in line 179 cv2.imshow(str(address), frame) We'll get an error.

I tried to init __server_listening in another process, i.e: `.

    """
    Starts the server if it is not running already.
    """
   def start_server(self)
    if self.__running:
        print("Server is already running")
    else:
        self.__running = True
        processId = os.fork()
        if processId > 0:
            self.__server_listening()

`

and it worked fine.