Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make streams easy to reset #729

Closed
linknum23 opened this issue May 21, 2024 · 7 comments
Closed

Make streams easy to reset #729

linknum23 opened this issue May 21, 2024 · 7 comments
Assignees
Labels
streaming Digital audio streams, streaming services (ie Pandora), and related plugins
Milestone

Comments

@linknum23
Copy link
Contributor

Context

In AmpliPi a stream is defined as any type audio input that can be played on a source in the system. To play audio out a zone a stream needs to be connected to a source with one or more zones.

Steams come in a couple of different flavors. Some streams hold their state and implement the PersistentSream interface, others just implement the BaseStream interface. To reset a PersistentSream it needs to be deactivated and then activated. To reset a BaseStream disconnecting and connecting it from a source provides a full reset.

Problem

Sometimes a stream gets into a bad state and needs to be restarted. How to do this is not obvious at either an API level or from the UI. For the API it even depends on what type of stream it is.

Solution

  • Add a api/streams/{sid}/reset endpoint to make unified reset interface
  • Add a UI view in settings that allows running streams to be reset (and stopped?)
  • Optional: add a button in the player view to reset a stream as well?
@linknum23 linknum23 added the streaming Digital audio streams, streaming services (ie Pandora), and related plugins label May 21, 2024
@linknum23 linknum23 added this to the 0.4.0 milestone May 21, 2024
@mjustian
Copy link
Contributor

What should happen to a PersistentStream that doesn't support activation/deactivation?

@linknum23
Copy link
Contributor Author

linknum23 commented May 21, 2024

I'm guessing you are talking about:

  def _activate(self, vsrc: int):
    raise NotImplementedError(f'{self.stype} does not support activation')

This is the pythonic way of creating an abstract class. Any stream that implements PersistentStream should implement those. As with everything python this is a little loose.

@mjustian
Copy link
Contributor

mjustian commented May 22, 2024

Should this restart a file player stream to the beginning?

@linknum23
Copy link
Contributor Author

Yup. Realistically that stream is used mostly for announcements. It should work like the reset of streams though to keep a similar user experience.

@sumnerboy12
Copy link

Is this implemented in v0.3.6 as restart;

image

@linknum23
Copy link
Contributor Author

Yup it got included. There's even a button to do it in the UI in Settings->Streams:. To use it select a stream and click the reset button at the bottom of the stream configuration modal..

@linknum23
Copy link
Contributor Author

The meat of this issue is implemented, closing...

@linknum23 linknum23 changed the title Make streams easy to reset and stop Make streams easy to reset Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
streaming Digital audio streams, streaming services (ie Pandora), and related plugins
Projects
None yet
Development

No branches or pull requests

3 participants