@@ -27,6 +27,7 @@ import ch.srgssr.pillarbox.player.monitoring.NoOp
27
27
import ch.srgssr.pillarbox.player.monitoring.Remote
28
28
import ch.srgssr.pillarbox.player.monitoring.Remote.config
29
29
import ch.srgssr.pillarbox.player.source.PillarboxMediaSourceFactory
30
+ import ch.srgssr.pillarbox.player.source.SeekableLiveConfig
30
31
import kotlinx.coroutines.CoroutineScope
31
32
import kotlinx.coroutines.Dispatchers
32
33
import okhttp3.OkHttpClient
@@ -65,7 +66,8 @@ abstract class PillarboxBuilder {
65
66
private var playbackLooper: Looper ? = null
66
67
private var seekBackwardIncrement: Duration = C .DEFAULT_SEEK_BACK_INCREMENT_MS .milliseconds
67
68
private var seekForwardIncrement: Duration = C .DEFAULT_SEEK_FORWARD_INCREMENT_MS .milliseconds
68
- private var preloadConfiguration = ExoPlayer .PreloadConfiguration .DEFAULT
69
+ private var preloadConfiguration: ExoPlayer .PreloadConfiguration = ExoPlayer .PreloadConfiguration .DEFAULT
70
+ private var seekableLiveConfig: SeekableLiveConfig = SeekableLiveConfig ()
69
71
70
72
/* *
71
73
* Registers a custom [AssetLoader] with the [PillarboxExoPlayer].
@@ -184,6 +186,15 @@ abstract class PillarboxBuilder {
184
186
this .playbackLooper = playbackLooper
185
187
}
186
188
189
+ /* *
190
+ * Sets the [SeekableLiveConfig] used by the player. It customizes the way the player considers a live is seekable or not.
191
+ *
192
+ * @param seekableLiveConfig The [SeekableLiveConfig] to be used by the player
193
+ */
194
+ fun seekableLiveConfig (seekableLiveConfig : SeekableLiveConfig ) {
195
+ this .seekableLiveConfig = seekableLiveConfig
196
+ }
197
+
187
198
/* *
188
199
* Sets the duration by which the player seeks backward when performing a "seek backward" operation.
189
200
*
@@ -237,7 +248,7 @@ abstract class PillarboxBuilder {
237
248
require(seekBackwardIncrement > ZERO ) { " Seek backward increment needs to be greater than zero" }
238
249
require(seekForwardIncrement > ZERO ) { " Seek forward increment needs to be greater than zero" }
239
250
240
- val mediaSourceFactory = PillarboxMediaSourceFactory (context)
251
+ val mediaSourceFactory = PillarboxMediaSourceFactory (context, seekableLiveConfig )
241
252
assetLoaders.forEach { assetLoader ->
242
253
mediaSourceFactory.addAssetLoader(assetLoader)
243
254
}
0 commit comments