diff --git a/syncplay/constants.py b/syncplay/constants.py index cd04f45..1898ce2 100644 --- a/syncplay/constants.py +++ b/syncplay/constants.py @@ -129,7 +129,7 @@ MPV_SENDMESSAGE_COOLDOWN_TIME = 0.05 MPV_MAX_NEWFILE_COOLDOWN_TIME = 3 STREAM_ADDITIONAL_IGNORE_TIME = 10 MPV_LOCK_WAIT_TIME = 0.05 -VLC_OPEN_MAX_WAIT_TIME = 15 +VLC_OPEN_MAX_WAIT_TIME = 20 VLC_MIN_PORT = 10000 VLC_MAX_PORT = 55000 diff --git a/syncplay/players/vlc.py b/syncplay/players/vlc.py index fa674d9..f3571ab 100644 --- a/syncplay/players/vlc.py +++ b/syncplay/players/vlc.py @@ -413,13 +413,18 @@ class VlcPlayer(BasePlayer): self._ibuffer.append(data) def handle_close(self): - asynchat.async_chat.handle_close(self) - if self.timeVLCLaunched and time.time() - self.timeVLCLaunched > constants.VLC_OPEN_MAX_WAIT_TIME: - self.__playerController._client.ui.showDebugMessage("Failed to connect to VLC, but reconnecting as within max wait time") + if self.timeVLCLaunched and time.time() - self.timeVLCLaunched < constants.VLC_OPEN_MAX_WAIT_TIME: + try: + self.__playerController._client.ui.showDebugMessage("Failed to connect to VLC, but reconnecting as within max wait time") + except: + pass self.run() - if self.vlcHasResponded: + elif self.vlcHasResponded: + asynchat.async_chat.handle_close(self) self.__playerController.drop() else: + self.vlcHasResponded = True + asynchat.async_chat.handle_close(self) self.__playerController.drop(getMessage("vlc-failed-connection").format(constants.VLC_MIN_VERSION)) def found_terminator(self): @@ -440,3 +445,9 @@ class VlcPlayer(BasePlayer): pass if line == "close-vlc": self._vlcclosed.set() + if not self.connected and not self.timeVLCLaunched: + # For circumstances where Syncplay is not connected to VLC and is not reconnecting + try: + self.__process.terminate() + except: # When VLC is already closed + pass \ No newline at end of file