0

I would like play media (video) from a network stream(http) directly, hence so I have to somehow feed Android MediaPlayer with the data.

I have FileOutputStream outstream = new FileOutputStream(outputfile); which I write into the outputfile by outstream.write(buffer, 0, count);

Is there any API which takes stream as input....???.... Please help...

aTJ
  • 3,823
  • 3
  • 21
  • 25

1 Answers1

3

Android supports Progressive download and HTTP Live Streaming(only in 3.0) and both of these work over HTTP.

You can use VideoView or Mediaplayer to leverage Progressive downloading and play your videos: see this discussion.

Also, if your server, delivers segmented files(.ts) in conformance to Apple's Http Live Streaming IETF draft, you can directly supply the URL to MediaPlayer and play your video using SurfaceView. Note: that you will have to replace "http" with "httplive:" in your URL.

Community
  • 1
  • 1
Samuh
  • 36,316
  • 26
  • 109
  • 116
  • For now my server is Youtube. And I see mediaplayer accepting audio inputstreams. But, in the case of a video stream What can be done ?? – aTJ Feb 23 '11 at 13:26
  • Try passing the URL directly to VideoView or Mediaplayer and see what happens. – Samuh Feb 23 '11 at 15:00
  • Yeah....that is what I am trying now, but the permission of the file is getting changed when we give it for download. Will let you know the result... – aTJ Feb 24 '11 at 06:05
  • Another issue in MediaPlayer.... I have implemented OnBufferingUpdateListener, but the MediaPlayer is not calling onBufferingUpdate. I have given mediaPlayer.setOnBufferingUpdateListener(this);....But still it is not getting updated.... Any idea !! – aTJ Feb 24 '11 at 13:35