diff --git a/syncplay/client.py b/syncplay/client.py index cae8de1c..2e7332dc 100755 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -656,6 +656,10 @@ def openFile(self, filePath, resetPosition=False, fromUser=False): self.playlist.loadPlaylistFromFile(filePath, resetPosition) return + if self.playerIsNotReady(): + self.ui.showErrorMessage(getMessage("player-not-ready-error")) + return + self.playlist.openedFile() self._player.openFile(filePath, resetPosition) if resetPosition: diff --git a/syncplay/messages_en.py b/syncplay/messages_en.py index 347ddbae..39a79c7c 100644 --- a/syncplay/messages_en.py +++ b/syncplay/messages_en.py @@ -140,6 +140,7 @@ "mpv-failed-advice": "The reason mpv cannot start may be due to the use of unsupported command line arguments or an unsupported version of mpv.", "player-file-open-error": "Player failed opening file", "player-path-error": "Player path is not set properly. Supported players are: mpv, mpv.net, VLC, MPC-HC, MPC-BE, mplayer2, and IINA", + "player-not-ready-error": "Media player is not ready yet. Please wait for it to finish starting up and try again.", "hostname-empty-error": "Hostname can't be empty", "empty-error": "{} can't be empty", # Configuration "media-player-error": "Media player error: \"{}\"", # Error line diff --git a/syncplay/ui/gui.py b/syncplay/ui/gui.py index 7bf86f34..85dbdac6 100755 --- a/syncplay/ui/gui.py +++ b/syncplay/ui/gui.py @@ -1251,6 +1251,9 @@ def getInitialMediaDirectory(self, includeUserSpecifiedDirectories=True): @needsClient def browseMediapath(self): + if self._syncplayClient.playerIsNotReady(): + self.showErrorMessage(getMessage("player-not-ready-error")) + return if self._syncplayClient._player.customOpenDialog == True: self._syncplayClient._player.openCustomOpenDialog() return @@ -1280,6 +1283,9 @@ def browseMediapath(self): @needsClient def OpenAddFilesToPlaylistDialog(self): + if self._syncplayClient.playerIsNotReady(): + self.showErrorMessage(getMessage("player-not-ready-error")) + return if self._syncplayClient._player.customOpenDialog == True: self._syncplayClient._player.openCustomOpenDialog() return