Class LiveConfiguration.Builder

java.lang.Object
com.castlabs.android.player.LiveConfiguration.Builder
Enclosing class:
LiveConfiguration

public static class LiveConfiguration.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
      Create a new builder with default values
    • Builder

      public Builder(LiveConfiguration cfg)
      Create a new builder starting with the value from the given configuration
      Parameters:
      cfg - The configuration
  • Method Details

    • customUtcTimingElement

      public LiveConfiguration.Builder customUtcTimingElement(CustomUtcTimingElement customUtcTimingElement)
      Custom CustomUtcTimingElement. This is used for live DASH content. If this is informed and forced with CustomUtcTimingElement.force it will take prevalence over any other UtcTimingElement present in the DASH manifest. If force is false, it will be used as a fallback.
      Parameters:
      customUtcTimingElement - UtcTimingElement to set
      Returns:
      Builder instance
    • liveEdgeLatencyMs

      public LiveConfiguration.Builder liveEdgeLatencyMs(int liveEdgeLatencyMs)
      Defines the number of milliseconds that the playback should lag behind the "live edge" (i.e. the end of the most recently defined media in the manifest). Choosing a small value will minimize latency introduced by the player. Hence a small value may increase the probability of rebuffering and playback failures.

      When the key is not set then the manifest specified value is used or otherwise the default value SdkConsts.DEFAULT_LIVE_EDGE_LATENCY_MS

      Note that to start the live stream at a different position you should use SdkConsts.INTENT_POSITION_TO_PLAY, for instance if you have an event stream with a large seek window and you do not want to start at the live edge but further behind.

      For HLS streams, this setting takes precedence over hlsLiveTailSegmentIndex(int) if both are informed.

      Parameters:
      liveEdgeLatencyMs - latency to set in milliseconds
      Returns:
      Builder instance
    • hlsLiveTailSegmentIndex

      public LiveConfiguration.Builder hlsLiveTailSegmentIndex(int hlsLiveTailSegmentIndex)
      Defines the HLS segment index counting from the tail from which the live playback should start. Should be larger or equal to 0. In case the value goes out of the segment size boundaries the very first segment counting from the segments head is used.

      If this value is used to calculate the starting position, it will always result in playback starting at a segment boundary and thus snapToSegmentStart(boolean) will have no effect.

      If liveEdgeLatencyMs(int) is also set this value will be ignored.

      Parameters:
      hlsLiveTailSegmentIndex - The HLS live tail segment index
      Returns:
      Builder instance
    • hlsPlaylistUpdateTargetDurationCoefficient

      public LiveConfiguration.Builder hlsPlaylistUpdateTargetDurationCoefficient(float hlsPlaylistUpdateTargetDurationCoefficient, boolean hlsForcePlaylistUpdateTargetDuration)
      Defines the default coefficient applied to playlist update interval when calculating the playlist update interval. Applied when the currently loaded playlist is not renewed or unconditionally when forced.
      Parameters:
      hlsPlaylistUpdateTargetDurationCoefficient - The target duration coefficient for playlist update interval.
      hlsForcePlaylistUpdateTargetDuration - Whether to force the target duration coefficient when defining the playlist update interval
      Returns:
      Builder instance
    • catchupConfiguration

      public LiveConfiguration.Builder catchupConfiguration(@Nullable CatchupConfiguration catchupConfiguration)
      Defines the catchup configuration
      Parameters:
      catchupConfiguration - Catchup configuration
      Returns:
      Builder instance
    • minManifestUpdatePeriodMs

      public LiveConfiguration.Builder minManifestUpdatePeriodMs(long minManifestUpdatePeriodMs)
      Set a forced manifest update period for DASH Manifests and ignore the default value specified in the manifest. Please note that this is for DASH content exclusively. The HLS update interval can be changed with hlsPlaylistUpdateTargetDurationCoefficient(float, boolean).
      Parameters:
      minManifestUpdatePeriodMs - The forced min manifest update period in milliseconds.
      Returns:
      Builder Interface
    • snapToSegmentStart

      public LiveConfiguration.Builder snapToSegmentStart(boolean snapToSegmentStart)
      Usually live streams start at the the start of a segment. Set this to false to permit live streams to start in a segment relative to the current device time. This is usually relevant for ultra low latency streams.

      Does not apply for live HLS streams when defining the starting position through hlsLiveTailSegmentIndex(int).

      Parameters:
      snapToSegmentStart - Snap to segment start
      Returns:
      Builder Instance
    • availabilityStartTimeOffsetOverwriteMs

      public LiveConfiguration.Builder availabilityStartTimeOffsetOverwriteMs(long availabilityStartTimeOffsetOverwriteMs)
      For ultra low latency streams, set or overwrite the availability start time offset.
      Parameters:
      availabilityStartTimeOffsetOverwriteMs - The offset or C.TIME_UNSET
      Returns:
      Builder Instance
    • timesyncSafetyMs

      public LiveConfiguration.Builder timesyncSafetyMs(long timesyncSafetyMs)
      Set the time sync safety to deal with inaccurate time syncs by adjusting the calculated server time. This can be used to shift the current device time forward or backward relative to actual UTC time.
      Parameters:
      timesyncSafetyMs - The time sync safety
      Returns:
      Builder Instance
    • notifyManifestIntervalMs

      public LiveConfiguration.Builder notifyManifestIntervalMs(int notifyManifestIntervalMs)
      Set the manifest notify interval in milliseconds. This only applies for implicit live DASH manifests. It represents the time in between internal Timeline representation updates when manifest updates are not required. Might be particularly helpful for low latency streams. Default is 5000 ms.
      Parameters:
      notifyManifestIntervalMs - the manifest notify interval in milliseconds
      Returns:
      Builder instance
    • get

      public LiveConfiguration get()
      Builds the instance
      Returns:
      an instance of LiveConfiguration