I try to play a live stream on my android phone using the MediaPlayer object. But I definitely see a black screen. Does anybody have any experience with streaming on Android ?
Here is what I'm doing: I broadcast a stream with Darwin streaming server (via PlaylistBroadcast) to my Android phone. The stream is sent over RTP to the IP of my device (unicast). A .sdp file describes my stream. In my app, I try to play the stream with the following code where url is "rtsp://server_ip/live.sdp" private void playVideo(String url) { try { //media.setEnabled(false); if (player==null) { //System.out.println("create MediaPlayer"); player=new MediaPlayer(); player.setScreenOnWhilePlaying(true); } else { player.stop(); player.reset(); } player.setDataSource(url); //holder.setFixedSize(320, 240); player.setDisplay(holder); player.setAudioStreamType(AudioManager.STREAM_MUSIC); player.setOnPreparedListener(this); player.prepareAsync(); player.setOnBufferingUpdateListener(this); player.setOnCompletionListener(this); } catch (Throwable t) { System.out.println("Exception in media prep: "+t.toString()); } } public void onPrepared(MediaPlayer mp) { //System.out.println("onPrepared"); int width=player.getVideoWidth(); int height=player.getVideoHeight(); if (width!=0 && height!=0) { holder.setFixedSize(width, height); player.start(); } } I always have a black screen, buffering remains at 0%. I checked that I can play this live stream on VLC and QT on a desktop, and it works fine. If I request the same file via a direct RTSP request (rtsp://server_IP/myVideo.mp4) the file plays correctly on my android phone. I also tried to request the .sdp file by an HTTP request (http:// server_IP/live.sdp) but the result is the same (black screen). Does anybody have already succeeded in playing a live stream on an android phone ? Cheers Jean -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en