Question

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 ?

Was it helpful?

Solution

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.

OTHER TIPS

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}"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top