Page 1 of 1

PureBasic & LibVLC

Posted: 23 Sep 2021 06:34
by collectordave
Hi all

New to the forum and to libvlc. Sorry if posted in the wrong place please move if necessary.

I am using a Mac m1 24 running Big Sur.

I use a language called PureBasic.

I am attempting to produce a LibVlc module for use in pureBasic to play audio.

So far I have VLC Version 2.2.8 Weatherwax (Intel 64bit) installed which plays any audio file I drop on it .ogg and MP3.

Which to me seems strange as I am on an M1 machine using the Apple silicon.

To start I would like to play a single song file and know when it has finished.

My code so far is:-
libVlc = GetUserDirectory(#PB_Directory_Documents) + "VlcTRY/VLC.app/Contents/MacOS/lib/libvlc.dylib"
SetEnvironmentVariable("VLC_PLUGIN_PATH", GetUserDirectory(#PB_Directory_Documents) + "VlcTRY/VLC.app/Contents/MacOS//plugins/")

hlib = OpenLibrary(#PB_Any, libVlc)

m_pVLCInstance = CallCFunction(hlib, "libvlc_new", 0, #Null)

m_pMediaPlayer = CallFunction(hlib, "libvlc_media_player_new", m_pVLCInstance)

Debug m_pVLCInstance
Debug m_pMediaPlayer
Both debugs return large numbers, no zeros.

Where do I go from here?

Any help appreciated.

Re: PureBasic & LibVLC

Posted: 24 Sep 2021 16:53
by collectordave
Making progress.

Another user on the PureBasic forum is showing the way and I can now play an audio file no bother even changing the playback volume!

Just a question.

I have split off the libs and plugins from the app, everything works fine is this allowed?

Re: PureBasic & LibVLC

Posted: 27 Sep 2021 04:16
by mfkl
I have split off the libs and plugins from the app, everything works fine is this allowed?
Not sure what you mean by that but why wouldn't it be?

I doubt many people here are familiar with purebasic tbh, but libvlc yes. Try to familiarize yourself with the docs https://videolan.videolan.me/vlc/group__libvlc.html and samples https://www.videolan.org/vlc/libvlc.html

Re: PureBasic & LibVLC

Posted: 27 Sep 2021 05:01
by collectordave
Thanks for the reply
I have split off the libs and plugins from the app, everything works fine is this allowed?
Not sure what you mean by that but why wouldn't it be?

I doubt many people here are familiar with purebasic tbh, but libvlc yes. Try to familiarize yourself with the docs https://videolan.videolan.me/vlc/group__libvlc.html and samples https://www.videolan.org/vlc/libvlc.html

I downloaded version 2.2.8 and then copied out the /Lib and /plugins to my project folder.

I have read the docs and now have a barebones audio player all working as I need it. This will allow other PB programmers to build their own audio players as they wish.

Re: PureBasic & LibVLC

Posted: 28 Sep 2021 08:07
by mfkl
I downloaded version 2.2.8
It is advised you use the latest 3.x version, as the 2.x is old, unmaintained and unsecure.