繁体   English   中英

VideoView的setVideoPath和setVideoURI有什么区别

[英]What is the difference between VideoView's setVideoPath and setVideoURI

VideoView有两种不同的方式来指定要播放的视频:

这两者之间有什么区别?何时应该使用其中一种?

查看源代码,除了您传递的类型之外没有什么不同。

/**
 * 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);
}

如果您使用setVideoPath它会为您创建Uri ,因此请根据您是否拥有UriString路径使用您想要的任何内容。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM