Cinar
Cinar

Reputation: 183

Android playing Video data from a custom network stream?

Does Android MediaPlayer can only work with file sources? I would like play media (video) from a network stream, but the stream comes in a non-standard protocol, so I have to somehow feed Android MediaPlayer with the data only.

Is there anyway to do that? I found a few web pages suggesting using a temporary file for the buffered media data etc. but I would like to minimize the I/O usage as much as I can, so I'm looking for a API only solution if there is any? how about JNI? but looks like the permissions going to be an issue with that also.

Upvotes: 1

Views: 2542

Answers (2)

kingfahad
kingfahad

Reputation: 68

Basically Android supports HTTP and RTSP video playback for network videos

This link may help you Click Here

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1006614

Does Android MediaPlayer can only work with file sources?

No, it handles HTTP and RTSP streams as well.

I would like play media (video) from a network stream, but the stream comes in a non-standard protocol, so I have to somehow feed Android MediaPlayer with the data only.

That will be difficult. If this were audio, you could use AudioTrack, but there is no video equivalent for this.

One answer is to create a server-side proxy that converts your non-HTTP, non-RTSP stream into an HTTP or RTSP stream, so the existing Android streaming support works.

Upvotes: 2

Related Questions