@Sean C An exception of class libvlc.VLCException was not handled. The application must shut down.

Exception message: Volume percent is out of range (0-100)

I figured it out. The player can't change things like the volume, position, etc. until playback has begun. I'm not sure whether I'll try to code around this limitation, but now that I know the problem I can at least stop raising an exception for it.

I got it playing alright. I have 2 points in my wave file.Point 1 is where it starts playback from in the audio file. The variable is called startPoint 2 is when the audio playback stops. the variable is called audioendBoth are doubles that represent seconds.

The mystery for me how player.TimeMS, player.lengthMS, player.media.DurationMS, Player.position are represented in time.I usually get some astronomical 6 digit number. I also display the start and audioend points in minutes (2:45 for example).

If I want the playback to start from a certain point, I have to haveplayer.playplayer,position = startPlayer.volume = LLvolplayer.speed = LLrate

The speed and the volume work well while it's playing. The hard thing is setting the start position. I don't use a slider, I use a graphic of a wavefile with a bar moving across it (a timer fires and puts the bar according to player.TimeMS)

Andrew - you are a guru for putting this together! It's going to be way better than Windows media player and a nice replacement for quicktime (minus the recording which can be done with portaudio)

@Sean C The mystery for me how player.TimeMS, player.lengthMS, player.media.DurationMS, Player.position are represented in time.I usually get some astronomical 6 digit number.

TimeMS, DurationMS, and LengthMS are in milliseconds (1000=1sec.) as an Int64. The Position is a percentage of the whole length expressed as a Single between 0.0 and 1.0, such that a Position of 0.1234 is 12.34% of the total length (IDK why they chose to do it that way.)

Andrew - you are a guru for putting this together! It's going to be way better than Windows media player and a nice replacement for quicktime (minus the recording which can be done with portaudio)

Thanks! And libvlc can do recording/transcoding. I haven't quite got it figured out yet, but basically VLC command line parameters are applied to the Media, changing what the Player will do. For example this (should) convert an OGG file into and MP3.

As you can see, the command line parameters are pretty complex, and I don't really understand them yet (these were copied from the docs), but it seems libvlc can do pretty much anything the VLC application can do.

Cool - Once I've got this going, I'm going to put together a complete tutorial on it to get it going for playing - steps and points.My latest thing is working out the 1.0 percent thing as it applies to points in seconds. I thing it would be best do do this as a function which returns the single.

my idea:1. Get song duration in seconds = (1000=1sec. and a int64). if your number is 25.5 seconds long the time duration will be 25500 (so divide it by 1000 to get the seconds (store that as a single)

get your points in seconds

divide your point by your duration and you get a VLC position based on seconds!

It should work, it's basically the same way the demo switches to and from full screen. The only thing I'd mention is that playback is asynchronous and runs on a separate thread, so don't expect playback to have already started when the Play method returns. Read the VLCMediaPlayer.CurrentState property to determine what the player is doing right now (opening, buffering, playing, etc.)

hi Andrew,just found this topic/conversation while searching for an easy way to create a movie player that can handle basic .mkv playback.I cannot get the demo on https://github.com/charonn0/RB-libvlc to work under 2018r3. Is there something special i need to do to get it to work?thanks,Kristof

If you’ve got the most recent version of VLC then it might be their libraries that have changed. I’ve had some success using it with the last release, but their most recent update broke everything on the Mac. They changed how the paths were embedded into the libraries and nothing could be moved anymore. I was able to fix it using otool -L to see what they were doing and the using installNameTool to change the all the paths that reference @rpath to instead reference @executable_path. In order to get it to work I had to do that in all the VLC libraries and also in each and every one of the plugins as well. But upon doing that it did work. I don’t know if you’re on a mac or not or if this has anything to do with your problem. There may be a similar setting on windows that has changed as well. I worked for a while to actually recompile them with the proper load paths but that turned out to be an even worse pain. Ultimately I think I’ve given up on them anyway as I really needed them to load an RTSP stream and they just don’t do it reliably. They leak memory and eventually something hiccups and they can’t recover but hog 100% of a CPU just spinning on their buffer and never output another frame until you stop and restart the stream. I’ve been futzing with them on and off for years now as there is no other way to open an RTSP stream that I’m aware of but they just don’t work worth a darn. It’s very disappointing and maybe is how I”m doing it ;) Though I’ve started from Christians examples so I can’t be too far off the mark.

first I would make sure that you don’t keep the flag for gathering debug information turned on in the release as this just hangs around in memory as it builds up unless you read it out.

For an RTSP stream I can get it connect but after a few short minutes of streaming I get some stream error written to stderr but not an error event that I have figured out how to trap yet and then the stream halts and goes to 100% of a CPU and just sits there.

Even when it is working it seems to leak memory and after a while you have to close up and nil all the structures and restart with fresh ones or you’ll end up with all the memory. I haven’t tested this yet in that project, but it was true in the past.

It’s quite a bit of work to fix the loading paths for all the plugins. the otool -L output for the previous version that worked for me, or at least loaded properly looked like this:

otool -L ./libvlc.5.dylib./libvlc.5.dylib:@loader_path/lib/libvlc.5.dylib (compatibility version 11.0.0, current version 11.1.0)@loader_path/../lib/libvlccore.8.dylib (compatibility version 9.0.0, current version 9.1.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)

otool -L ./libvlccore.8.dylib ./libvlccore.8.dylib:@loader_path/lib/libvlccore.8.dylib (compatibility version 9.0.0, current version 9.1.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 635.21.0) /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 53.0.0)

but the new versions which won’t load are built differently and they look like this now:

otool -L ./libvlc.5.dylib ./libvlc.5.dylib:@rpath/libvlc.dylib (compatibility version 12.0.0, current version 12.0.0)@rpath/libvlccore.dylib (compatibility version 10.0.0, current version 10.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)

./libvlccore.9.dylib ./libvlccore.9.dylib:@rpath/libvlccore.dylib (compatibility version 10.0.0, current version 10.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1452.23.0) /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 822.31.0)

that @rpath does not work outside of the regular VLC app somehow. Or perhaps there is a way to change the links as we load them into XTension, but I don’t think so. The libraries need to be able to find each other. Or perhaps we can actually set that @rpath in the environment for our app and have it come out right? I used the install_name_tool to change the names and links of the libraries so that they could find each other.

I can share exactly what I did, at least it will let the libraries load and then you can figure out if you can use it for what you want to do. Updating libvlc.5.dylib requires changing both it’s own id parm and one of the links like this: I ran these from inside the same folder as the libraries:

otool -L ./libvlc.5.dylib./libvlc.5.dylib:@executable_path/lib/libvlc.dylib (compatibility version 12.0.0, current version 12.0.0)@executable_path/lib/libvlccore.dylib (compatibility version 10.0.0, current version 10.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)

and so forth, i just built myself a batch file to run them all as there are a LOT of them. Probably I don’t need them all and could remove most of them but I haven’t experimented with that.

if you do that and just hard copy them into the app in the same format as the MBS example creates the folders and sym links then they will load. They still won’t work yet though as you’ll get an error about an incompatible plugin cache as the version that the app loads and caches is obviously not the same, so you need to tell VLC at startup not to use the plugin cache. You can do that in the init methods where you startup the libraries and pass some “command line” parms to the constructor of the VLCInstance. The parms I’m using are basically the same as the MBS example with the addition of “--no-plugins-cache” like this:

NOW it should load and actually run the examples. You can’t use the MBS example code to debug copy libraries or whatever it was called as it will just copy the unaltered libraries from inside the VLC app and these altered ones won’t run from inside the VLC app, or actually maybe they would I didn’t try that... so I rebuilt that example code to copy them from a different location relative to my project folder and then create the same symlinks as is done in the MBS example.

I THINK that was all I had to do to get them to load the latest versions and actually run ;) If it doesn’t work I can go through it all again but thats my notes. After you get it actually to load and run then you can figure out if it’s going to work OK for your application or if it’s going to crash out or leak too much memory or whatever else.

The most frustrating part of it for me is that after all that even when it’s properly playing the RTSP stream there is about a 2 second delay from reality. None of the parms to set the stream to realtime or reduce the buffer size seem to make any difference, which makes it not so great for my purposes anyway. I can probably find ways around the memory leak and the stream crashing and going to 100%CPU by just restarting everything. Which will mean that there will be 2 or 3 second gaps in any recordings I’m making as it restarts the stream but still it might work. The 2 second delay I’m not sure I can do anything about. I’m not aware of any other way to handle an RTSP stream on the Mac right now. I may explore handling it natively myself if I have to, but ugh... Quick Time used to handle it just fine, but you can’t link those libraries in anymore. I have to use xojo 2013 in order to link in the MBS quick time plugin and that does work, but thats so old I can’t consider that a real solution going forward. AVFoundation does not do RTSP only HTTP streaming. It’s been a while since I’ve looked into that though, so maybe something else has changed ;) Sometimes a project is just a honey pot that never lets you get it done ;) and reading RTSP streams has been one for me definitely.

@Sean C My experience wasn't very good. On the Mac side things went pretty good, but on Windows we had a ton of issues from users and pulled VLC and went back to the standard video player. Some Windows users had no issues but a significant number of them did and we could never figure out the cause. Your mileage may vary but I'd approach VLC with caution and do significant testing in Windows.

hi i think My experience wasn't great. On the Mac side things went entirely great, yet on Windows we had a huge amount of issues from clients and pulled VLC and returned to the standard video player. A few Windows clients had no issues yet a critical number of them did and we would never make sense of the reason. Your mileage may shift yet I'd approach VLC with alert and do noteworthy testing in Windows.

@drak15 f hi i think My experience wasn't great. On the Mac side things went entirely great, yet on Windows we had a huge amount of issues from clients and pulled VLC and returned to the standard video player. A few Windows clients had no issues yet a critical number of them did and we would never make sense of the reason. Your mileage may shift yet I'd approach VLC with alert and do noteworthy testing in Windows.

FWW:Do not forget to license the codecs at Fraunhofer and MPEGLA ( only ask for the decode license and not encode licenses - it's a bit cheaper).I got burned with my app that uses VLC and had to pay back fee licenses that eventually killed my app.