5

I want to play wowza .mp3 stream on android using default MediaPlayer Library. But I have tried playing the stream using the API demos provided by android itself and it does not work. Although the android documentation states that it does.

http://developer.android.com/guide/appendix/media-formats.html

I checked the wowza documentation and I found that .mp3 rtsp streams cannot be played on any Android device. http://www.wowza.com/forums/content.php?62

I am confused that what is the real issue here because one documentation states that it does and the other states that it doesn't? Can someone please tell me ?

Ahmad Ali Nasir
  • 1,382
  • 3
  • 16
  • 29
  • 1
    You're mis-interpreting the Android documentation - to quote *For video content that is streamed over HTTP or RTSP* that is about it, no other means! Also, *The following network protocols are supported for audio and video playback:* that does not mean streaming using RTSP is supported for MP3's. The documentation over on wowza is correct! Seems the Android documentation has not been updated to clarify this. No can do! – t0mm13b Jan 11 '13 at 15:19
  • @t0mm13b hmm thanks. So the bottom line is that we cannot play .mp3 over rtsp but we can play .mp4 (video) over rtsp if encoding is according to the video encoding requirements provided by android ? i.e a normal mp4 wont play over rtsp until it is encoded according to the requirements. – Ahmad Ali Nasir Jan 11 '13 at 15:28
  • @Ahmad Ali Nasir , did your problem resolved? How you implemented Wowza .mp3 RTSP stream on android? – Pallavi Aug 23 '16 at 13:06
  • @Pallavi I found a workaround. Basically the wowza docuentation states that android does not allow mp3 over rstp. So I encoded the audio into different formats aac etc. and it worked. I cannot remember the exact media format as its been 3 years. But I guess you can now stream mp3 over rtsp. If you can share your current working with details, I will be able to guide you in the right direction. – Ahmad Ali Nasir Aug 28 '16 at 13:09
  • @AhmadAliNasir .. Thanks.. I'll try this , As wowza server is at clients end and I don't have access to it.. and So I'm working with dummy account. – Pallavi Aug 28 '16 at 16:16
  • @Pallavi no worries. Just ping me anytime. – Ahmad Ali Nasir Sep 05 '16 at 06:12

2 Answers2

3

You should use HTTP streaming for MP3 files, this is supported by Wowza, reference: http://broadcastengineering.com/products/wowza-expands-media-server-2-http-streaming-ability

You can also find the MP4 specs for Android or even those which are supported by multiple platforms and use those. Depending on your connection bandwidth, 480p or 720p with AAC audio should work anywhere.

tazzix
  • 316
  • 1
  • 5
  • Thanx for the excellent answer. I have problem with playing back the mp3 audio in my Android app. Now Wowza can swith that rtsp to http steamming if I got it right. So what do I do in my app, in order to play sound with native Android media player ? Just switch the protocol from rtsp:// ...my url ... to http:// ...my url ... I tried and it does not work.. (keeps buffering 4 ever) – Sold Out Oct 15 '14 at 08:38
  • you will need to configure wowza parameters accordingly, unfortunately I have not done that recently and would not be able to provide specifics at the moment. – tazzix Oct 22 '14 at 08:05
  • the only model provide by Wowza for android is rtsp, none of http services works – Albert Chen Jan 14 '15 at 02:06
0

I have faced the same problem in developing Android media player. I detach the audio from the .mp4 file using iMove. It's very very easy to do that, double click the video and select the detach the audio, then delete the audio track.

I transmit the video track and audio track separately, as for video I'm using rtsp, as for audio, I'm using apache web server, android can read the audio statically, just like reading local files.

BTW, I have tried using every protocol provided by Wowza to stream .mp3, none of them works.

My code is the following:

public void PlayVideo() {
        MediaController vidControl = new MediaController(this);
        vidControl.setAnchorView(VideoPlayer);
        VideoPlayer.setMediaController(vidControl);


        VideoPlayer.setVideoPath("rtsp://137.110.90.123:1935/vod/SamNoSound.mp4");


        VideoPlayer.start();

    }

public void PlayAudio() {
        //play audio
        String url = "http://137.110.90.123/~chenyu/sample.mp3"; // your URL here

        try {
            AudioPlayer.setDataSource(url);
            AudioPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
            AudioPlayer.prepare();
            AudioPlayer.start();
        } catch (IOException e) {
            e.printStackTrace();
        }  

I would say if you really want to emphasize on streaming, I would recommend to use VLC, my command for streaming .mp3 is:

Only Stream Audio

vlc /Users/chenyu/Sites/XXXX.mp3 -I http --sout "#transcode{ab=128,samplerate=44100,channels=2,acodec=mpga,vcodec=none}:gather:rtp{mp4a-latm,sdp=rtsp://137.110.92.231:5554/stream.sdp}"
Albert Chen
  • 1,331
  • 1
  • 12
  • 13