-
Notifications
You must be signed in to change notification settings - Fork 22
Description
There is a function that accepts the address of the stream.
def radio(urlstream): miniaudio.PlaybackDevice. with miniaudio.IceCastClient(urlstream, update_stream_title=title_printer) as source: print("Connected to internet stream, audio format:", source.audio_format.name) print("Station name: ", source.station_name) print("Station url: ", urlstream) print("Press <enter> to quit playing.\n") stream = miniaudio.stream_any(source, source.audio_format) with miniaudio.PlaybackDevice() as device: device.start(stream) input() # wait for user input, stream plays in background return
At the first iteration, everything is fine, but if you run with a different thread, it returns an error.
RuntimeError: can't re-enter readline
I tried adding functions to the beginning: miniaudio.PlaybackDevice.stop()
TypeError: AbstractDevice.stop() missing 1 required positional argument: 'self'
Then he swears too
How do I start a new thread correctly?