I’m trying to play an AAC audio stream from an Android app, but I’m unable to get it playing.
MediaPlayer player = new MediaPlayer();
player.reset();
player.setDataSource("rtsp://1.2.3.4/app/stream");
player.prepare();
player.start();
It sits at prepare() for 15-20 seconds, then it dies:
W/MediaPlayer( 667): info/warning (1, 26)
I/MediaPlayer( 667): Info (1,26)
E/PlayerDriver( 31): Command PLAYER_PREPARE completed with an error or info PVMFFailure
E/MediaPlayer( 667): error (1, -1)
E/MyTest ( 667): java.io.IOException: Prepare failed.: status=0x1
E/MyTest ( 667): at android.media.MediaPlayer.prepare(Native Method)
E/MyTest ( 667): at com.example.android.skeletonapp.SkeletonActivity$4.run(SkeletonActivity.java:133)
E/MyTest ( 667): at java.lang.Thread.run(Thread.java:1096)
W/PlayerDriver( 31): PVMFInfoErrorHandlingComplete
E/MediaPlayer( 667): start called in state 0
E/MediaPlayer( 667): error (-38, 0)
E/MediaPlayer( 667): Error (-38,0)
It seems MediaPlayer will only try to use UDP as transport. Is it possible to force it to use TCP?
MediaPlayer doesn’t like http://1.2.3.4/app/stream/playlist.m3u8 at all either, since it doesn’t seem to support parsing of m3u playlists. Are there other URLs I could try?
Both of these URLs play just fine in VLC.