要在 Listview 中播放视频,您需要在 ListView 的 Item Click 上打开 Video,然后您可以在 String 中检索您的视频 url,如:
String myUrl = urHashMaparraylist.get(position).get("videolocation");
现在将这个 myUrl 传递给下一个 Activity 并将这个 String 设置为一个
Uri video = Uri.parse(myUrl);
videoView.setVideoURI(video);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
String myUrl = urHashMaparraylist.get(position).get("videolocation");
Intent n = new Intent(YourActivityName.this , NewActivityName.class);
n.putExtra("videolocation",myUrl);
startActivity(n);
}
});
现在在您的下一个活动中将其检索为
Uri video = Uri.parse(url);
videoView.setVideoURI(video);
在某些情况下,
要设置 VideoView,您可以使用:
android:background:"#0000"
来自Android Scrollview having videoview is giving problem
您也可以尝试使用 TextureView 来代替 VideoView 作为参考,您可以看到第 2 号参考:
有关视频流的更多参考...您可以查看以下网址:
1>http://developer.samsung.com/android/technical-docs/Android-Media-Streaming-Tutorial
2>http://developer.android.com/reference/android/view/TextureView.html