Android: play flv video stream from url

android, streaming-flv-video, video-streaming

Solution

You can use vitamio.

Media formats

Many audio and video codecs are packed into Vitamio beside the default media format built in Android platform, some of them are listed below.

- divx/xvid

- wmv

- flv

- ts

- rmvb

- mkv

- mov

- m4v

- avi

- mp4

- 3gp

Vitamio SDK for Android developers

You can download the jar file to use with your project here. (Vitamio-SDK.7z)

For Android developers

Here is a demo project which uses the vitamio.jar. (Vitamio-Demo.7z)

Vitamio provides the similiar interfaces with Android default MediaPlayer framework. If you're using android.media.MediaPlayer in your project, just grab the vitamio.jar from above, then add it to your project's libs, and replace the import of android.media.MediaPlayer with io.vov.vitamio.MediaPlayer.

Besides the default interfaces from Android MediaPlayer, Vitamio provides more APIs, please refer the javadoc in the library.

Problem

I currently have an app that records a video and uploads it to my server. after uploading the video, the app gets a response that holds a URL to the flv stream to the file. when I try to open the stream in the android default video player (Videos) nothing happens, but when I used a different app (BSPlayer), it played the video perfectly. however, there is no way to force opening one app from `Intent.ACTION_VIEW`. here is the code for the function that receives the response from the server: ``` @Override protected void onResponseReceived(int requestType, int status, Object resp) { switch (requestType) { case CLIP_DETAILS: { if (status == RESPONSE_OK) { String token1 = ((ResponseObject_ClipDetails) resp).m_token1; String token2 = ((ResponseObject_ClipDetails) resp).m_token2; String url = getClipURL(token1, token2); Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); i.setType("video/flv"); startActivity(i); } } break; } } ``` is there a way to show .flv videos in my android app?

Original source

Related problems