Stream an audio .pls in android

前端 未结 4 1440
刺人心
刺人心 2021-01-06 09:16

I\'m making an radio like application that uses streaming. Here i need to stream the audio from a link (http://somedomain/some.pls).

I have created

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-06 09:54


    You can use the file streaming ability available on the MediaPlayer class to do the above.
    I have not tested the following code, but it should be something on these lines:

    MediaPlayer mp = new MediaPlayer();  
    mp.setDataSource(http://somedomain/some.pls);
    mp.prepare();
    mp.start();  
    

    But remember to do the following:
    1. Surround each of the statements above with try and catch statements and print copiously to LogCat. It will help debug easily.
    2. Release the resources once you are done with it.

    HTH,
    Sriram

提交回复
热议问题