Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec360cf303 | ||
|
|
3c1a323b35 | ||
|
|
e34323c2da |
2
.env
2
.env
@@ -1,4 +1,4 @@
|
|||||||
GITEA_TOKEN=7921aa22187b39125d29399d26f527ba26a2fb5b
|
GITEA_TOKEN=efeed2af00597883adb04da70bd6a7c2993ae92d
|
||||||
GEMINI_API_KEY=AIzaSyDWOgyAJqscuPU6iSpS6gxupWBm4soNw5o
|
GEMINI_API_KEY=AIzaSyDWOgyAJqscuPU6iSpS6gxupWBm4soNw5o
|
||||||
TELEGRAM_BOT_TOKEN=8593525164:AAGCX9B_RJGN35_F7tSB72rEZhS_4Zpcszs
|
TELEGRAM_BOT_TOKEN=8593525164:AAGCX9B_RJGN35_F7tSB72rEZhS_4Zpcszs
|
||||||
TELEGRAM_CHAT_ID=692714536
|
TELEGRAM_CHAT_ID=692714536
|
||||||
|
|||||||
26
CHANGELOG-v10.1.3.md
Normal file
26
CHANGELOG-v10.1.3.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# StreamPlayer v10.1.3
|
||||||
|
|
||||||
|
## Cambios en esta versión
|
||||||
|
|
||||||
|
### Corrección de Carga de Eventos
|
||||||
|
|
||||||
|
- **Sistema de fallback con múltiples URLs**: Implementado sistema inteligente que intenta múltiples URLs de eventos cuando la principal no está disponible:
|
||||||
|
- `https://streamtpcloud.com/eventos.json` (URL original)
|
||||||
|
- `https://streamtp10.com/eventos.json` (URL actual)
|
||||||
|
- `https://streamtpmedia.com/eventos.json` (URL anterior)
|
||||||
|
|
||||||
|
- **Seguimiento automático de redirecciones HTTP**: El cliente ahora sigue automáticamente las redirecciones HTTP (códigos 301, 302, 303, 307, 308), lo que permite adaptarse a cambios de URL del servidor sin necesidad de actualizar la app.
|
||||||
|
|
||||||
|
- **Memoria de URL exitosa**: La app recuerda cuál fue la última URL que funcionó correctamente y la intenta primero en futuras peticiones, mejorando el rendimiento y la fiabilidad.
|
||||||
|
|
||||||
|
### Detalles Técnicos
|
||||||
|
|
||||||
|
- Modificado `EventRepository.java` para implementar:
|
||||||
|
- Lógica de reintento secuencial con múltiples URLs
|
||||||
|
- Seguimiento manual de redirecciones (hasta 5 consecutivas)
|
||||||
|
- Persistencia de la última URL exitosa en SharedPreferences
|
||||||
|
- Manejo mejorado de errores con mensajes descriptivos
|
||||||
|
|
||||||
|
### Problema Resuelto
|
||||||
|
|
||||||
|
Esta versión corrige el error: *"Unable to resolve host 'streamtpcloud.com': No address associated with hostname"* que ocurría cuando el servidor de eventos cambió su dominio. La app ahora se adapta automáticamente a estos cambios sin intervención del usuario.
|
||||||
@@ -8,8 +8,8 @@ android {
|
|||||||
applicationId "com.streamplayer"
|
applicationId "com.streamplayer"
|
||||||
minSdk 21
|
minSdk 21
|
||||||
targetSdk 35
|
targetSdk 35
|
||||||
versionCode 100100
|
versionCode 100102
|
||||||
versionName "10.1.0"
|
versionName "10.1.2"
|
||||||
buildConfigField "String", "DEVICE_REGISTRY_URL", '"http://194.163.191.200:4000"'
|
buildConfigField "String", "DEVICE_REGISTRY_URL", '"http://194.163.191.200:4000"'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,17 @@ public class EventRepository {
|
|||||||
private static final String PREFS_NAME = "events_cache";
|
private static final String PREFS_NAME = "events_cache";
|
||||||
private static final String KEY_JSON = "json";
|
private static final String KEY_JSON = "json";
|
||||||
private static final String KEY_TIMESTAMP = "timestamp";
|
private static final String KEY_TIMESTAMP = "timestamp";
|
||||||
|
private static final String KEY_WORKING_URL = "working_url";
|
||||||
private static final long CACHE_DURATION = 24L * 60 * 60 * 1000; // 24 horas
|
private static final long CACHE_DURATION = 24L * 60 * 60 * 1000; // 24 horas
|
||||||
private static final String EVENTS_URL = "https://streamtpcloud.com/eventos.json";
|
|
||||||
|
// Lista de URLs a intentar en orden (con sistema de fallback)
|
||||||
|
private static final String[] EVENT_URLS = {
|
||||||
|
"https://streamtpcloud.com/eventos.json", // URL original
|
||||||
|
"https://streamtp10.com/eventos.json", // URL actual
|
||||||
|
"https://streamtpmedia.com/eventos.json" // URL anterior
|
||||||
|
};
|
||||||
|
|
||||||
|
private static final String DEFAULT_EVENTS_URL = "https://streamtpcloud.com/eventos.json";
|
||||||
|
|
||||||
public interface Callback {
|
public interface Callback {
|
||||||
void onSuccess(List<EventItem> events);
|
void onSuccess(List<EventItem> events);
|
||||||
@@ -55,7 +64,7 @@ public class EventRepository {
|
|||||||
|
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
String json = downloadJson();
|
String json = downloadJson(context);
|
||||||
List<EventItem> events = parseEvents(json);
|
List<EventItem> events = parseEvents(json);
|
||||||
prefs.edit().putString(KEY_JSON, json).putLong(KEY_TIMESTAMP, System.currentTimeMillis()).apply();
|
prefs.edit().putString(KEY_JSON, json).putLong(KEY_TIMESTAMP, System.currentTimeMillis()).apply();
|
||||||
callback.onSuccess(events);
|
callback.onSuccess(events);
|
||||||
@@ -73,27 +82,103 @@ public class EventRepository {
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String downloadJson() throws IOException {
|
private String downloadJson(Context context) throws IOException {
|
||||||
URL url = new URL(EVENTS_URL);
|
SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
|
||||||
|
String savedWorkingUrl = prefs.getString(KEY_WORKING_URL, null);
|
||||||
|
|
||||||
|
// Construir lista de URLs a intentar
|
||||||
|
// Primero la URL que funcionó la última vez, luego el resto
|
||||||
|
List<String> urlsToTry = new ArrayList<>();
|
||||||
|
if (savedWorkingUrl != null && !savedWorkingUrl.isEmpty()) {
|
||||||
|
urlsToTry.add(savedWorkingUrl);
|
||||||
|
}
|
||||||
|
for (String url : EVENT_URLS) {
|
||||||
|
if (!urlsToTry.contains(url)) {
|
||||||
|
urlsToTry.add(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IOException lastException = null;
|
||||||
|
|
||||||
|
// Intentar cada URL en orden
|
||||||
|
for (String urlString : urlsToTry) {
|
||||||
|
try {
|
||||||
|
String json = downloadFromUrl(urlString);
|
||||||
|
// Guardar la URL que funcionó
|
||||||
|
prefs.edit().putString(KEY_WORKING_URL, urlString).apply();
|
||||||
|
return json;
|
||||||
|
} catch (IOException e) {
|
||||||
|
lastException = e;
|
||||||
|
// Continuar con la siguiente URL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Si todas fallaron, lanzar la última excepción
|
||||||
|
throw new IOException("No se pudo conectar a ninguna de las URLs disponibles. Último error: " +
|
||||||
|
(lastException != null ? lastException.getMessage() : "Error desconocido"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String downloadFromUrl(String urlString) throws IOException {
|
||||||
|
URL url = new URL(urlString);
|
||||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||||
connection.setConnectTimeout(15000);
|
connection.setConnectTimeout(15000);
|
||||||
connection.setReadTimeout(15000);
|
connection.setReadTimeout(15000);
|
||||||
connection.setRequestMethod("GET");
|
connection.setRequestMethod("GET");
|
||||||
connection.setRequestProperty("Accept", "application/json");
|
connection.setRequestProperty("Accept", "application/json");
|
||||||
connection.setRequestProperty("User-Agent", "StreamPlayer/1.0");
|
connection.setRequestProperty("User-Agent", "StreamPlayer/1.0");
|
||||||
|
|
||||||
|
// Habilitar seguimiento de redirecciones automáticamente
|
||||||
|
connection.setInstanceFollowRedirects(true);
|
||||||
|
|
||||||
|
String currentUrl = urlString;
|
||||||
|
int redirectCount = 0;
|
||||||
|
final int MAX_REDIRECTS = 5;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int responseCode = connection.getResponseCode();
|
int responseCode = connection.getResponseCode();
|
||||||
|
|
||||||
|
// Seguir redirecciones manualmente si es necesario
|
||||||
|
while (isRedirect(responseCode) && redirectCount < MAX_REDIRECTS) {
|
||||||
|
redirectCount++;
|
||||||
|
String newUrl = connection.getHeaderField("Location");
|
||||||
|
|
||||||
|
if (newUrl == null) {
|
||||||
|
throw new IOException("Redirección sin cabecera Location");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Manejar URLs relativas
|
||||||
|
if (newUrl.startsWith("/")) {
|
||||||
|
newUrl = url.getProtocol() + "://" + url.getHost() + newUrl;
|
||||||
|
} else if (!newUrl.startsWith("http")) {
|
||||||
|
newUrl = url.getProtocol() + "://" + url.getHost() +
|
||||||
|
(url.getPort() > 0 ? ":" + url.getPort() : "") + "/" + newUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentUrl = newUrl;
|
||||||
|
url = new URL(currentUrl);
|
||||||
|
connection.disconnect();
|
||||||
|
|
||||||
|
connection = (HttpURLConnection) url.openConnection();
|
||||||
|
connection.setConnectTimeout(15000);
|
||||||
|
connection.setReadTimeout(15000);
|
||||||
|
connection.setRequestMethod("GET");
|
||||||
|
connection.setRequestProperty("Accept", "application/json");
|
||||||
|
connection.setRequestProperty("User-Agent", "StreamPlayer/1.0");
|
||||||
|
connection.setInstanceFollowRedirects(true);
|
||||||
|
|
||||||
|
responseCode = connection.getResponseCode();
|
||||||
|
}
|
||||||
|
|
||||||
if (responseCode != HttpURLConnection.HTTP_OK) {
|
if (responseCode != HttpURLConnection.HTTP_OK) {
|
||||||
throw new IOException("Error HTTP " + responseCode + ": " + connection.getResponseMessage());
|
throw new IOException("Error HTTP " + responseCode + ": " + connection.getResponseMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
String contentType = connection.getContentType();
|
String contentType = connection.getContentType();
|
||||||
// Permitir json o text/plain (Raw de Gitea a veces es text/plain)
|
// Permitir json o text/plain (Raw de Gitea a veces es text/plain)
|
||||||
if (contentType != null && !contentType.contains("json") && !contentType.contains("text/plain")) {
|
if (contentType != null && !contentType.contains("json") && !contentType.contains("text/plain")) {
|
||||||
throw new IOException("El servidor devolvió " + contentType + " en lugar de JSON. Verifica que la URL sea correcta.");
|
throw new IOException("El servidor devolvió " + contentType + " en lugar de JSON. Verifica que la URL sea correcta.");
|
||||||
}
|
}
|
||||||
|
|
||||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
|
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
String line;
|
String line;
|
||||||
@@ -101,12 +186,12 @@ public class EventRepository {
|
|||||||
builder.append(line);
|
builder.append(line);
|
||||||
}
|
}
|
||||||
String response = builder.toString();
|
String response = builder.toString();
|
||||||
|
|
||||||
// Validar que no sea HTML
|
// Validar que no sea HTML
|
||||||
if (response.trim().startsWith("<!") || response.trim().startsWith("<html")) {
|
if (response.trim().startsWith("<!") || response.trim().startsWith("<html")) {
|
||||||
throw new IOException("El servidor devolvió HTML en lugar de JSON. La URL del endpoint puede estar incorrecta o el servidor tiene problemas.");
|
throw new IOException("El servidor devolvió HTML en lugar de JSON. La URL del endpoint puede estar incorrecta o el servidor tiene problemas.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@@ -114,6 +199,14 @@ public class EventRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isRedirect(int statusCode) {
|
||||||
|
return statusCode == HttpURLConnection.HTTP_MOVED_PERM ||
|
||||||
|
statusCode == HttpURLConnection.HTTP_MOVED_TEMP ||
|
||||||
|
statusCode == HttpURLConnection.HTTP_SEE_OTHER ||
|
||||||
|
statusCode == 307 || // Temporary Redirect
|
||||||
|
statusCode == 308; // Permanent Redirect
|
||||||
|
}
|
||||||
|
|
||||||
private List<EventItem> parseEvents(String json) throws JSONException {
|
private List<EventItem> parseEvents(String json) throws JSONException {
|
||||||
if (json == null || json.trim().isEmpty()) {
|
if (json == null || json.trim().isEmpty()) {
|
||||||
throw new JSONException("La respuesta está vacía");
|
throw new JSONException("La respuesta está vacía");
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import android.content.Intent;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@@ -32,6 +33,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
private ProgressBar loadingIndicator;
|
private ProgressBar loadingIndicator;
|
||||||
private TextView messageView;
|
private TextView messageView;
|
||||||
private TextView contentTitle;
|
private TextView contentTitle;
|
||||||
|
private Button refreshButton;
|
||||||
|
|
||||||
private ChannelAdapter channelAdapter;
|
private ChannelAdapter channelAdapter;
|
||||||
private EventAdapter eventAdapter;
|
private EventAdapter eventAdapter;
|
||||||
@@ -57,6 +59,12 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
loadingIndicator = findViewById(R.id.loading_indicator);
|
loadingIndicator = findViewById(R.id.loading_indicator);
|
||||||
messageView = findViewById(R.id.message_view);
|
messageView = findViewById(R.id.message_view);
|
||||||
contentTitle = findViewById(R.id.content_title);
|
contentTitle = findViewById(R.id.content_title);
|
||||||
|
refreshButton = findViewById(R.id.refresh_button);
|
||||||
|
|
||||||
|
refreshButton.setOnClickListener(v -> {
|
||||||
|
loadEvents(true);
|
||||||
|
Toast.makeText(this, "Actualizando eventos...", Toast.LENGTH_SHORT).show();
|
||||||
|
});
|
||||||
|
|
||||||
channelAdapter = new ChannelAdapter(
|
channelAdapter = new ChannelAdapter(
|
||||||
channel -> openPlayer(channel.getName(), channel.getPageUrl()));
|
channel -> openPlayer(channel.getName(), channel.getPageUrl()));
|
||||||
@@ -158,6 +166,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void showChannels(SectionEntry section) {
|
private void showChannels(SectionEntry section) {
|
||||||
contentTitle.setText(section.title);
|
contentTitle.setText(section.title);
|
||||||
|
refreshButton.setVisibility(View.GONE);
|
||||||
contentList.setLayoutManager(channelLayoutManager);
|
contentList.setLayoutManager(channelLayoutManager);
|
||||||
contentList.setAdapter(channelAdapter);
|
contentList.setAdapter(channelAdapter);
|
||||||
loadingIndicator.setVisibility(View.GONE);
|
loadingIndicator.setVisibility(View.GONE);
|
||||||
@@ -173,6 +182,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void showEvents() {
|
private void showEvents() {
|
||||||
contentTitle.setText(currentSection != null ? currentSection.title : getString(R.string.section_events));
|
contentTitle.setText(currentSection != null ? currentSection.title : getString(R.string.section_events));
|
||||||
|
refreshButton.setVisibility(View.VISIBLE);
|
||||||
contentList.setLayoutManager(eventLayoutManager);
|
contentList.setLayoutManager(eventLayoutManager);
|
||||||
contentList.setAdapter(eventAdapter);
|
contentList.setAdapter(eventAdapter);
|
||||||
if (cachedEvents.isEmpty()) {
|
if (cachedEvents.isEmpty()) {
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ public class PlayerActivity extends AppCompatActivity {
|
|||||||
private String channelUrl;
|
private String channelUrl;
|
||||||
private boolean overlayVisible = true;
|
private boolean overlayVisible = true;
|
||||||
private OkHttpClient okHttpClient;
|
private OkHttpClient okHttpClient;
|
||||||
|
private int retryCount = 0;
|
||||||
|
private static final int MAX_RETRIES = 3;
|
||||||
|
private String lastStreamUrl;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -102,6 +105,7 @@ public class PlayerActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private void loadChannel() {
|
private void loadChannel() {
|
||||||
showLoading(true);
|
showLoading(true);
|
||||||
|
retryCount = 0; // Resetear contador al cargar nuevo canal
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
String resolvedUrl = StreamUrlResolver.resolve(channelUrl);
|
String resolvedUrl = StreamUrlResolver.resolve(channelUrl);
|
||||||
@@ -117,14 +121,17 @@ public class PlayerActivity extends AppCompatActivity {
|
|||||||
private void startPlayback(String streamUrl) {
|
private void startPlayback(String streamUrl) {
|
||||||
try {
|
try {
|
||||||
releasePlayer();
|
releasePlayer();
|
||||||
|
lastStreamUrl = streamUrl; // Guardar URL para reintentos
|
||||||
|
retryCount = 0; // Resetear contador al iniciar nueva reproducción
|
||||||
DefaultRenderersFactory renderersFactory = new DefaultRenderersFactory(this)
|
DefaultRenderersFactory renderersFactory = new DefaultRenderersFactory(this)
|
||||||
.setEnableDecoderFallback(true)
|
.setEnableDecoderFallback(true)
|
||||||
.setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_ON);
|
.setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_ON);
|
||||||
|
|
||||||
// Configurar track selector para máxima calidad
|
// Configurar track selector para calidad adaptativa (no forzar máxima calidad)
|
||||||
trackSelector = new DefaultTrackSelector(this);
|
trackSelector = new DefaultTrackSelector(this);
|
||||||
DefaultTrackSelector.Parameters params = trackSelector.buildUponParameters()
|
DefaultTrackSelector.Parameters params = trackSelector.buildUponParameters()
|
||||||
.setForceHighestSupportedBitrate(true) // Forzar máximo bitrate
|
.setForceHighestSupportedBitrate(false) // Permitir calidad adaptativa
|
||||||
|
.setMaxVideoBitrate(Integer.MAX_VALUE) // Sin límite máximo de bitrate
|
||||||
.build();
|
.build();
|
||||||
trackSelector.setParameters(params);
|
trackSelector.setParameters(params);
|
||||||
|
|
||||||
@@ -140,6 +147,7 @@ public class PlayerActivity extends AppCompatActivity {
|
|||||||
public void onPlaybackStateChanged(int playbackState) {
|
public void onPlaybackStateChanged(int playbackState) {
|
||||||
if (playbackState == Player.STATE_READY) {
|
if (playbackState == Player.STATE_READY) {
|
||||||
showLoading(false);
|
showLoading(false);
|
||||||
|
retryCount = 0; // Resetear contador de reintentos al reproducir exitosamente
|
||||||
} else if (playbackState == Player.STATE_BUFFERING) {
|
} else if (playbackState == Player.STATE_BUFFERING) {
|
||||||
showLoading(true);
|
showLoading(true);
|
||||||
}
|
}
|
||||||
@@ -147,9 +155,46 @@ public class PlayerActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerError(PlaybackException error) {
|
public void onPlayerError(PlaybackException error) {
|
||||||
String detail = error.getCause() != null ?
|
String errorMsg = error.getMessage() != null ? error.getMessage() : "";
|
||||||
|
String detail = error.getCause() != null ?
|
||||||
error.getCause().getMessage() : "";
|
error.getCause().getMessage() : "";
|
||||||
showError("Error al reproducir: " + error.getMessage() + " " + detail);
|
String fullError = errorMsg + " " + detail;
|
||||||
|
|
||||||
|
// Verificar si es un error que justifica reintento (404, conectividad, etc.)
|
||||||
|
boolean isRetryableError =
|
||||||
|
fullError.contains("404") ||
|
||||||
|
fullError.contains("403") ||
|
||||||
|
fullError.contains("timeout") ||
|
||||||
|
fullError.contains("Unable to connect") ||
|
||||||
|
fullError.contains("Network") ||
|
||||||
|
fullError.contains("source error") ||
|
||||||
|
error.errorCode == PlaybackException.ERROR_CODE_IO_NETWORK_CONNECTION_FAILED ||
|
||||||
|
error.errorCode == PlaybackException.ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT ||
|
||||||
|
error.errorCode == PlaybackException.ERROR_CODE_IO_BAD_HTTP_STATUS;
|
||||||
|
|
||||||
|
if (isRetryableError && retryCount < MAX_RETRIES) {
|
||||||
|
retryCount++;
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
showLoading(true);
|
||||||
|
showError("Error de conexión. Reintentando... (" + retryCount + "/" + MAX_RETRIES + ")");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Reintentar después de 2 segundos
|
||||||
|
new android.os.Handler(android.os.Looper.getMainLooper()).postDelayed(() -> {
|
||||||
|
if (lastStreamUrl != null) {
|
||||||
|
startPlayback(lastStreamUrl);
|
||||||
|
} else {
|
||||||
|
loadChannel();
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
|
} else {
|
||||||
|
// Mostrar error final después de agotar reintentos
|
||||||
|
String finalMessage = "Error al reproducir: " + fullError;
|
||||||
|
if (retryCount >= MAX_RETRIES) {
|
||||||
|
finalMessage += "\n\nSe agotaron los reintentos (" + MAX_RETRIES + ").";
|
||||||
|
}
|
||||||
|
showError(finalMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -210,8 +255,8 @@ public class PlayerActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
OkHttpClient bootstrap = new OkHttpClient.Builder()
|
OkHttpClient bootstrap = new OkHttpClient.Builder()
|
||||||
.connectTimeout(15, TimeUnit.SECONDS)
|
.connectTimeout(20, TimeUnit.SECONDS)
|
||||||
.readTimeout(15, TimeUnit.SECONDS)
|
.readTimeout(30, TimeUnit.SECONDS)
|
||||||
.retryOnConnectionFailure(true)
|
.retryOnConnectionFailure(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -228,8 +273,8 @@ public class PlayerActivity extends AppCompatActivity {
|
|||||||
.build();
|
.build();
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
okHttpClient = new OkHttpClient.Builder()
|
okHttpClient = new OkHttpClient.Builder()
|
||||||
.connectTimeout(15, TimeUnit.SECONDS)
|
.connectTimeout(20, TimeUnit.SECONDS)
|
||||||
.readTimeout(15, TimeUnit.SECONDS)
|
.readTimeout(30, TimeUnit.SECONDS)
|
||||||
.retryOnConnectionFailure(true)
|
.retryOnConnectionFailure(true)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,14 +72,34 @@
|
|||||||
app:layout_constraintStart_toEndOf="@id/divider"
|
app:layout_constraintStart_toEndOf="@id/divider"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/content_title"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="@color/white"
|
android:orientation="horizontal"
|
||||||
android:textSize="18sp"
|
android:gravity="center_vertical">
|
||||||
android:textStyle="bold"
|
|
||||||
tools:text="Canales" />
|
<TextView
|
||||||
|
android:id="@+id/content_title"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:text="Canales" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/refresh_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:text="@string/action_refresh"
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:focusable="true"
|
||||||
|
android:focusableInTouchMode="true" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/loading_indicator"
|
android:id="@+id/loading_indicator"
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
<string name="section_all_channels">Todos los canales</string>
|
<string name="section_all_channels">Todos los canales</string>
|
||||||
<string name="message_no_channels">No hay canales disponibles</string>
|
<string name="message_no_channels">No hay canales disponibles</string>
|
||||||
<string name="message_no_events">No hay eventos disponibles</string>
|
<string name="message_no_events">No hay eventos disponibles</string>
|
||||||
|
<string name="action_refresh">Actualizar</string>
|
||||||
<string name="message_events_error">No se pudieron cargar los eventos: %1$s</string>
|
<string name="message_events_error">No se pudieron cargar los eventos: %1$s</string>
|
||||||
<string name="update_required_title">Actualización obligatoria</string>
|
<string name="update_required_title">Actualización obligatoria</string>
|
||||||
<string name="update_available_title">Actualización disponible</string>
|
<string name="update_available_title">Actualización disponible</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user