import java.util.* private fun guessContentType(url: String): String? { var url = url url = url.lowercase(Locale.getDefault()) return if (url.endsWith(".webm")) { "video/webm" } else if (url.endsWith(".mp4")) { "video/mp4" } else if (url.matches(".*\\.jpe?g")) { "image/jpeg" } else if (url.endsWith(".png")) { "image/png" } else if (url.endsWith(".gif")) { "image/gif" } else { "application/octet-stream" } }
Guess a content type from the URL .