Interface StreamLinkConfiguration


public interface StreamLinkConfiguration

Interface that allows the configuration of StreamLink to be defined programmatically.

You can obtain an instance of this interface by calling {@link com.caplin.streamlink.StreamLinkFactory.createConfiguration()}.

  • Method Details

    • addCustomAttribute

      StreamLinkConfiguration addCustomAttribute(String key, String value)

      Sets custom attributes. These are recorded in StreamLink log files

      Parameters:
      key - The attribute name.
      value - The attribute value.
      Returns:
      The current StreamLinkConfiguration instance.
    • setApplicationId

      StreamLinkConfiguration setApplicationId(String applicationId)

      Sets the application identifier. This is used by the Caplin Platform to distinguish StreamLink requests from different client applications. It is recorded in StreamLink log files, and is used by Liberator in monitoring software licence compliance and by the Caplin Permissioning Service to restrict the applicability of permissioning rules to specific applications.

      Parameters:
      applicationId - The application identifier.
      Returns:
      The current StreamLinkConfiguration instance.
    • addLiberatorUrlGroup

      StreamLinkConfiguration addLiberatorUrlGroup(String... urls)

      Adds a group of URLs that define possible Liberator connections.

      Parameters:
      urls - A set of URLs defining a Liberator connection group.
      Returns:
      The current StreamLinkConfiguration instance.

      For more information on defining Liberator URL groups see StreamLinkFactory and the "Resilience, failover, and load balancing" section of the StreamLink Overview.

    • setUsername

      StreamLinkConfiguration setUsername(String username)

      Sets the Liberator login user-name to use if logins are not being managed by KeyMaster or a custom CredentialsProvider.

      Parameters:
      username - The Liberator login user-name.
      Returns:
      The current StreamLinkConfiguration instance.
    • setPassword

      StreamLinkConfiguration setPassword(String password)

      Sets the Liberator login password to use if logins are not being managed by KeyMaster or a custom CredentialsProvider.

      Parameters:
      password - The Liberator login password.
      Returns:
      The current StreamLinkConfiguration instance.
    • setPollInterval

      StreamLinkConfiguration setPollInterval(int milliseconds)

      Sets the time interval in milliseconds between polls of the Liberator.

      Parameters:
      milliseconds - The poll interval.
      Returns:
      The current StreamLinkConfiguration instance.

      This only applies to HTTP polling type connections (see 'RTTP connection types' in the document StreamLink Overview).

    • setForeverFrameReconnectCount

      StreamLinkConfiguration setForeverFrameReconnectCount(int count)

      Not used in this version of StreamLink.

    • setDisablePolling

      StreamLinkConfiguration setDisablePolling(Boolean disablePolling)

      Set to true if you don't want to use polling connection when the rttp(s) protocol is specified.

      Parameters:
      disablePolling - Set to true to disable polling connection in rttp(s) protocol.
      Returns:
      The current StreamLinkConfiguration instance.
    • setDisableSseConnection

      StreamLinkConfiguration setDisableSseConnection(Boolean disableSseConnection)

      Set to true if you don't want to use server side events connection when the rttp(s) protocol is specified.

      Parameters:
      disablePolling - Set to true to disable server side events connection in rttp(s) protocol.
      Returns:
      The current StreamLinkConfiguration instance.
    • setRequestTimeout

      StreamLinkConfiguration setRequestTimeout(int milliseconds)

      Time in milliseconds allowed for the response to each command before StreamLink reconnects to the Liberator.

      Parameters:
      milliseconds - The request timeout period in milliseconds.
      Returns:
      The current StreamLinkConfiguration instance.
    • setReconnectDelay

      StreamLinkConfiguration setReconnectDelay(int milliseconds)

      Delay in milliseconds before retrying, after failing to connect (default 1000 milliseconds).

      Parameters:
      milliseconds - The reconnect delay in milliseconds.
      Returns:
      The current StreamLinkConfiguration instance.
    • setReconnectAttempts

      StreamLinkConfiguration setReconnectAttempts(int value)

      Sets the number of times that Streamlink should retry a connection attempt for each connection type (eg. ws, https, poll etc.) Defaults to 0 i.e. only one connection attempt is made per connection type.

      Parameters:
      value - The number of reconnect attempts to make for each connection type.
      Returns:
      The current StreamLinkConfiguration instance.
    • setReconnectCycleDelays

      StreamLinkConfiguration setReconnectCycleDelays(Integer... milliseconds)

      Delay in milliseconds before retrying, after failing to connect with all available connection options. The entries are treated as a backoff where each entry is used once and the last entry is the delay that will keep getting used forever (default 2000, 4000, 8000, 16000 milliseconds).

      Parameters:
      milliseconds - Array of reconnect delays.
      Returns:
      The current StreamLinkConfiguration instance.
    • setClockOffsetInterval

      StreamLinkConfiguration setClockOffsetInterval(int milliseconds)

      Sets the interval between successive calculations of clock offset value(default 10000 milliseconds). For more information, see the clock_offset_interval JSON attribute in caplin.streamlink.StreamLinkFactory.

      Parameters:
      milliseconds - The clock offset interval in milliseconds.
      Returns:
      The current StreamLinkConfiguration instance.
    • setClockOffsetWindow

      StreamLinkConfiguration setClockOffsetWindow(int milliseconds)

      Sets the time a calculated clock offset is valid for use in producing statistics (default 120000 milliseconds). For more information, see the clock_offset_window JSON attribute in caplin.streamlink.StreamLinkFactory.

      Parameters:
      milliseconds - The clock offset window in milliseconds.
      Returns:
      The current StreamLinkConfiguration instance.
    • setLatencyInterval

      StreamLinkConfiguration setLatencyInterval(int milliseconds)

      Sets the time between successive calculations of average latency (default 10000 milliseconds). For more information, see the latency_interval JSON attribute in caplin.streamlink.StreamLinkFactory.

      Parameters:
      milliseconds - The latency interval in milliseconds.
      Returns:
      The current StreamLinkConfiguration instance.
    • setLatencyWindow

      StreamLinkConfiguration setLatencyWindow(int milliseconds)

      Sets the time for which a calculated latency value is valid for use in producing statistics (default 120000 milliseconds). For more information, see the latency_window JSON attribute in caplin.streamlink.StreamLinkFactory.

      Parameters:
      milliseconds - The latency window in milliseconds.
      Returns:
      The current StreamLinkConfiguration instance.
    • setHttpTimeout

      StreamLinkConfiguration setHttpTimeout(int timeout)

      Sets the time allowed for an HTTP Request to finish successfully before StreamLink times out (default 3000 milliseconds).

      Parameters:
      timeout - The timeout period in milliseconds.
      Returns:
      The current StreamLinkConfiguration instance.
    • setInactivityTimeout

      StreamLinkConfiguration setInactivityTimeout(int milliseconds)

      Maximum time in milliseconds that Liberator waits to receive messages from this StreamLink client.

      If the Liberator fails to receive a message from StreamLink within this interval, it disconnects the session and waits for a reconnection attempt.

      The clock offset between Liberator and StreamLink is determined periodically by StreamLink sending a message to the Liberator. It is therefore recommended that this option should be configured to be greater than the ClockOffset configuration value. If it is configured to be smaller, more reconnections than required will take place.

      Note: This feature is only supported by Liberator 6.0 and newer. To determine if your Liberator installation supports this feature, refer to the Liberator's release note.

      Parameters:
      milliseconds - The inactivity period in milliseconds.
      Returns:
      The current StreamLinkConfiguration instance.
    • setKeymasterPollResponseListener

      StreamLinkConfiguration setKeymasterPollResponseListener(KeymasterPollResponseListener keymasterPollListener)

      Sets a KeymasterPollResponseListener to receive information about responses to keep-alive requests made to KeyMaster.

      Parameters:
      keymasterPollListener - The implementation of KeymasterPollResponseListener.
      Returns:
      The current StreamLinkConfiguration instance.
    • setKeymasterPollUrl

      StreamLinkConfiguration setKeymasterPollUrl(String... url)

      Sets the URL that StreamLink uses to check the connection to KeyMaster every KeyMaster poll interval milliseconds.

      Parameters:
      url - The URL that StreamLink uses to check the connection.
      Returns:
      The current StreamLinkConfiguration instance.
    • setKeymasterPollInterval

      StreamLinkConfiguration setKeymasterPollInterval(int interval)

      Interval in milliseconds at which StreamLink will poll KeyMaster (on the KeyMaster poll URL) to keep the KeyMaster session open.

      Parameters:
      interval - The interval in at which StreamLink will poll KeyMaster (default 600000 milliseconds).
      Returns:
      The current StreamLinkConfiguration instance.
    • setKeymasterUrl

      StreamLinkConfiguration setKeymasterUrl(String... url)

      Sets the URL of KeyMaster for secure authentication of Liberator login requests.<//p>

      Parameters:
      url - The KeyMaster URL
      Returns:
      The current StreamLinkConfiguration instance.
    • setKeymasterHttpUser

      StreamLinkConfiguration setKeymasterHttpUser(String httpUser)

      Sets the username used for HTTP KeyMaster sessions.

      Parameters:
      httpUser - The username that will be sent to KeyMaster.
      Returns:
      The current StreamLinkConfiguration instance.
    • setKeymasterHttpPass

      StreamLinkConfiguration setKeymasterHttpPass(String httpPass)

      Sets the password used for HTTP KeyMaster sessions.

      Parameters:
      httpPass - The password that will be sent to KeyMaster.
      Returns:
      The current StreamLinkConfiguration instance.
    • setKeymasterCrossDomainAuthentication

      StreamLinkConfiguration setKeymasterCrossDomainAuthentication(boolean enable)

      Sets whether Cross Domain Authentication is enabled for KeyMaster sessions.

      Parameters:
      enable - Whether Cross Domain Authentication is enabled or not
      Returns:
      The current StreamLinkConfiguration instance.
    • setLogWindowLogLevel

      StreamLinkConfiguration setLogWindowLogLevel(LogLevel level)

      Not used in this version of StreamLink.

    • setLogWindowVisible

      StreamLinkConfiguration setLogWindowVisible(boolean show)

      Not used in this version of StreamLink.

    • setProxy

      StreamLinkConfiguration setProxy(Proxy proxy)

      Sets the proxy to be used for ws(s), http(s), poll(s) and tcp(s) connection protocols.

      Parameters:
      proxy - The proxy to be used.
      Returns:
      The current StreamLinkConfiguration instance.
    • setLogBufferSize

      StreamLinkConfiguration setLogBufferSize(int size)

      Sets the size of the log buffer to be used in Streamlink. If the size is less than or equal to 0, the log buffer will be disabled. (default -1).

      Parameters:
      size - The size of the log buffer to be used
      Returns:
      The current StreamLinkConfiguration instance.
    • setHttpPadLength

      StreamLinkConfiguration setHttpPadLength(int httpPadLength)

      Sets the http pad length to be used for http and Forever Frame connections.

      Parameters:
      proxy - The pad length to be used.
      Returns:
      The current StreamLinkConfiguration instance.
    • setLiberatorUrlProvider

      StreamLinkConfiguration setLiberatorUrlProvider(LiberatorUrlProvider provider)

      Sets a LiberatorUrlProvider that will be used to get the next Liberator URL to connect to.

      If this option is set then it will override any urls added via the addLiberatorUrlGroup method.

      Parameters:
      provider - the class that will provide the name of the next Liberator URL to try.
      Returns:
      The current StreamLinkConfiguration instance.
    • setKeymasterCookieProvider

      StreamLinkConfiguration setKeymasterCookieProvider(KeymasterCookieProvider provider)

      Sets a KeymasterCookieProvider that will provide the cookies used when making KeyMaster connections.

      Parameters:
      provider - The class that will provide the set of cookies.
      Returns:
      The current StreamLinkConfiguration instance.
    • setKeymasterHttpHeaderProvider

      StreamLinkConfiguration setKeymasterHttpHeaderProvider(KeymasterHttpHeaderProvider provider)

      Sets a KeymasterHttpHeaderProvider that will provide the http headers used when making KeyMaster connections.

      Parameters:
      provider - The class that will provide the set of headers.
      Returns:
      The current StreamLinkConfiguration instance.
    • setJsonHandler

      StreamLinkConfiguration setJsonHandler(JsonHandler handler)

      Sets a JsonHandler that will be used to parse and patch JSON objects.

      Parameters:
      handler - the class that implements the JsonHandler interface.
    • getCustomAttributes

      Map<String,String> getCustomAttributes()

      Gets a map of the customer attributes set on this StreamLink instance to.

      Returns:
      A read only reference to the custom attribute map
    • setAcceptAllCertificates

      StreamLinkConfiguration setAcceptAllCertificates(boolean acceptAllCertificates)
      StreamLink Java Only Set this option in StreamLink Java to accept all certificates when using secure websockets (wss)
      Parameters:
      acceptAllCertificates - set true to accept all certificates
      Returns:
      The current StreamLinkConfiguration instance.