VideoView.kt加上重試時的狀態

This commit is contained in:
Raymond Yang 2023-03-09 14:59:52 +08:00
parent 07afc01354
commit 0ffafcbaf7

View File

@ -40,7 +40,11 @@ class VideoView : ConstraintLayout, GstCallback {
var isLoading: Boolean = false
set(value) {
view.pbLoading.isVisible = value
view.pbLoading.isVisible = if (retryCount in 1..5) {
true
} else {
value
}
field = value
}
@ -176,8 +180,10 @@ class VideoView : ConstraintLayout, GstCallback {
if (retryCount != RETRY_OFF && retryCount in 0 until 5) {
mHandler.post(retryRunnable)
retryCount++
isLoading = true
} else {
stopRetryCount()
isLoading = false
Log.e("${TAG}_$tag", "Retry count = 5, stopped retry...")
}
}