List of usage examples for android.media MediaMetadataRetriever METADATA_KEY_MIMETYPE
int METADATA_KEY_MIMETYPE
To view the source code for android.media MediaMetadataRetriever METADATA_KEY_MIMETYPE.
Click Source Link
From source file:com.android.camera.manager.ThumbnailViewManager.java
private String getMimeType(String filePath) { MediaMetadataRetriever retriever = new MediaMetadataRetriever(); String mime = "image/jpeg"; if (filePath != null) { try {/*from w w w . j a v a 2 s .co m*/ retriever.setDataSource(filePath); mime = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_MIMETYPE); } catch (IllegalStateException e) { return mime; } catch (IllegalArgumentException e) { return mime; } catch (RuntimeException e) { return mime; } } Log.d(TAG, "[getMimeType] mime = " + mime); return mime; }
From source file:com.android.camera.v2.uimanager.ThumbnailManager.java
private String getMimeType(String filePath) { MediaMetadataRetriever retriever = new MediaMetadataRetriever(); String mime = "image/jpeg"; if (filePath != null) { try {/*from w w w. j a v a 2s.com*/ retriever.setDataSource(filePath); mime = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_MIMETYPE); } catch (IllegalStateException e) { return mime; } catch (IllegalArgumentException e) { return mime; } catch (RuntimeException e) { return mime; } } LogHelper.i(TAG, "[getMimeType] mime = " + mime); return mime; }