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. 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. (I think they do.) Then, you must use this into your 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
<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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.