Java Code Examples for android.os.Environment#DIRECTORY_MOVIES
The following examples show how to use
android.os.Environment#DIRECTORY_MOVIES .
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: UtilsHandler.java From PowerFileExplorer with GNU General Public License v3.0 | 9 votes |
public void addCommonBookmarks() { String sd = Environment.getExternalStorageDirectory() + "/"; String[] dirs = new String[] { sd + Environment.DIRECTORY_DCIM, sd + Environment.DIRECTORY_DOWNLOADS, sd + Environment.DIRECTORY_MOVIES, sd + Environment.DIRECTORY_MUSIC, sd + Environment.DIRECTORY_PICTURES }; for (String dir : dirs) { addBookmark(new File(dir).getName(), dir); } }
Example 2
Source File: ScopedDirectoryAccessFragment.java From android-ScopedDirectoryAccess with Apache License 2.0 | 8 votes |
private String getDirectoryName(String name) { switch (name) { case "ALARMS": return Environment.DIRECTORY_ALARMS; case "DCIM": return Environment.DIRECTORY_DCIM; case "DOCUMENTS": return Environment.DIRECTORY_DOCUMENTS; case "DOWNLOADS": return Environment.DIRECTORY_DOWNLOADS; case "MOVIES": return Environment.DIRECTORY_MOVIES; case "MUSIC": return Environment.DIRECTORY_MUSIC; case "NOTIFICATIONS": return Environment.DIRECTORY_NOTIFICATIONS; case "PICTURES": return Environment.DIRECTORY_PICTURES; case "PODCASTS": return Environment.DIRECTORY_PODCASTS; case "RINGTONES": return Environment.DIRECTORY_RINGTONES; default: throw new IllegalArgumentException("Invalid directory representation: " + name); } }
Example 3
Source File: RCTCameraModule.java From react-native-camera-face-detector with MIT License | 6 votes |
private File getOutputMediaFile(int type) { // Get environment directory type id from requested media type. String environmentDirectoryType; if (type == MEDIA_TYPE_IMAGE) { environmentDirectoryType = Environment.DIRECTORY_PICTURES; } else if (type == MEDIA_TYPE_VIDEO) { environmentDirectoryType = Environment.DIRECTORY_MOVIES; } else { Log.e(TAG, "Unsupported media type:" + type); return null; } return getOutputFile( type, Environment.getExternalStoragePublicDirectory(environmentDirectoryType) ); }
Example 4
Source File: StorageUtil.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
public static File getVideoDir() throws NoExternalStorageException { return new File(getSignalStorageDir(), Environment.DIRECTORY_MOVIES); }
Example 5
Source File: StorageUtil.java From bcm-android with GNU General Public License v3.0 | 4 votes |
public static File getVideoDir() throws NoExternalStorageException { return new File(getExternalStorageDir(), Environment.DIRECTORY_MOVIES); }
Example 6
Source File: DownloadRedditVideoService.java From Infinity-For-Reddit with GNU Affero General Public License v3.0 | 4 votes |
@RequiresApi(api = Build.VERSION_CODES.Q) private void copyFileQ(File src, String outputFileName) throws IOException { String relativeLocation = Environment.DIRECTORY_MOVIES + "/Infinity/"; ContentValues contentValues = new ContentValues(); contentValues.put(MediaStore.MediaColumns.DISPLAY_NAME, outputFileName); contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, relativeLocation); contentValues.put(MediaStore.Video.Media.IS_PENDING, 1); OutputStream stream = null; Uri uri = null; try { final Uri contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; uri = contentResolver.insert(contentUri, contentValues); if (uri == null) { throw new IOException("Failed to create new MediaStore record."); } stream = contentResolver.openOutputStream(uri); if (stream == null) { throw new IOException("Failed to get output stream."); } InputStream in = new FileInputStream(src); byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { stream.write(buf, 0, len); } contentValues.clear(); contentValues.put(MediaStore.Images.Media.IS_PENDING, 0); contentResolver.update(uri, contentValues, null, null); destinationFileUri = uri; } catch (IOException e) { if (uri != null) { // Don't leave an orphan entry in the MediaStore contentResolver.delete(uri, null, null); } throw e; } finally { if (stream != null) { stream.close(); } } }
Example 7
Source File: RecordingService.java From libcommon with Apache License 2.0 | 4 votes |
/** * #startの実態, mSyncをロックして呼ばれる * @param outputDir 出力ディレクトリ * @param name 出力ファイル名(拡張子なし) * @param videoFormat * @param audioFormat * @throws IOException */ @SuppressLint("NewApi") protected void internalStart( @NonNull final DocumentFile outputDir, @NonNull final String name, @Nullable final MediaFormat videoFormat, @Nullable final MediaFormat audioFormat) throws IOException { if (DEBUG) Log.v(TAG, "internalStart:"); final DocumentFile output = outputDir.createFile("*/*", name + ".mp4"); IMuxer muxer = null; if (BuildCheck.isOreo()) { if (USE_MEDIASTORE_OUTPUT_STREAM) { if (DEBUG) Log.v(TAG, "internalStart:create MediaMuxerWrapper using MediaStoreOutputStream"); muxer = new MediaMuxerWrapper( // new MediaStoreOutputStream(this, "*/mp4", null, output.getName(), UriHelper.getPath(this, output.getUri())), new MediaStoreOutputStream(this, "video/mp4", Environment.DIRECTORY_MOVIES + "/" + Const.APP_DIR, output.getName()), MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4); } else { if (DEBUG) Log.v(TAG, "internalStart:create MediaMuxerWrapper using ContentResolver"); muxer = new MediaMuxerWrapper(getContentResolver() .openFileDescriptor(output.getUri(), "rw").getFileDescriptor(), MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4); } } else { if (DEBUG) Log.v(TAG, "internalStart:create MediaMuxerWrapper using File"); final String path = UriHelper.getPath(this, output.getUri()); final File f = new File(UriHelper.getPath(this, output.getUri())); if (/*!f.exists() &&*/ f.canWrite()) { // 書き込めるファイルパスを取得できればそれを使う muxer = new MediaMuxerWrapper(path, MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4); } else { Log.w(TAG, "cant't write to the file, try to use VideoMuxer instead"); } } if (muxer == null) { throw new IllegalArgumentException(); } mMuxer = muxer; mVideoTrackIx = videoFormat != null ? muxer.addTrack(videoFormat) : -1; mAudioTrackIx = audioFormat != null ? muxer.addTrack(audioFormat) : -1; mMuxer.start(); synchronized (mSync) { mSync.notifyAll(); } }
Example 8
Source File: VideoFileTest.java From VideoCamera with Apache License 2.0 | 4 votes |
@Test public void fileShouldContainPathToVideoFolder() { final VideoFile videoFile = new VideoFile(""); final String expectedPath = Environment.DIRECTORY_MOVIES; assertTrue(videoFile.getFullPath().contains(expectedPath)); }
Example 9
Source File: StorageUtil.java From deltachat-android with GNU General Public License v3.0 | 4 votes |
public static File getVideoDir() throws NoExternalStorageException { return new File(getStorageDir(), Environment.DIRECTORY_MOVIES); }
Example 10
Source File: FileDownloadHelper.java From Kore with Apache License 2.0 | 4 votes |
public String getExternalPublicDirType() { return Environment.DIRECTORY_MOVIES; }
Example 11
Source File: FileDownloadHelper.java From Kore with Apache License 2.0 | 4 votes |
public String getExternalPublicDirType() { return Environment.DIRECTORY_MOVIES; }
Example 12
Source File: VideoFileTest.java From LandscapeVideoCamera with Apache License 2.0 | 4 votes |
@Test public void fileShouldContainPathToVideoFolder() { final VideoFile videoFile = new VideoFile(""); final String expectedPath = Environment.DIRECTORY_MOVIES; assertTrue(videoFile.getFullPath().contains(expectedPath)); }