Package org.videolan.libvlc
Class LibVLC
- java.lang.Object
-
- org.videolan.libvlc.LibVLC
-
- All Implemented Interfaces:
ILibVLC,IVLCObject<ILibVLC.Event>
public class LibVLC extends Object implements ILibVLC
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLibVLC.Event
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Stringchangeset()Get the libVLC changesetstatic Stringcompiler()Get the libVLC compilerprotected voidfinalize()ContextgetAppContext()longgetInstance()ILibVLCgetLibVLC()booleanisReleased()Returns true if native object is releasedstatic voidloadLibraries()static intmajorVersion()Get the libVLC major versionprotected ILibVLC.EventonEventNative(int eventType, long arg1, long arg2, float argf1, String args1)Called when libvlc send events.protected voidonReleaseNative()Called when native object is released (refcount is 0).voidrelease()Release the native object if ref count is 1.booleanretain()Increment internal ref count of the native object.protected voidsetEventListener(AbstractVLCEvent.Listener<T> listener)Set an event listener.protected voidsetEventListener(AbstractVLCEvent.Listener<T> listener, Handler handler)Set an event listener and an executor HandlervoidsetUserAgent(String name, String http)Sets the application name.static Stringversion()Get the libVLC version-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.videolan.libvlc.interfaces.IVLCObject
getLibVLC, isReleased, release, retain
-
-
-
-
Method Detail
-
version
public static String version()
Get the libVLC version- Returns:
- the libVLC version string
-
majorVersion
public static int majorVersion()
Get the libVLC major version- Returns:
- the libVLC major version, always >= 3
-
compiler
public static String compiler()
Get the libVLC compiler- Returns:
- the libVLC compiler string
-
changeset
public static String changeset()
Get the libVLC changeset- Returns:
- the libVLC changeset string
-
onEventNative
protected ILibVLC.Event onEventNative(int eventType, long arg1, long arg2, float argf1, @Nullable String args1)
Called when libvlc send events.- Parameters:
eventType- event typearg1- first argumentarg2- second argumentargf1- first float argument- Returns:
- Event that will be dispatched to listeners
-
getAppContext
public Context getAppContext()
- Specified by:
getAppContextin interfaceILibVLC
-
onReleaseNative
protected void onReleaseNative()
Called when native object is released (refcount is 0). This is where you must release native resources.
-
setUserAgent
public void setUserAgent(String name, String http)
Sets the application name. LibVLC passes this as the user agent string when a protocol requires it.- Parameters:
name- human-readable application name, e.g. "FooBar player 1.2.3"http- HTTP User Agent, e.g. "FooBar/1.2.3 Python/2.6.0"
-
loadLibraries
public static void loadLibraries()
-
isReleased
public boolean isReleased()
Returns true if native object is released- Specified by:
isReleasedin interfaceIVLCObject<T extends AbstractVLCEvent>
-
retain
public final boolean retain()
Increment internal ref count of the native object.- Specified by:
retainin interfaceIVLCObject<T extends AbstractVLCEvent>- Returns:
- true if media is retained
-
release
public final void release()
Release the native object if ref count is 1. After this call, native calls are not possible anymore. You can still call others methods to retrieve cached values. For example: if you parse, then release a media, you'll still be able to retrieve all Metas or Tracks infos.- Specified by:
releasein interfaceIVLCObject<T extends AbstractVLCEvent>
-
getLibVLC
public ILibVLC getLibVLC()
- Specified by:
getLibVLCin interfaceIVLCObject<T extends AbstractVLCEvent>
-
setEventListener
protected void setEventListener(AbstractVLCEvent.Listener<T> listener)
Set an event listener. Events are sent via the android main thread.- Parameters:
listener- seeAbstractVLCEvent.Listener
-
setEventListener
protected void setEventListener(AbstractVLCEvent.Listener<T> listener, Handler handler)
Set an event listener and an executor Handler- Parameters:
listener- seeAbstractVLCEvent.Listenerhandler- Handler in which events are sent. If null, a handler will be created running on the main thread
-
getInstance
public long getInstance()
-
-