我在我的android应用程序中实现了libvlc。到目前为止它工作得很好。但是当链接不可用时,它会返回这样的异常。
08-29 16:16:48.027 4923-4942/? E/VLC: core input: open of `https://archive.org/download/Popeye_forPresident/Popeye_forPresident_512kb.mp4' failed
08-29 16:16:48.027 4923-4942/? E/VLC: core input: Your input can't be opened
08-29 16:16:48.027 4923-4942/? E/VLC: core input: VLC is unable to open the MRL 'https://archive.org/download/Popeye_forPresident/Popeye_forPresident_512kb.mp4'. Check the log for details.
所以,每当我得到这个异常我是如何在android中显示的?所以我将创建新的播放器,它将重复播放。
这是我的createPlayer()函数: -
private void createPlayer(String media) {
releasePlayer();
try {
// Create a new media player
libvlc = LibVLC.getInstance();
libvlc.setHardwareAcceleration(LibVLC.HW_ACCELERATION_FULL);
libvlc.eventVideoPlayerActivityCreated(true);
libvlc.setSubtitlesEncoding("");
libvlc.setAout(LibVLC.AOUT_OPENSLES);
libvlc.setTimeStretching(true);
libvlc.setChroma("RV32");
libvlc.setVerboseMode(true);
LibVLC.restart(this);
holder.setFormat(PixelFormat.RGBX_8888);
holder.setKeepScreenOn(true);
libvlc.playMRL(LibVLC.PathToURI(media));
} catch (LibVlcException e) {// here I already have LibvlcException class in this library but still it didn't catch any exception.
mSpinner.setVisibility(View.GONE);
Log.v("MyVlc", "Could not create Vlc Player");
}
}