Skip to content

Commit

Permalink
feat(player): set a null video options will clear the list of video i…
Browse files Browse the repository at this point in the history
…tems
  • Loading branch information
ThibaultBee committed Nov 9, 2023
1 parent 0494f7f commit 26e5f8a
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,17 @@ constructor(
var videoOptions: VideoOptions?
get() = exoplayer.currentVideoOptions
set(value) {
value?.let {
mediaSourceFactory = ApiVideoExoPlayerMediaFactory(it) { error ->
if (value != null) {
mediaSourceFactory = ApiVideoExoPlayerMediaFactory(value) { error ->
listeners.forEach { listener ->
listener.onError(error)
}
}.apply {
exoplayer.setMediaSource(this)
}
} ?: throw IllegalArgumentException("VideoOptions cannot be null")
} else {
exoplayer.clearMediaItems()
}
}

private val exoplayerListener: AnalyticsListener = object : AnalyticsListener {
Expand Down

0 comments on commit 26e5f8a

Please sign in to comment.