/** * Sets the data source (file-path or http/rtsp URL) to use. * * @param path the path of the file, or the http/rtsp URL of the stream you want * to play * @throws IllegalStateException if it is called in an invalid state * <p/> * <p/> * When <code>path</code> refers to a local file, the file may * actually be opened by a process other than the calling * application. This implies that the pathname should be an absolute * path (as any other process runs with unspecified current working * directory), and that the pathname should reference a * world-readable file. As an alternative, the application could * first open the file for reading, and then use the file descriptor * form {@link #setDataSource(FileDescriptor)}. */ public void setDataSource(String path) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { _setDataSource(path, null, null); }
/** * Sets the data source (file-path or http/rtsp URL) to use. * * @param path the path of the file, or the http/rtsp URL of the stream you want to play * @param keys AVOption key * @param values AVOption value * @throws IllegalStateException if it is called in an invalid state */ public void setDataSource(String path, String[] keys, String[] values) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { final Uri uri = Uri.parse(path); if ("file".equals(uri.getScheme())) { path = uri.getPath(); } final File file = new File(path); if (file.exists()) { FileInputStream is = new FileInputStream(file); FileDescriptor fd = is.getFD(); setDataSource(fd); is.close(); } else { _setDataSource(path, keys, values); } }
/** * Sets the data source (file-path or http/rtsp URL) to use. * * @param path the path of the file, or the http/rtsp URL of the stream you want * to play * @throws IllegalStateException if it is called in an invalid state * <p/> * <p/> * When <code>path</code> refers to a local file, the file may * actually be opened by a process other than the calling * application. This implies that the pathname should be an absolute * path (as any other process runs with unspecified current working * directory), and that the pathname should reference a * world-readable file. As an alternative, the application could * first open the file for reading, and then use the file descriptor * form {@link #setDataSource(FileDescriptor)}. */ public void setDataSource(String path) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { _setDataSource(path, null, null); }
/** * Sets the data source (file-path or http/rtsp URL) to use. * * @param path the path of the file, or the http/rtsp URL of the stream you want * to play * @throws IllegalStateException if it is called in an invalid state * <p/> * <p/> * When <code>path</code> refers to a local file, the file may * actually be opened by a process other than the calling * application. This implies that the pathname should be an absolute * path (as any other process runs with unspecified current working * directory), and that the pathname should reference a * world-readable file. As an alternative, the application could * first open the file for reading, and then use the file descriptor * form {@link #setDataSource(FileDescriptor)}. */ public void setDataSource(String path) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { _setDataSource(path, null); }
/** * Sets the data source (file-path or http/rtsp URL) to use. * * @param path the path of the file, or the http/rtsp URL of the stream you want * to play * @throws IllegalStateException if it is called in an invalid state * <p/> * <p/> * When <code>path</code> refers to a local file, the file may * actually be opened by a process other than the calling * application. This implies that the pathname should be an absolute * path (as any other process runs with unspecified current working * directory), and that the pathname should reference a * world-readable file. As an alternative, the application could * first open the file for reading, and then use the file descriptor * form {@link #setDataSource(FileDescriptor)}. */ public void setDataSource(String path) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { _setDataSource(path, null, null); }
/** * Sets the data source (file-path or http/rtsp URL) to use. * * @param path the path of the file, or the http/rtsp URL of the stream you want * to play * @throws IllegalStateException if it is called in an invalid state * <p/> * <p/> * When <code>path</code> refers to a local file, the file may * actually be opened by a process other than the calling * application. This implies that the pathname should be an absolute * path (as any other process runs with unspecified current working * directory), and that the pathname should reference a * world-readable file. As an alternative, the application could * first open the file for reading, and then use the file descriptor * form {@link #setDataSource(FileDescriptor)}. */ public void setDataSource(String path) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { _setDataSource(path, null, null); }
/** * Sets the data source (file-path or http/rtsp URL) to use. * * @param path the path of the file, or the http/rtsp URL of the stream you want * to play * @throws IllegalStateException if it is called in an invalid state * <p/> * <p/> * When <code>path</code> refers to a local file, the file may * actually be opened by a process other than the calling * application. This implies that the pathname should be an absolute * path (as any other process runs with unspecified current working * directory), and that the pathname should reference a * world-readable file. As an alternative, the application could * first open the file for reading, and then use the file descriptor * form {@link #setDataSource(FileDescriptor)}. */ public void setDataSource(String path) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { _setDataSource(path, null, null); }
/** * Sets the data source (file-path or http/rtsp URL) to use. * * @param path the path of the file, or the http/rtsp URL of the stream you want to play * @param keys AVOption key * @param values AVOption value * @throws IllegalStateException if it is called in an invalid state */ public void setDataSource(String path, String[] keys, String[] values) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { final Uri uri = Uri.parse(path); if ("file".equals(uri.getScheme())) { path = uri.getPath(); } final File file = new File(path); if (file.exists()) { FileInputStream is = new FileInputStream(file); FileDescriptor fd = is.getFD(); setDataSource(fd); is.close(); } else { _setDataSource(path, keys, values); } }
/** * Sets the data source (file-path or http/rtsp URL) to use. * * @param path the path of the file, or the http/rtsp URL of the stream you want to play * @param keys AVOption key * @param values AVOption value * @throws IllegalStateException if it is called in an invalid state */ public void setDataSource(String path, String[] keys, String[] values) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { final Uri uri = Uri.parse(path); if ("file".equals(uri.getScheme())) { path = uri.getPath(); } final File file = new File(path); if (file.exists()) { FileInputStream is = new FileInputStream(file); FileDescriptor fd = is.getFD(); setDataSource(fd); is.close(); } else { _setDataSource(path, keys, values); } }
/** * Sets the data source (file-path or http/rtsp URL) to use. * * @param path the path of the file, or the http/rtsp URL of the stream you want to play * @param keys AVOption key * @param values AVOption value * @throws IllegalStateException if it is called in an invalid state */ public void setDataSource(String path, String[] keys, String[] values) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { final Uri uri = Uri.parse(path); if ("file".equals(uri.getScheme())) { path = uri.getPath(); } final File file = new File(path); if (file.exists()) { FileInputStream is = new FileInputStream(file); FileDescriptor fd = is.getFD(); setDataSource(fd); is.close(); } else { _setDataSource(path, keys, values); } }
/** * Sets the data source (file-path or http/rtsp URL) to use. * * @param path the path of the file, or the http/rtsp URL of the stream you want to play * @param keys AVOption key * @param values AVOption value * @throws IllegalStateException if it is called in an invalid state */ public void setDataSource(String path, String[] keys, String[] values) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { final Uri uri = Uri.parse(path); if ("file".equals(uri.getScheme())) { path = uri.getPath(); } final File file = new File(path); if (file.exists()) { FileInputStream is = new FileInputStream(file); FileDescriptor fd = is.getFD(); setDataSource(fd); is.close(); } else { _setDataSource(path, keys, values); } }
public void setDataSource(Context context, Uri uri, String headers) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { if (context == null || uri == null) throw new IllegalArgumentException(); String scheme = uri.getScheme(); if (scheme == null || scheme.equals("file")) { setDataSource(FileUtils.getPath(uri.toString())); return; } try { ContentResolver resolver = context.getContentResolver(); mFD = resolver.openAssetFileDescriptor(uri, "r"); if (mFD == null) return; setDataSource(mFD.getParcelFileDescriptor().getFileDescriptor()); return; } catch (Exception e) { closeFD(); } _setDataSource(uri.toString(), headers); }