Search code examples
javaandroidstreamingvlcrtsp

Can't set options to LibVLC


I have been trying to utilize the Android SDK from Maffen: https://github.com/mrmaffen/vlc-android-sdk/ in order to stream RTSP.

So I found the following stack overflow thread: vlc-android-sdk - cannot view RTSP live video

Which has a number of answers of how to do this.

However, the problem I am having is that when I try to set the options for LibVLC it will not allow me to do so.

For example:

ArrayList<String> options = new ArrayList<String>();
options.add("--no-drop-late-frames");
options.add("--no-skip-frames");
options.add("--rtsp-tcp");
options.add("-vvv");
videoVlc = new LibVLC(options)

When I try to run this I get the following error message in Android Studio: "error: incompatible types: ArrayList cannot be converted to Context"

Also if I hover over the "LibVLC(options)" section of the code it comes up with the following message: "LibVLC (android.content.Context) in LibVLC cannot be applied to (java.util.ArrayList)

I'm no Java expert, so perhaps this is an easy fix but I have been trying different sample codes from around the internet all day and every single one sets those options and I can't do it.

Any help would be much appreciated. Thank you!

EDIT:

This problem was solved using the following:

videoVlc = new LibVLC(this, options);

I had simply forgot about including the context part of the LibVLC.

I forgot to go back and edit this once I had arrived at a solution.


Solution

  • maffen vlc android sdk. the constructor LibVLC takes two params. context and options. option can be null. and options should be the second one. the older version may only takes one param option