What is the difference between VideoView setVideoPath and setVideoURI

VideoView has two different ways to specify which video will play:

What is the difference between the two and when should one or the other be used?

+4
source share
1 answer

Look at the source code, nothing is different from the type you are passing.

/**
 * Sets video path.
 *
 * @param path the path of the video.
 */
public void setVideoPath(String path) {
    setVideoURI(Uri.parse(path));
}
/**
 * Sets video URI.
 *
 * @param uri the URI of the video.
 */
public void setVideoURI(Uri uri) {
    setVideoURI(uri, null);
}

If you use setVideoPath, it creates for you Uri, so use what you want - depending on whether there is a path Urior String.

https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/widget/VideoView.java

+7