Interface AudioHTTPServer


  • @NonNullByDefault
    public interface AudioHTTPServer
    This is an interface that is implemented by AudioServlet and which allows exposing audio streams through HTTP. Streams are only served a single time and then discarded.
    Author:
    Kai Kreuzer - Initial contribution
    • Method Detail

      • serve

        String serve​(AudioStream stream)
        Creates a relative url for a given AudioStream where it can be requested a single time. Note that the HTTP header only contains "Content-length", if the passed stream is an instance of FixedLengthAudioStream. If the client that requests the url expects this header field to be present, make sure to pass such an instance. Streams are closed after having been served.
        Parameters:
        stream - the stream to serve on HTTP
        Returns:
        the relative URL to access the stream starting with a '/'
      • serve

        String serve​(FixedLengthAudioStream stream,
                     int seconds)
        Creates a relative url for a given AudioStream where it can be requested multiple times within the given time frame. This method only accepts FixedLengthAudioStreams, since it needs to be able to create multiple concurrent streams from it, which isn't possible with a regular AudioStream. Streams are closed, once they expire.
        Parameters:
        stream - the stream to serve on HTTP
        seconds - number of seconds for which the stream is available through HTTP
        Returns:
        the relative URL to access the stream starting with a '/'