Android 在外部播放器中播放视频网址 [英] Android play a video url in external player
本文介绍了Android 在外部播放器中播放视频网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将视频流式传输到手机上的外部播放器.我安装了双重扭曲,我希望它打开我的视频 URL.我怎样才能做到这一点?
I want to to stream my video to an external player on my phone. I have double twist installed and I want that that to open a my video URL. How can I do this?
推荐答案
让您的应用程序的用户选择他喜欢的视频播放器来播放您的视频是一个很好的做法
It is a good practice to let user of your app to select the Video player he likes to play your Video
创建一个意图选择器,让您的用户选择他选择的视频播放器并播放文件.
Create a Intent Chooser which lets your user choose a Video player of his choice and play the file.
public class MainActivity extends Activity implements OnClickListener {
private Button btn;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn = (Button) findViewById(R.id.button1);
btn.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.button1) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse("http://ur URL"), "video/*");
startActivity(Intent.createChooser(intent, "Complete action using"));
}
}
}
这篇关于Android 在外部播放器中播放视频网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文