静止画のmimeType判定の改善
This commit is contained in:
parent
462041f8b0
commit
11e3906f57
|
@ -263,10 +263,17 @@ fun String.mimeTypeIsSupported(instance: TootInstance) = when {
|
|||
}
|
||||
|
||||
fun Uri.resolveMimeType(mimeTypeArg: String?, context: Context): String? {
|
||||
// BitmapFactory で静止画の mimeType を調べる
|
||||
// image/j()pg だの image/j(e)pg だの、mime type を誤記するアプリがあまりに多い
|
||||
// application/octet-stream などが誤設定されてることもある
|
||||
bitmapMimeType(context.contentResolver)?.notEmpty()?.let { return it }
|
||||
|
||||
// GIFはそのまま通す
|
||||
if (mimeTypeArg == MIME_TYPE_GIF) return MIME_TYPE_GIF
|
||||
|
||||
// 動画ではないなら
|
||||
if (mimeTypeArg?.startsWith("video") != true) {
|
||||
// BitmapFactory で静止画の mimeType を調べる
|
||||
// image/j()pg だの image/j(e)pg だの、mime type を誤記するアプリがあまりに多い
|
||||
// application/octet-stream などが誤設定されてることもある
|
||||
bitmapMimeType(context.contentResolver)?.notEmpty()?.let { return it }
|
||||
}
|
||||
|
||||
// MediaMetadataRetriever で動画/音声の mimeType を調べる
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue