diff --git a/README.md b/README.md index 9d0bb48..6326353 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Python Alexa Voice Service App Choose a player from `mpv`, `mpg123` and gstreamer. `SpeechSynthesizer` and `Alerts` prefer `mpg123` as it is more responsive. -`AudioPlayer` likes `mpv` > gstreamer > `mpg123` as `mpv` and gstreamer support more audio format. We can also specify the player of `AudioPlayer` using the environment variable `PLAYER`. +`AudioPlayer` likes gstreamer > `mpv` > `mpg123`. Gstreamer supports more audio format and works well on raspberry pi. We can also specify the player of `AudioPlayer` using the environment variable `PLAYER`. * one of mpg123, mpv and gstreamer 1.0 * python-pyaudio diff --git a/avs/player/__init__.py b/avs/player/__init__.py index a744d60..ba86549 100644 --- a/avs/player/__init__.py +++ b/avs/player/__init__.py @@ -2,7 +2,7 @@ """Player support mpv, mpg123 and gstreamer 1.0 -It prefers mpv if it is available, otherwise use gstreamer 1.0 +It likes gstreamer 1.0 > mpv > mpg123 We can specify a player using environment variable PLAYER (mpv, mpg123, gstreamer, single_gstreamer) """ @@ -19,10 +19,15 @@ elif player_option.find('gstreamer') >= 0: from gstreamer_player import Player else: - if os.system('which mpv') == 0: - from mpv_player import Player - else: + try: from gstreamer_player import Player + except ImportError: + if os.system('which mpv') == 0: + from mpv_player import Player + elif os.system('which mpg123') == 0: + from mpg123_player import Player + else: + raise ImportError('No player available, install gstreamer, mpv or mpg123 first') __all__ = ['Player']