问题描述
在我的android应用(Android Studio)中,有一个VideoView并从URL播放视频(例如http://dl.example.com/video/myvideo.mp4)。 我的手机是双SIM卡,然后有3个Internet /数据连接: -无线上网 -SIM 1(数据连接) -SIM 2(数据连接)
当我在SIM 1上使用wifi连接和数据连接时,我注意到它可以正常工作,但是在SIM 2上切换到数据连接时,它无法播放视频。
这是代码:
Uri video = Uri.parse(videoURL);
videoViewMain.setVideoURI(video);
videoViewMain.setonPreparedListener(
new MediaPlayer.OnPreparedListener() {
Log.e("mylogs","Start");
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
Log.e("mylogs","In onPrepared");
videoViewMain.seekTo(1);
videoViewMain.start();
Log.e("mylogs","Playing");
}
});
我使用try-catch查找错误,但没有错误,并使用“ Log.e”,如您在代码中看到的那样,发现在SIM 2上的数据连接上,“ onPrepared”从未发生。
我测试了但无法解决问题的东西
现在,我确定互联网连接和URL都可以。有没有一种方法可以覆盖它以获取错误?因为似乎在播放时它会等待或崩溃而没有任何错误?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)