Thanks to visit codestin.com
Credit goes to github.com

Skip to content

How to stop playback correctly #80

@zuher-and-ko

Description

@zuher-and-ko

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions