gpt4 book ai didi

java - VideoView的setVideoPath和setVideoURI有什么区别

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:28:20 24 4
gpt4 key购买 nike

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

关于java - VideoView的setVideoPath和setVideoURI有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30428438/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com