mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-23 17:26:18 +01:00
28 lines
808 B
Dart
28 lines
808 B
Dart
import 'package:nc_photos/entity/file.dart';
|
|
import 'package:nc_photos/platform/k.dart' as platform_k;
|
|
|
|
bool isSupportedFormat(File file) =>
|
|
_supportedFormatMimes.contains(file.contentType);
|
|
|
|
bool isSupportedImageFormat(File file) =>
|
|
isSupportedFormat(file) && file.contentType?.startsWith("image/") == true;
|
|
|
|
bool isSupportedVideoFormat(File file) =>
|
|
isSupportedFormat(file) && file.contentType?.startsWith("video/") == true;
|
|
|
|
bool isMetadataSupportedFormat(File file) =>
|
|
_metadataSupportedFormatMimes.contains(file.contentType);
|
|
|
|
const _supportedFormatMimes = [
|
|
"image/jpeg",
|
|
"image/png",
|
|
"image/webp",
|
|
"image/heic",
|
|
// video player currently doesn't work on web
|
|
if (!platform_k.isWeb) "video/mp4",
|
|
];
|
|
|
|
const _metadataSupportedFormatMimes = [
|
|
"image/jpeg",
|
|
"image/heic",
|
|
];
|