Compare commits

...

2 commits
v1.3.1 ... main

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('/')
}
}