I am having quite a trouble lately.
I want to develop an Android App with a livestreaming embeded, but I just don't know how to start. I tried using an Webview with the livestreaming tag embeded, but it didn't work (most likely the stream is provided via Flash). I also tried to use a VideoView component but it also didn't work.
I know it's possible because those publishers have their own APP, but the format we are provided is usually Flash. Not a mobile friendly format.
Can someone, please, show me any idea on how to start or if there is some workaround?
Thanks in advance!
EDIT:
What I would like to do is, like, take this stream, for example: http://new.livestream.com/ATP/lexington2014court1 and show it inside my APP.
I think I did it!
First of all, I am indeed using the stream from livestream.com, but right now, they don't have a public API to the actual version, but.... I got a lot of help from here: new.livestream.com API to get RTSP
So, there is this API call http://new.livestream.com/api/accounts/[account_id]/events/[event_id]/viewing_info
which return us a JSON. Then, I take the "rtsp_url" value and put it into my VideoURI.
So here it goes my code: Please, replace "{VIDEO_RTSP_URL}" in the code below with the value of the "rtsp_url" from the JSON you got above.
MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
VideoView videoView = (VideoView) findViewById(R.id.video);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
mediaController.setMediaPlayer(videoView);
Uri video = Uri.parse("{VIDEO_RTSP_URL}");
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.start();
}
activity_main.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="com.fcl.videoplay.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>
Now, for some reason, the streaming is not working when I connect to the Wi-Fi, but it works when I am on 3G (I am testing on a real device. Not an emulator), but this is another topic
Overall, if you're using a streaming service, like Livestream.com, they might provide you something like this RTSP_URL via an API. You will likely just need to use it.