revert: remove proxy apk at mediamtx

This commit is contained in:
Marlon 2026-09-25 09:02:14 -05:00
parent bea09b691d
commit 01681a33d4

View file

@ -858,27 +858,22 @@ class PttAudioClient @Inject constructor(
suppliedUrl: String?,
fallbackPath: String
): String {
if (suppliedUrl.isNullOrBlank()) {
return "$MEDIA_BASE_URL/$fallbackPath"
}
// Rails (BROWSER_PROXY) envía "/media-mtx/ptt/u/:id/whip".
// MediaMTX espera "http://host:8889/ptt/u/:id/whip" (sin prefijo media-mtx).
val raw = suppliedUrl.trim()
return when {
raw.startsWith("http://") || raw.startsWith("https://") -> {
if (raw.contains("/media-mtx/")) {
"$MEDIA_BASE_URL/" + raw.substringAfter("/media-mtx/").trimStart('/')
} else {
raw
}
}
suppliedUrl.startsWith(
"http://"
) ||
suppliedUrl.startsWith(
"https://"
) -> suppliedUrl
else -> {
val path = raw.trimStart('/').removePrefix("media-mtx/")
"$MEDIA_BASE_URL/$path"
}
else ->
"$MEDIA_BASE_URL/" +
suppliedUrl.trimStart('/')
}
}