Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APT-10344] Initialization State Smoothness & Bugfix #42

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason this was mapped to an http exception was so that we could have the host in the error for tracking. Any way to add that here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exception appears in airplane mode, so it might not accurately reflect whether the host exists in DNS. Is it still valuable in that case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a good point. It's probably fine.

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
Loading