【发布时间】:2022-09-28 04:09:20
【问题描述】:
我可以在我的应用程序上播放一些直播电视流,但我无法播放其中一些。 在 VLC 游戏上我可以玩这个:https://raw.githubusercontent.com/taodicakhia/IPTV_Exception/master/channels/af/tolotv.m3u8
还有这个:http://51.210.227.142/hls/stream.m3u8
但在安卓应用中,我只能玩这个:http://51.210.227.142/hls/stream.m3u8 我尝试了很多,但我无法弄清楚如何玩第一个:https://raw.githubusercontent.com/taodicakhia/IPTV_Exception/master/channels/af/tolotv.m3u8
这是我的代码:
private void playVideo() {
try {
getWindow().setFormat(PixelFormat.TRANSLUCENT);
MediaController mediaController = new MediaController(AfghanistanTvAct.this);
myVideoView.setMediaController(mediaController);
Uri videoURI = Uri.parse(url);
myVideoView.setVideoURI(videoURI);
myVideoView.requestFocus();
myVideoView.setOnPreparedListener(mp -> myVideoView.start());
} catch (Exception e) {
Toast.makeText(this, \"\" + e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
标签: java android-studio http-live-streaming iptv