Amphitheatre
Amphitheatre copied to clipboard
isVideoFile needs to work for capitalized file types as well
This was a frustrating issue that came up while debugging.
VideoUtils.isVideoFile
works fine if the extension is lowercase, like .mov
or .vob
. When the extension is capitalized, like .VOB
for some reason, the method returns false. This is obviously incorrect.
Below is the fixed method
public static boolean isVideoFile(String s) {
String[] fileTypes = new String[]{".3gp", ".aaf.", "mp4", ".ts", ".webm", ".m4v", ".mkv", ".divx", ".xvid", ".rec", ".avi", ".flv", ".f4v", ".moi", ".mpeg", ".mpg", /*".mts", ".m2ts",*/ ".ogv", ".rm", ".rmvb", ".mov", ".wmv", /*".iso",*/ ".vob", ".ifo", ".wtv", ".pyv", ".ogm", /*".img"*/};
int count = fileTypes.length;
for (int i = 0; i < count; i++)
if (s.toLowerCase().endsWith(fileTypes[i]))
return true;
return false;
}