io.vov.vitamio.provider.MediaStore.Video Java Examples
The following examples show how to use
io.vov.vitamio.provider.MediaStore.Video.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MediaScanner.java From BambooPlayer with Apache License 2.0 | 6 votes |
private ContentValues toValues() { ContentValues map = new ContentValues(); map.put(MediaStore.MediaColumns.DATA, mPath); map.put(MediaStore.MediaColumns.DATE_MODIFIED, mLastModified); map.put(MediaStore.MediaColumns.SIZE, mFileSize); map.put(MediaStore.MediaColumns.MIME_TYPE, mMimeType); map.put(MediaStore.MediaColumns.TITLE, mTitle); if (MediaFile.isVideoFileType(mFileType)) { map.put(Video.Media.DURATION, mDuration); map.put(Video.Media.LANGUAGE, mLanguage); map.put(Video.Media.ALBUM, mAlbum); map.put(Video.Media.ARTIST, mArtist); map.put(Video.Media.WIDTH, mWidth); map.put(Video.Media.HEIGHT, mHeight); } return map; }
Example #2
Source File: MediaScanner.java From MyHearts with Apache License 2.0 | 6 votes |
private ContentValues toValues() { ContentValues map = new ContentValues(); map.put(MediaStore.MediaColumns.DATA, mPath); map.put(MediaStore.MediaColumns.DATE_MODIFIED, mLastModified); map.put(MediaStore.MediaColumns.SIZE, mFileSize); map.put(MediaStore.MediaColumns.MIME_TYPE, mMimeType); map.put(MediaStore.MediaColumns.TITLE, mTitle); if (MediaFile.isVideoFileType(mFileType)) { map.put(Video.Media.DURATION, mDuration); map.put(Video.Media.LANGUAGE, mLanguage); map.put(Video.Media.ALBUM, mAlbum); map.put(Video.Media.ARTIST, mArtist); map.put(Video.Media.WIDTH, mWidth); map.put(Video.Media.HEIGHT, mHeight); } return map; }
Example #3
Source File: MediaScanner.java From Vitamio with Apache License 2.0 | 6 votes |
private ContentValues toValues() { ContentValues map = new ContentValues(); map.put(MediaStore.MediaColumns.DATA, mPath); map.put(MediaStore.MediaColumns.DATE_MODIFIED, mLastModified); map.put(MediaStore.MediaColumns.SIZE, mFileSize); map.put(MediaStore.MediaColumns.MIME_TYPE, mMimeType); map.put(MediaStore.MediaColumns.TITLE, mTitle); if (MediaFile.isVideoFileType(mFileType)) { map.put(Video.Media.DURATION, mDuration); map.put(Video.Media.LANGUAGE, mLanguage); map.put(Video.Media.ALBUM, mAlbum); map.put(Video.Media.ARTIST, mArtist); map.put(Video.Media.WIDTH, mWidth); map.put(Video.Media.HEIGHT, mHeight); } return map; }
Example #4
Source File: MediaScanner.java From react-native-android-vitamio with MIT License | 6 votes |
private ContentValues toValues() { ContentValues map = new ContentValues(); map.put(MediaStore.MediaColumns.DATA, mPath); map.put(MediaStore.MediaColumns.DATE_MODIFIED, mLastModified); map.put(MediaStore.MediaColumns.SIZE, mFileSize); map.put(MediaStore.MediaColumns.MIME_TYPE, mMimeType); map.put(MediaStore.MediaColumns.TITLE, mTitle); if (MediaFile.isVideoFileType(mFileType)) { map.put(Video.Media.DURATION, mDuration); map.put(Video.Media.LANGUAGE, mLanguage); map.put(Video.Media.ALBUM, mAlbum); map.put(Video.Media.ARTIST, mArtist); map.put(Video.Media.WIDTH, mWidth); map.put(Video.Media.HEIGHT, mHeight); } return map; }
Example #5
Source File: MediaScanner.java From HPlayer with Apache License 2.0 | 6 votes |
private ContentValues toValues() { ContentValues map = new ContentValues(); map.put(MediaStore.MediaColumns.DATA, mPath); map.put(MediaStore.MediaColumns.DATE_MODIFIED, mLastModified); map.put(MediaStore.MediaColumns.SIZE, mFileSize); map.put(MediaStore.MediaColumns.MIME_TYPE, mMimeType); map.put(MediaStore.MediaColumns.TITLE, mTitle); if (MediaFile.isVideoFileType(mFileType)) { map.put(Video.Media.DURATION, mDuration); map.put(Video.Media.LANGUAGE, mLanguage); map.put(Video.Media.ALBUM, mAlbum); map.put(Video.Media.ARTIST, mArtist); map.put(Video.Media.WIDTH, mWidth); map.put(Video.Media.HEIGHT, mHeight); } return map; }
Example #6
Source File: MediaScanner.java From NetEasyNews with GNU General Public License v3.0 | 6 votes |
private ContentValues toValues() { ContentValues map = new ContentValues(); map.put(MediaStore.MediaColumns.DATA, mPath); map.put(MediaStore.MediaColumns.DATE_MODIFIED, mLastModified); map.put(MediaStore.MediaColumns.SIZE, mFileSize); map.put(MediaStore.MediaColumns.MIME_TYPE, mMimeType); map.put(MediaStore.MediaColumns.TITLE, mTitle); if (MediaFile.isVideoFileType(mFileType)) { map.put(Video.Media.DURATION, mDuration); map.put(Video.Media.LANGUAGE, mLanguage); map.put(Video.Media.ALBUM, mAlbum); map.put(Video.Media.ARTIST, mArtist); map.put(Video.Media.WIDTH, mWidth); map.put(Video.Media.HEIGHT, mHeight); } return map; }
Example #7
Source File: MediaScanner.java From video-player with MIT License | 6 votes |
private ContentValues toValues() { ContentValues map = new ContentValues(); map.put(MediaStore.MediaColumns.DATA, mPath); map.put(MediaStore.MediaColumns.DATE_MODIFIED, mLastModified); map.put(MediaStore.MediaColumns.SIZE, mFileSize); map.put(MediaStore.MediaColumns.MIME_TYPE, mMimeType); map.put(MediaStore.MediaColumns.TITLE, mTitle); if (MediaFile.isVideoFileType(mFileType)) { map.put(Video.Media.DURATION, mDuration); map.put(Video.Media.LANGUAGE, mLanguage); map.put(Video.Media.ALBUM, mAlbum); map.put(Video.Media.ARTIST, mArtist); map.put(Video.Media.WIDTH, mWidth); map.put(Video.Media.HEIGHT, mHeight); } return map; }
Example #8
Source File: MediaScanner.java From BambooPlayer with Apache License 2.0 | 5 votes |
public void addNoMediaFolder(String path) { ContentValues values = new ContentValues(); values.put(MediaStore.MediaColumns.DATA, ""); String[] pathSpec = new String[]{path + '%'}; try { mProvider.update(Video.Media.CONTENT_URI, values, MediaStore.MediaColumns.DATA + " LIKE ?", pathSpec); } catch (RemoteException e) { throw new RuntimeException(); } }
Example #9
Source File: MediaScanner.java From Vitamio with Apache License 2.0 | 5 votes |
public void addNoMediaFolder(String path) { ContentValues values = new ContentValues(); values.put(MediaStore.MediaColumns.DATA, ""); String[] pathSpec = new String[]{path + '%'}; try { mProvider.update(Video.Media.CONTENT_URI, values, MediaStore.MediaColumns.DATA + " LIKE ?", pathSpec); } catch (RemoteException e) { throw new RuntimeException(); } }
Example #10
Source File: MediaScanner.java From react-native-android-vitamio with MIT License | 5 votes |
public void addNoMediaFolder(String path) { ContentValues values = new ContentValues(); values.put(MediaStore.MediaColumns.DATA, ""); String[] pathSpec = new String[]{path + '%'}; try { mProvider.update(Video.Media.CONTENT_URI, values, MediaStore.MediaColumns.DATA + " LIKE ?", pathSpec); } catch (RemoteException e) { throw new RuntimeException(); } }
Example #11
Source File: MediaScanner.java From NetEasyNews with GNU General Public License v3.0 | 5 votes |
public void addNoMediaFolder(String path) { ContentValues values = new ContentValues(); values.put(MediaStore.MediaColumns.DATA, ""); String[] pathSpec = new String[]{path + '%'}; try { mProvider.update(Video.Media.CONTENT_URI, values, MediaStore.MediaColumns.DATA + " LIKE ?", pathSpec); } catch (RemoteException e) { throw new RuntimeException(); } }
Example #12
Source File: MediaScanner.java From video-player with MIT License | 5 votes |
public void addNoMediaFolder(String path) { ContentValues values = new ContentValues(); values.put(MediaStore.MediaColumns.DATA, ""); String[] pathSpec = new String[]{path + '%'}; try { mProvider.update(Video.Media.CONTENT_URI, values, MediaStore.MediaColumns.DATA + " LIKE ?", pathSpec); } catch (RemoteException e) { throw new RuntimeException(); } }
Example #13
Source File: MediaScanner.java From HPlayer with Apache License 2.0 | 5 votes |
public void addNoMediaFolder(String path) { ContentValues values = new ContentValues(); values.put(MediaStore.MediaColumns.DATA, ""); String[] pathSpec = new String[]{path + '%'}; try { mProvider.update(Video.Media.CONTENT_URI, values, MediaStore.MediaColumns.DATA + " LIKE ?", pathSpec); } catch (RemoteException e) { throw new RuntimeException(); } }
Example #14
Source File: MediaScanner.java From MyHearts with Apache License 2.0 | 5 votes |
public void addNoMediaFolder(String path) { ContentValues values = new ContentValues(); values.put(MediaStore.MediaColumns.DATA, ""); String[] pathSpec = new String[]{path + '%'}; try { mProvider.update(Video.Media.CONTENT_URI, values, MediaStore.MediaColumns.DATA + " LIKE ?", pathSpec); } catch (RemoteException e) { throw new RuntimeException(); } }
Example #15
Source File: MediaScanner.java From react-native-android-vitamio with MIT License | 4 votes |
private Uri endFile(FileCacheEntry entry) throws RemoteException { Uri tableUri; boolean isVideo = MediaFile.isVideoFileType(mFileType) && mWidth > 0 && mHeight > 0; if (isVideo) { tableUri = Video.Media.CONTENT_URI; } else { return null; } entry.mTableUri = tableUri; ContentValues values = toValues(); String title = values.getAsString(MediaStore.MediaColumns.TITLE); if (TextUtils.isEmpty(title)) { title = values.getAsString(MediaStore.MediaColumns.DATA); int lastSlash = title.lastIndexOf('/'); if (lastSlash >= 0) { lastSlash++; if (lastSlash < title.length()) title = title.substring(lastSlash); } int lastDot = title.lastIndexOf('.'); if (lastDot > 0) title = title.substring(0, lastDot); values.put(MediaStore.MediaColumns.TITLE, title); } long rowId = entry.mRowId; Uri result = null; if (rowId == 0) { result = mProvider.insert(tableUri, values); if (result != null) { rowId = ContentUris.parseId(result); entry.mRowId = rowId; } } else { result = ContentUris.withAppendedId(tableUri, rowId); mProvider.update(result, values, null, null); } return result; }
Example #16
Source File: MiniThumbFile.java From MyHearts with Apache License 2.0 | 4 votes |
private String randomAccessFilePath(int version) { String directoryName = Environment.getExternalStorageDirectory().toString() + "/" + Video.Thumbnails.THUMBNAILS_DIRECTORY; return directoryName + "/.thumbdata" + version + "-" + mUri.hashCode(); }
Example #17
Source File: MediaScanner.java From BambooPlayer with Apache License 2.0 | 4 votes |
private Uri endFile(FileCacheEntry entry) throws RemoteException { Uri tableUri; boolean isVideo = MediaFile.isVideoFileType(mFileType) && mWidth > 0 && mHeight > 0; if (isVideo) { tableUri = Video.Media.CONTENT_URI; } else { return null; } entry.mTableUri = tableUri; ContentValues values = toValues(); String title = values.getAsString(MediaStore.MediaColumns.TITLE); if (TextUtils.isEmpty(title)) { title = values.getAsString(MediaStore.MediaColumns.DATA); int lastSlash = title.lastIndexOf('/'); if (lastSlash >= 0) { lastSlash++; if (lastSlash < title.length()) title = title.substring(lastSlash); } int lastDot = title.lastIndexOf('.'); if (lastDot > 0) title = title.substring(0, lastDot); values.put(MediaStore.MediaColumns.TITLE, title); } long rowId = entry.mRowId; Uri result = null; if (rowId == 0) { result = mProvider.insert(tableUri, values); if (result != null) { rowId = ContentUris.parseId(result); entry.mRowId = rowId; } } else { result = ContentUris.withAppendedId(tableUri, rowId); mProvider.update(result, values, null, null); } return result; }
Example #18
Source File: MediaScanner.java From MyHearts with Apache License 2.0 | 4 votes |
private void prescan(String filePath) throws RemoteException { mProvider = mContext.getContentResolver().acquireContentProviderClient(MediaStore.AUTHORITY); Cursor c = null; String where = null; String[] selectionArgs = null; if (mFileCache == null) mFileCache = new HashMap<String, FileCacheEntry>(); else mFileCache.clear(); try { if (filePath != null) { where = Video.Media.DATA + "=?"; selectionArgs = new String[]{filePath}; } c = mProvider.query(Video.Media.CONTENT_URI, VIDEO_PROJECTION, where, selectionArgs, null); if (c != null) { try { while (c.moveToNext()) { long rowId = c.getLong(ID_VIDEO_COLUMN_INDEX); String path = c.getString(PATH_VIDEO_COLUMN_INDEX); long lastModified = c.getLong(DATE_MODIFIED_VIDEO_COLUMN_INDEX); if (path.startsWith("/")) { File tempFile = new File(path); if (!TextUtils.isEmpty(filePath) && !tempFile.exists()) { mProvider.delete(Video.Media.CONTENT_URI, where, selectionArgs); return; } path = FileUtils.getCanonical(tempFile); String key = mCaseInsensitivePaths ? path.toLowerCase() : path; mFileCache.put(key, new FileCacheEntry(Video.Media.CONTENT_URI, rowId, path, lastModified)); } } } finally { c.close(); c = null; } } } finally { if (c != null) { c.close(); } } }
Example #19
Source File: MediaScanner.java From BambooPlayer with Apache License 2.0 | 4 votes |
private void prescan(String filePath) throws RemoteException { mProvider = mContext.getContentResolver().acquireContentProviderClient(MediaStore.AUTHORITY); Cursor c = null; String where = null; String[] selectionArgs = null; if (mFileCache == null) mFileCache = new HashMap<String, FileCacheEntry>(); else mFileCache.clear(); try { if (filePath != null) { where = Video.Media.DATA + "=?"; selectionArgs = new String[]{filePath}; } c = mProvider.query(Video.Media.CONTENT_URI, VIDEO_PROJECTION, where, selectionArgs, null); if (c != null) { try { while (c.moveToNext()) { long rowId = c.getLong(ID_VIDEO_COLUMN_INDEX); String path = c.getString(PATH_VIDEO_COLUMN_INDEX); long lastModified = c.getLong(DATE_MODIFIED_VIDEO_COLUMN_INDEX); if (path.startsWith("/")) { File tempFile = new File(path); if (!TextUtils.isEmpty(filePath) && !tempFile.exists()) { mProvider.delete(Video.Media.CONTENT_URI, where, selectionArgs); return; } path = FileUtils.getCanonical(tempFile); String key = mCaseInsensitivePaths ? path.toLowerCase() : path; mFileCache.put(key, new FileCacheEntry(Video.Media.CONTENT_URI, rowId, path, lastModified)); } } } finally { c.close(); c = null; } } } finally { if (c != null) { c.close(); } } }
Example #20
Source File: MiniThumbFile.java From BambooPlayer with Apache License 2.0 | 4 votes |
private String randomAccessFilePath(int version) { String directoryName = Environment.getExternalStorageDirectory().toString() + "/" + Video.Thumbnails.THUMBNAILS_DIRECTORY; return directoryName + "/.thumbdata" + version + "-" + mUri.hashCode(); }
Example #21
Source File: MediaScanner.java From MyHearts with Apache License 2.0 | 4 votes |
private Uri endFile(FileCacheEntry entry) throws RemoteException { Uri tableUri; boolean isVideo = MediaFile.isVideoFileType(mFileType) && mWidth > 0 && mHeight > 0; if (isVideo) { tableUri = Video.Media.CONTENT_URI; } else { return null; } entry.mTableUri = tableUri; ContentValues values = toValues(); String title = values.getAsString(MediaStore.MediaColumns.TITLE); if (TextUtils.isEmpty(title)) { title = values.getAsString(MediaStore.MediaColumns.DATA); int lastSlash = title.lastIndexOf('/'); if (lastSlash >= 0) { lastSlash++; if (lastSlash < title.length()) title = title.substring(lastSlash); } int lastDot = title.lastIndexOf('.'); if (lastDot > 0) title = title.substring(0, lastDot); values.put(MediaStore.MediaColumns.TITLE, title); } long rowId = entry.mRowId; Uri result = null; if (rowId == 0) { result = mProvider.insert(tableUri, values); if (result != null) { rowId = ContentUris.parseId(result); entry.mRowId = rowId; } } else { result = ContentUris.withAppendedId(tableUri, rowId); mProvider.update(result, values, null, null); } return result; }
Example #22
Source File: MediaScanner.java From Vitamio with Apache License 2.0 | 4 votes |
private Uri endFile(FileCacheEntry entry) throws RemoteException { Uri tableUri; boolean isVideo = MediaFile.isVideoFileType(mFileType) && mWidth > 0 && mHeight > 0; if (isVideo) { tableUri = Video.Media.CONTENT_URI; } else { return null; } entry.mTableUri = tableUri; ContentValues values = toValues(); String title = values.getAsString(MediaStore.MediaColumns.TITLE); if (TextUtils.isEmpty(title)) { title = values.getAsString(MediaStore.MediaColumns.DATA); int lastSlash = title.lastIndexOf('/'); if (lastSlash >= 0) { lastSlash++; if (lastSlash < title.length()) title = title.substring(lastSlash); } int lastDot = title.lastIndexOf('.'); if (lastDot > 0) title = title.substring(0, lastDot); values.put(MediaStore.MediaColumns.TITLE, title); } long rowId = entry.mRowId; Uri result = null; if (rowId == 0) { result = mProvider.insert(tableUri, values); if (result != null) { rowId = ContentUris.parseId(result); entry.mRowId = rowId; } } else { result = ContentUris.withAppendedId(tableUri, rowId); mProvider.update(result, values, null, null); } return result; }
Example #23
Source File: MediaScanner.java From Vitamio with Apache License 2.0 | 4 votes |
private void prescan(String filePath) throws RemoteException { mProvider = mContext.getContentResolver().acquireContentProviderClient(MediaStore.AUTHORITY); Cursor c = null; String where = null; String[] selectionArgs = null; if (mFileCache == null) mFileCache = new HashMap<String, FileCacheEntry>(); else mFileCache.clear(); try { if (filePath != null) { where = Video.Media.DATA + "=?"; selectionArgs = new String[]{filePath}; } c = mProvider.query(Video.Media.CONTENT_URI, VIDEO_PROJECTION, where, selectionArgs, null); if (c != null) { try { while (c.moveToNext()) { long rowId = c.getLong(ID_VIDEO_COLUMN_INDEX); String path = c.getString(PATH_VIDEO_COLUMN_INDEX); long lastModified = c.getLong(DATE_MODIFIED_VIDEO_COLUMN_INDEX); if (path.startsWith("/")) { File tempFile = new File(path); if (!TextUtils.isEmpty(filePath) && !tempFile.exists()) { mProvider.delete(Video.Media.CONTENT_URI, where, selectionArgs); return; } path = FileUtils.getCanonical(tempFile); String key = mCaseInsensitivePaths ? path.toLowerCase() : path; mFileCache.put(key, new FileCacheEntry(Video.Media.CONTENT_URI, rowId, path, lastModified)); } } } finally { c.close(); c = null; } } } finally { if (c != null) { c.close(); } } }
Example #24
Source File: MiniThumbFile.java From Vitamio with Apache License 2.0 | 4 votes |
private String randomAccessFilePath(int version) { String directoryName = Environment.getExternalStorageDirectory().toString() + "/" + Video.Thumbnails.THUMBNAILS_DIRECTORY; return directoryName + "/.thumbdata" + version + "-" + mUri.hashCode(); }
Example #25
Source File: MiniThumbFile.java From HPlayer with Apache License 2.0 | 4 votes |
private String randomAccessFilePath(int version) { String directoryName = Environment.getExternalStorageDirectory().toString() + "/" + Video.Thumbnails.THUMBNAILS_DIRECTORY; return directoryName + "/.thumbdata" + version + "-" + mUri.hashCode(); }
Example #26
Source File: MediaScanner.java From video-player with MIT License | 4 votes |
private void prescan(String filePath) throws RemoteException { mProvider = mContext.getContentResolver().acquireContentProviderClient(MediaStore.AUTHORITY); Cursor c = null; String where = null; String[] selectionArgs = null; if (mFileCache == null) mFileCache = new HashMap<String, FileCacheEntry>(); else mFileCache.clear(); try { if (filePath != null) { where = Video.Media.DATA + "=?"; selectionArgs = new String[]{filePath}; } c = mProvider.query(Video.Media.CONTENT_URI, VIDEO_PROJECTION, where, selectionArgs, null); if (c != null) { try { while (c.moveToNext()) { long rowId = c.getLong(ID_VIDEO_COLUMN_INDEX); String path = c.getString(PATH_VIDEO_COLUMN_INDEX); long lastModified = c.getLong(DATE_MODIFIED_VIDEO_COLUMN_INDEX); if (path.startsWith("/")) { File tempFile = new File(path); if (!TextUtils.isEmpty(filePath) && !tempFile.exists()) { mProvider.delete(Video.Media.CONTENT_URI, where, selectionArgs); return; } path = FileUtils.getCanonical(tempFile); String key = mCaseInsensitivePaths ? path.toLowerCase() : path; mFileCache.put(key, new FileCacheEntry(Video.Media.CONTENT_URI, rowId, path, lastModified)); } } } finally { c.close(); c = null; } } } finally { if (c != null) { c.close(); } } }
Example #27
Source File: MediaScanner.java From HPlayer with Apache License 2.0 | 4 votes |
private void prescan(String filePath) throws RemoteException { mProvider = mContext.getContentResolver().acquireContentProviderClient(MediaStore.AUTHORITY); Cursor c = null; String where = null; String[] selectionArgs = null; if (mFileCache == null) mFileCache = new HashMap<String, FileCacheEntry>(); else mFileCache.clear(); try { if (filePath != null) { where = Video.Media.DATA + "=?"; selectionArgs = new String[]{filePath}; } c = mProvider.query(Video.Media.CONTENT_URI, VIDEO_PROJECTION, where, selectionArgs, null); if (c != null) { try { while (c.moveToNext()) { long rowId = c.getLong(ID_VIDEO_COLUMN_INDEX); String path = c.getString(PATH_VIDEO_COLUMN_INDEX); long lastModified = c.getLong(DATE_MODIFIED_VIDEO_COLUMN_INDEX); if (path.startsWith("/")) { File tempFile = new File(path); if (!TextUtils.isEmpty(filePath) && !tempFile.exists()) { mProvider.delete(Video.Media.CONTENT_URI, where, selectionArgs); return; } path = FileUtils.getCanonical(tempFile); String key = mCaseInsensitivePaths ? path.toLowerCase() : path; mFileCache.put(key, new FileCacheEntry(Video.Media.CONTENT_URI, rowId, path, lastModified)); } } } finally { c.close(); c = null; } } } finally { if (c != null) { c.close(); } } }
Example #28
Source File: MediaScanner.java From react-native-android-vitamio with MIT License | 4 votes |
private void prescan(String filePath) throws RemoteException { mProvider = mContext.getContentResolver().acquireContentProviderClient(MediaStore.AUTHORITY); Cursor c = null; String where = null; String[] selectionArgs = null; if (mFileCache == null) mFileCache = new HashMap<String, FileCacheEntry>(); else mFileCache.clear(); try { if (filePath != null) { where = Video.Media.DATA + "=?"; selectionArgs = new String[]{filePath}; } c = mProvider.query(Video.Media.CONTENT_URI, VIDEO_PROJECTION, where, selectionArgs, null); if (c != null) { try { while (c.moveToNext()) { long rowId = c.getLong(ID_VIDEO_COLUMN_INDEX); String path = c.getString(PATH_VIDEO_COLUMN_INDEX); long lastModified = c.getLong(DATE_MODIFIED_VIDEO_COLUMN_INDEX); if (path.startsWith("/")) { File tempFile = new File(path); if (!TextUtils.isEmpty(filePath) && !tempFile.exists()) { mProvider.delete(Video.Media.CONTENT_URI, where, selectionArgs); return; } path = FileUtils.getCanonical(tempFile); String key = mCaseInsensitivePaths ? path.toLowerCase() : path; mFileCache.put(key, new FileCacheEntry(Video.Media.CONTENT_URI, rowId, path, lastModified)); } } } finally { c.close(); c = null; } } } finally { if (c != null) { c.close(); } } }
Example #29
Source File: MiniThumbFile.java From react-native-android-vitamio with MIT License | 4 votes |
private String randomAccessFilePath(int version) { String directoryName = Environment.getExternalStorageDirectory().toString() + "/" + Video.Thumbnails.THUMBNAILS_DIRECTORY; return directoryName + "/.thumbdata" + version + "-" + mUri.hashCode(); }
Example #30
Source File: MediaScanner.java From HPlayer with Apache License 2.0 | 4 votes |
private Uri endFile(FileCacheEntry entry) throws RemoteException { Uri tableUri; boolean isVideo = MediaFile.isVideoFileType(mFileType) && mWidth > 0 && mHeight > 0; if (isVideo) { tableUri = Video.Media.CONTENT_URI; } else { return null; } entry.mTableUri = tableUri; ContentValues values = toValues(); String title = values.getAsString(MediaStore.MediaColumns.TITLE); if (TextUtils.isEmpty(title)) { title = values.getAsString(MediaStore.MediaColumns.DATA); int lastSlash = title.lastIndexOf('/'); if (lastSlash >= 0) { lastSlash++; if (lastSlash < title.length()) title = title.substring(lastSlash); } int lastDot = title.lastIndexOf('.'); if (lastDot > 0) title = title.substring(0, lastDot); values.put(MediaStore.MediaColumns.TITLE, title); } long rowId = entry.mRowId; Uri result = null; if (rowId == 0) { result = mProvider.insert(tableUri, values); if (result != null) { rowId = ContentUris.parseId(result); entry.mRowId = rowId; } } else { result = ContentUris.withAppendedId(tableUri, rowId); mProvider.update(result, values, null, null); } return result; }