List of usage examples for android.os Environment DIRECTORY_MOVIES
String DIRECTORY_MOVIES
To view the source code for android.os Environment DIRECTORY_MOVIES.
Click Source Link
From source file:Main.java
public static String getMovies() { return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath() + "/"; }
From source file:Main.java
/** * Creates a thumbnail file starting from an image/video file * * @param original_file original file path * @param video true if the file is a video. false if the file is a picture * @return a file/* w ww . j a v a2s . c om*/ */ private static File generateThumbnailFileForFile(File original_file, boolean video) { // Create an image file name try { String imageFileName = "thumb" + original_file.getName(); Log.d(TAG, original_file.getName()); File storageDir = Environment.getExternalStoragePublicDirectory( video ? Environment.DIRECTORY_MOVIES : Environment.DIRECTORY_PICTURES); return File.createTempFile(imageFileName, /* prefix */ THUMB_FORMAT_EXTENSION, /* suffix */ storageDir /* directory */ ); } catch (IOException e) { Log.d(TAG, "Error", e); } return null; }
From source file:Main.java
/** * The directory of video storage used when the user wants the videos to * be automatically picked up by the media scanner (and visible in the * Gallery).// w w w . j av a 2 s .com */ public static File getVideosPublicDir() { File dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES); if (!dir.exists()) { dir.mkdir(); } return dir; }
From source file:im.ene.lab.toro.sample.util.Util.java
public static File[] loadMovieFolder() throws FileNotFoundException { return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES) .listFiles(new FilenameFilter() { @Override//from ww w . j a v a 2 s . c o m public boolean accept(File dir, String filename) { return filename.endsWith(".mp4"); } }); }
From source file:Main.java
/** * Creates a media file in the {@code Environment.DIRECTORY_PICTURES} directory. The directory * is persistent and available to other applications like gallery. * * @param type Media type. Can be video or image. * @return A file object pointing to the newly created file. *///from ww w. j a va 2s . c o m public static File getOutputMediaFile(int type) { // To be safe, you should check that the SDCard is mounted // using Environment.getExternalStorageState() before doing this. if (!Environment.getExternalStorageState().equalsIgnoreCase(Environment.DIRECTORY_MOVIES)) { return null; } File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES), "ViewBody"); // This location works best if you want the created images to be shared // between applications and persist after your app has been uninstalled. // Create the storage directory if it does not exist if (!mediaStorageDir.exists()) { if (!mediaStorageDir.mkdirs()) { Log.d("CameraSample", "failed to create directory"); return null; } } // Create a media file name String timeStamp = new SimpleDateFormat("yyMMdd_HHmmss", Locale.KOREAN) .format(DateFormat.getDateTimeInstance()); File mediaFile; if (type == MEDIA_TYPE_IMAGE) { mediaFile = new File(mediaStorageDir.getPath() + File.separator + "IMG_" + timeStamp + ".jpg"); } else if (type == MEDIA_TYPE_VIDEO) { mediaFile = new File(mediaStorageDir.getPath() + File.separator + "ViewBody_" + timeStamp + ".mp4"); } else { return null; } return mediaFile; }
From source file:Main.java
/** * Creates a media file in the {@code Environment.DIRECTORY_PICTURES} directory. The directory * is persistent and available to other applications like gallery. * * @param type Media type. Can be video or image. * @return A file object pointing to the newly created file. *//* w w w . j a v a 2 s . c om*/ public static File getOutputMediaFile(int type) { // To be safe, you should check that the SDCard is mounted // using Environment.getExternalStorageState() before doing this. if (!Environment.getExternalStorageState().equalsIgnoreCase(Environment.MEDIA_MOUNTED)) { return null; } File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES), "waivelength"); // This location works best if you want the created images to be shared // between applications and persist after your app has been uninstalled. // Create the storage directory if it does not exist if (!mediaStorageDir.exists()) { if (!mediaStorageDir.mkdirs()) { Log.d("CameraSample", "failed to create directory"); return null; } } // Create a media file name String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); File mediaFile; if (type == MEDIA_TYPE_IMAGE) { mediaFile = new File(mediaStorageDir.getPath() + File.separator + "IMG_" + timeStamp + ".jpg"); } else if (type == MEDIA_TYPE_VIDEO) { mediaFile = new File(mediaStorageDir.getPath() + File.separator + "VID_" + timeStamp + ".mp4"); } else { return null; } return mediaFile; }
From source file:Main.java
static String getDefaultMediaDirectory(int type) { String dirType = new String(); switch (type) { case 0://from w ww. ja va2s .c om dirType = Environment.DIRECTORY_MUSIC; break; case 1: dirType = Environment.DIRECTORY_MOVIES; break; case 2: dirType = Environment.DIRECTORY_DCIM; break; default: break; } File path = new File(""); if (type == 3) { // There is no API for knowing the standard location for sounds // such as voice recording. Though, it's typically in the 'Sounds' // directory at the root of the external storage path = new File( Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "Sounds"); } else { path = Environment.getExternalStoragePublicDirectory(dirType); } path.mkdirs(); // make sure the directory exists return path.getAbsolutePath(); }
From source file:com.exercise.AndroidClient.RecvFrom.java
RecvFrom(DownloadManager downloadMgr, String json, String remoteHost) throws JSONException { this.downloadMgr = downloadMgr; this.remoteHost = remoteHost; this.json = json; parseJson(json);/*from w ww. j a va 2 s. c om*/ // setup map for getExternalStoragePublicDirectory values destDirTypes = new HashMap<String, String>(); destDirTypes.put("music", Environment.DIRECTORY_MUSIC); destDirTypes.put("downloads", Environment.DIRECTORY_DOWNLOADS); destDirTypes.put("pictures", Environment.DIRECTORY_PICTURES); destDirTypes.put("movies", Environment.DIRECTORY_MOVIES); valid = true; }
From source file:com.aengbee.android.leanback.ui.VideoDetailsActivity.java
public void execFFmpegBinary(final String[] command) { try {/* w ww . j a va2s . co m*/ ffmpeg.execute(command, new ExecuteBinaryResponseHandler() { @Override public void onFailure(String s) { Log.d(TAG, "FAILED with output : " + s); Toast.makeText(getApplicationContext(), "FAILED", Toast.LENGTH_SHORT).show(); } @Override public void onSuccess(String s) { Log.d(TAG, "SUCCESS with output : " + s); //Toast.makeText(getApplicationContext(), "SUCCESS", Toast.LENGTH_SHORT).show(); Uri videoUri = Uri.parse(Environment.getExternalStorageDirectory().getPath() + "/" + Environment.DIRECTORY_MOVIES + "/temp.mkv"); intent2mxplayer(videoUri, "video/*"); } @Override public void onProgress(String s) { Log.d(TAG, "Started command : ffmpeg " + command); //addTextViewToLayout("progress : "+s); progressDialog.setMessage("Processing\n" + s); } @Override public void onStart() { // outputLayout.removeAllViews(); Log.d(TAG, "Started command : ffmpeg " + command); progressDialog.setMessage("Processing Started"); progressDialog.show(); } @Override public void onFinish() { Log.d(TAG, "Finished command : ffmpeg " + command); progressDialog.dismiss(); } }); } catch (FFmpegCommandAlreadyRunningException e) { // do nothing for now } }
From source file:edu.mit.mobile.android.livingpostcards.CardViewVideoFragment.java
@Override public Loader<Uri> onCreateLoader(int id, Bundle args) { getView().findViewById(R.id.progress).setVisibility(View.VISIBLE); showErrorMessage(null);/*from w w w .j a v a 2s. c om*/ return new DownloadLoader(getActivity(), args.getString(ARGUMENT_URI_STRING), new File(getActivity().getExternalFilesDir(Environment.DIRECTORY_MOVIES), "livingpostcards")); }