0

I have a requirement to play .m3u8 video url on Andriod Device I am trying to execute below Code,But it is not working,I'm getting Video Can't be played?

Could any one help?

SourceCode:

import android.media.MediaPlayer;
import android.media.MediaPlayer.OnPreparedListener;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;
import android.app.Activity;

    public class MainActivity extends Activity {

        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);

            VideoView vw = (VideoView) findViewById(R.id.videoView);
            vw.setVideoPath(".m3u8 URL Here");
            vw.setMediaController(new MediaController(this));
            vw.requestFocus();
            vw.start();
    }
}

Note:

I have Followed this link HLS (http live streaming) on Android 3.0 and seeking

Community
  • 1
  • 1
String
  • 3,660
  • 10
  • 43
  • 66

1 Answers1

2

You can use a library todo this, i recommend you to use Vitamio it is very powerful Chinese library works for 2.1+ devices, check it in Github in "English"

https://github.com/yixia/VitamioBundle

Alex
  • 1,068
  • 8
  • 23