Update __main__.py
Fix MpvMediaPlayer Race Condition Goal: The mpv library runs in its own thread. When a track finishes, its callback (_on_idle_active) runs in that thread and tries to modify the satellite's state, creating a race condition. We will fix this by "marshaling" that callback onto the main asyncio loop. added loop=loop to the MpvMediaPlayer constructors
This commit is contained in:
@@ -213,8 +213,16 @@ async def main() -> None:
|
||||
break
|
||||
assert stop_model is not None
|
||||
|
||||
music_player = MpvMediaPlayer(device=args.audio_output_device, initial_volume=preferences.volume_level)
|
||||
tts_player = MpvMediaPlayer(device=args.audio_output_device, initial_volume=preferences.volume_level)
|
||||
music_player = MpvMediaPlayer(
|
||||
loop=loop, # <-- MODIFIED
|
||||
device=args.audio_output_device,
|
||||
initial_volume=preferences.volume_level
|
||||
)
|
||||
tts_player = MpvMediaPlayer(
|
||||
loop=loop, # <-- MODIFIED
|
||||
device=args.audio_output_device,
|
||||
initial_volume=preferences.volume_level
|
||||
)
|
||||
|
||||
state = ServerState(
|
||||
name=args.name,
|
||||
|
||||
Reference in New Issue
Block a user