I'm an Android developer. I have a question, hope everyone helps me. I try to play m3u8 from this website: https://fptplay.net/livetv/vtv1-hd. This is my code:
private void initPlayer(){
videoView = (VideoView)findViewById(R.id.video_channel);
//fvideoView.show
videoView.setVideoURI(Uri.parse(urlVideo));
videoView.setBackgroundColor(Color.TRANSPARENT);
mc = new MediaController(PlayTiviActivity.this);
mc.setVisibility(View.VISIBLE);
videoView.setMediaController(mc);
prbLoading.setVisibility(View.VISIBLE);
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.start();
prbLoading.setVisibility(View.GONE);
videoView.setVisibility(View.VISIBLE);
}
});
}
I added user-permission in Mainifest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
I get link m3u8 from this website and I can play it well in iOS, but when I play it in Android, I rarely can play it. It show message "Cannot play this video". Sometimes, I can play it by 3G network. Somtimes it shows me that message.Some days before I can play it well with this code. I really don't understand why? I try to use Vitamio library, ExoLibrary library but it also fail. Please help me. Thank you so much.