Skip to content

charonn0/RB-libvlc

Repository files navigation

RB-libvlc

libvlc is the open-source multimedia library that powers VLC Media Player. RB-libvlc is libvlc binding for Realbasic and Xojo ("classic" framework) projects.

RB-libvlc under Windows 10

This screen shot depicts the RB-libvlc demo running on Windows 10

Highlights

Become a sponsor

If you use this code in a commercial project, or just want to show your appreciation, please consider sponsoring me through GitHub. https://github.com/sponsors/charonn0

Synopsis

There are two main modes of operation: using the VLCPlayer class to play media without a GUI and the VLCMediaPlayer which provides a GUI. libvlc also supports playlists through a separate PlayList interface.

Object Class Comment
VLCPlayer A media player session.
VLCMediaPlayer A media player session embedded in a Canvas control.
Medium A media resource such as a file or internet stream.
Equalizer An audio equalizer.
PlayList A list of Medium objects.
ListPlayer A specialized player for playing PlayLists.

To play a media file or stream, create an instance of the Medium class by converting from a URL(as string) or a FolderItem.

Example

 Dim vlc As New VLCPlayer
 vlc.Media = GetFolderItem("C:\example\music.mp3")
 vlc.Play()

Playback occurs asynchronously on a separate preemptive thread. You can determine the player state by querying the CurrentState property and/or by handling the ChangedState event.

How to incorporate libvlc into your Realbasic/Xojo project

Import the libvlc module

  1. Download the RB-libvlc project either in ZIP archive format or by cloning the repository with your Git client.
  2. Open the RB-libvlc project in REALstudio or Xojo. Open your project in a separate window.
  3. Copy the libvlc module into your project and save.

Ensure the VLC shared libraries are installed

Most systems do not have VLC (or libvlc) installed by default. You will need to ship the all the necessary files with your application. On Windows, these are libvlc.dll, libvlccore.dll, and the desired plugins in the plugins directory. For macOS refer to this forum thread for how to properly bundle the dylibs with your app.

RB-libvlc will raise a PlatformNotSupportedException when used if all required DLLs/SOs/DyLibs are not available at runtime.