是什么VideoView的setVideoPath和setVideoURI之间的区别 [英] What is the difference between VideoView's setVideoPath and setVideoURI
问题描述
VideoView 有指定的视频播放的两种不同方式:
VideoView has two different ways of specifying which video to play:
- setVideoPath (字符串路径)
- setVideoUri (URI URI)
- setVideoPath(String path)
- setVideoUri(Uri uri)
两者有什么之间的差异时,应一方或另一方使用吗?
What is the difference between the two and when should one or the other be used?
推荐答案
看源$ C $ C,没有什么是你传递的类型不同分开
Look at the source code, nothing is different apart from the type you pass.
/**
* 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
它创建乌里
为你,所以使用任何你想要的 - 这取决于你有一个乌里
或字符串
路径。
Is you use setVideoPath
it creates the Uri
for you, so use whichever you want - depending on if you have a Uri
or String
path.
<一个href=\"https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/widget/VideoView.java\" rel=\"nofollow\">https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/widget/VideoView.java
这篇关于是什么VideoView的setVideoPath和setVideoURI之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!