[英]Streaming Live Ustream video to Android App
I have an Android app and I want to implement a feature that allows me to play a Live video from Ustream but I have no idea if this can be done using the embed code. 我有一个Android应用程序,我想实现一项功能,允许我播放Ustream的实时视频,但我不知道是否可以使用嵌入代码来完成。 I've looked at this question but it doesn't really help. 我已经看了这个问题,但并没有真正的帮助。 Has anybody had luck achieving this or something similar? 有人有幸实现这一目标或类似目标吗?
cheers 干杯
Please, see if they provide you a API with a "rtsp" link. 请查看他们是否为您提供带有“ rtsp”链接的API。 (I think they do.) Then, you must use this into your VideoView URI. (我认为他们可以。)然后,您必须在VideoView URI中使用它。 It'll be something like this: 会是这样的:
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
VideoView videoView = (VideoView) findViewById(R.id.video);
Uri video = Uri.parse("{YOUR RTSP LINK HERE}");
videoView.setVideoURI(video);
videoView.start();
}
(...)
}
and your layout file, main_activity.xml 和您的布局文件main_activity.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="{yourpackageandsuch}.MainActivity" >
<VideoView
android:id="@+id/video"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" />
</RelativeLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.