georgezhao2010 / apple_airplayer

Make your AirPlay devices as TTS speakers
MIT License
130 stars 17 forks source link

Exception if the media player is already in use #8

Closed Gloomyeye closed 2 years ago

Gloomyeye commented 3 years ago

Hello,

if I try to start the following service twice, an exception occurs which indicates that the second call can not be processed:

Service:

service: tts.google_translate_say data: entity_id: media_player.kue_media_homepod_friday message: This is a long text.

Exception:

Logger: custom_components.apple_airplayer.device_manager Source: custom_components/apple_airplayer/device_manager.py:127 Integration: Apple AirPlayer (documentation, issues) First occurred: 06:52:35 (1 occurrences) Last logged: 06:52:35

Exception raised in async_stream_file, already streaming to device

It is possible to avoid this situation? Can I use a service or state attributes of the media player to know if the media player entity is already in action so that I can wait for the second service call to the media player? Another idea is that the service call can be queued in backgroud, maybe with another additional option.

Gloomyeye commented 2 years ago

Is a problem of pyatv.