Release v1.1.0
This commit is contained in:
@@ -348,6 +348,15 @@ class PlayerActivity : FragmentActivity(), PlayerStateListener {
|
||||
override fun onPlayerError(error: PlaybackException) {
|
||||
Log.e(TAG, "Player error", error)
|
||||
|
||||
val rootCauseMessage = buildString {
|
||||
var current: Throwable? = error
|
||||
while (current != null) {
|
||||
if (isNotEmpty()) append(" | ")
|
||||
append(current.message.orEmpty())
|
||||
current = current.cause
|
||||
}
|
||||
}
|
||||
|
||||
val errorMessage = when (error.errorCode) {
|
||||
PlaybackException.ERROR_CODE_IO_NETWORK_CONNECTION_FAILED -> "Error de conexion a internet"
|
||||
PlaybackException.ERROR_CODE_PARSING_CONTAINER_MALFORMED,
|
||||
@@ -355,9 +364,21 @@ class PlayerActivity : FragmentActivity(), PlayerStateListener {
|
||||
PlaybackException.ERROR_CODE_IO_NO_PERMISSION -> "Sin permisos para acceder al stream"
|
||||
PlaybackException.ERROR_CODE_IO_BAD_HTTP_STATUS -> "Error HTTP: ${error.message}"
|
||||
PlaybackException.ERROR_CODE_BEHIND_LIVE_WINDOW -> "Stream en vivo no disponible"
|
||||
PlaybackException.ERROR_CODE_DRM_UNSPECIFIED,
|
||||
PlaybackException.ERROR_CODE_DRM_SCHEME_UNSUPPORTED,
|
||||
PlaybackException.ERROR_CODE_DRM_CONTENT_ERROR,
|
||||
PlaybackException.ERROR_CODE_DRM_SYSTEM_ERROR -> "Este stream usa un cifrado DRM que tu Chromecast no soporta. Proba otra opcion."
|
||||
else -> "Error de reproduccion: ${error.message}"
|
||||
}
|
||||
|
||||
if (rootCauseMessage.contains("ERROR_DRM_CANNOT_HANDLE", ignoreCase = true) ||
|
||||
rootCauseMessage.contains("selected encryption mode is not supported", ignoreCase = true) ||
|
||||
rootCauseMessage.contains("MissingSchemeDataException", ignoreCase = true)
|
||||
) {
|
||||
showError("Este stream usa un cifrado DRM que tu Chromecast no soporta. Proba otra opcion.")
|
||||
return
|
||||
}
|
||||
|
||||
showError(errorMessage)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user