Skip to content

Commit

Permalink
[APT-10344] Initialization State Smoothness
Browse files Browse the repository at this point in the history
- Ensured that ArmadilloPlayer.armadilloStateObservable has a state as soon as the player is initialized
- Fixed UnknownHostException being mapped to a HTTP status code issue rather than a Connectivity issue.
  • Loading branch information
kabliz committed Sep 5, 2024
1 parent 79dda3d commit 163c577
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Armadillo/src/main/java/com/scribd/armadillo/StateStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ internal class ArmadilloStateStore(private val reducer: Reducer, private val han
const val TAG = "ArmadilloStateStore"
}

private val armadilloStateObservable = BehaviorSubject.create<ArmadilloState>()
private val armadilloStateObservable = BehaviorSubject.create<ArmadilloState>().also {
it.onNext(ArmadilloState(downloadInfo = emptyList()))
}

override fun init(state: ArmadilloState) = armadilloStateObservable.onNext(state)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.scribd.armadillo.error
import com.google.android.exoplayer2.upstream.HttpDataSource.HttpDataSourceException
import com.scribd.armadillo.actions.Action
import java.net.SocketTimeoutException
import java.net.UnknownHostException

sealed class ArmadilloException(cause: Throwable? = null,
isNetworkRelatedError: Boolean = false,
Expand Down Expand Up @@ -181,7 +182,7 @@ class DrmDownloadException(cause: Exception)
: ArmadilloException(
cause = cause,
message = "Failed to process DRM license for downloading.",
isNetworkRelatedError = (cause is HttpDataSourceException) || (cause is SocketTimeoutException)) {
isNetworkRelatedError = (cause is HttpDataSourceException) || (cause is SocketTimeoutException) || (cause is UnknownHostException)) {
override val errorCode = 701
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ internal fun ExoPlaybackException.toArmadilloException(): ArmadilloException {
val httpCause = source.cause as? HttpDataSource.InvalidResponseCodeException
HttpResponseCodeException(httpCause?.responseCode ?: 0, httpCause?.dataSpec?.uri.toString(), source)
}
is UnknownHostException,
is SocketTimeoutException -> ConnectivityException(source)
is UnknownHostException ->
HttpResponseCodeException(0, source.message, source) // Message is supposed to be the host for UnknownHostException
else -> ArmadilloIOException(cause = this, actionThatFailedMessage = "Exoplayer error.")
}
}
Expand Down
4 changes: 4 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Project Armadillo Release Notes

## 1.5.4
- Ensured that ArmadilloPlayer.armadilloStateObservable has a state as soon as the player is initialized
- Fixed UnknownHostException being mapped to a HTTP status code issue rather than a Connectivity issue.

## 1.5.3
- Attempts to renew the widevine license of downloaded DRM content when playback begins, similarly to how streaming does it.
- Fixes ANR issue in the Reducer.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ org.gradle.jvmargs=-Xmx1536m
# org.gradle.parallel=true
PACKAGE_NAME=com.scribd.armadillo
GRADLE_PLUGIN_VERSION=7.2.0
LIBRARY_VERSION=1.5.3
LIBRARY_VERSION=1.5.4
EXOPLAYER_VERSION=2.19.1
RXJAVA_VERSION=2.2.4
RXANDROID_VERSION=2.0.1
Expand Down

0 comments on commit 163c577

Please sign in to comment.