Search code examples
androidmedia-playerinputstream

Create mediaplayer with inputstream in android


How to I create mediaplayer instance with inputstream?

I see only 4 function for setDataSource. And there is no function getting inputstream ? is it a must to use FileDescriptor to mediaplayer ? It seems so basic. but, I couldnot find a way. In j2me, there is a function that Manager.createPlayer(InputStream). And you can use inputstream to create a media player. Is there a way to create a mediaplayer like j2me ?


Solution

  • One approach can be to write your stream to a File and then give it to the MediaPlayer for playback.