Play youtube video on Android using libvlc
Posted: 12 Feb 2021 19:27
I found this piece of code https://code.videolan.org/videolan/LibV ... tube-video
and tried to do the same thing on android
but it ends with following exception being thrown
Not sure exactly why it is happening
and tried to do the same thing on android
Code: Select all
if(sourceUrl.contains("youtube")) {
final Uri uri = Uri.parse(sourceUrl);
final Media nm = new Media(mLibVLC, uri );
nm .parse(0x04);
nm .release();
MediaList mediaList = nm .subItems();
mediaList.release();
Media nMedia = mediaList.getMediaAt(0);
nMedia.release();
nMedia.setHWDecoderEnabled(hwDecoderEnabled, false);
mMediaPlayer.setMedia(nMedia);
Code: Select all
Caused by: java.lang.IllegalStateException: can't get VLCObject instance
at org.videolan.libvlc.MediaList.nativeNewFromMedia(Native Method)
at org.videolan.libvlc.MediaList.<init>(MediaList.java:104)
at org.videolan.libvlc.Media.subItems(Media.java:572)