I was trying to play an audio URL which is using RTSP with extension m3u8 but when i pay on device it showikng error

230 views Asked by At

I tried to implement the following code but it shows media player error (1,-1010) or do i need to use another player.

 public class VideoViewActivity extends Activity {

        // Declare variables
        ProgressDialog pDialog;
        VideoView videoview;
    Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            // Get the layout from video_main.xml
            setContentView(R.layout.videoview_main);
            // Find your VideoView in your video_main.xml layout
            MediaPlayer mp=new MediaPlayer();
            videoview = (VideoView) findViewById(R.id.VideoView);
            try {
                mp.setDataSource("http://example.com/playlist.m3u8");
                mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
                 mp.prepare();
                 mp.start();        
            } catch (IllegalArgumentException e2) {
                // TODO Auto-generated catch block
                e2.printStackTrace();
            } 
        }}

Can we use RTSP for audio streaming in android?

1

There are 1 answers

0
Manish Chauhan On

After long search I integrate VLC player with my app.This solves all the issue faced earlier now i can easily play audio/video through .m3u8 format.