Instructions

open the “vlckit” xcode project from the code you cloned (under vlc/projects/macosx/vlckit) to your hard drive and build it (you get several errors, but that doesn’t matter)

create a new project “test-vlckit” where you’re going to use vlckit

in “test-vlckit” go to project-add files, add the vlckit .xcodeproj file (a.k.a. a cross-project reference) – use these instructions:

Using Separate Xcode Projects For Each Target

If you already have separate Xcode projects for your framework and application, you can take advantage of Xcodes cross-project references to embed the framework in your application. Cross-project references are a convenient way to create relationships between two separate Xcode projects. To set up a cross-project reference between your application and framework, you would do the following:

1) In your application project, choose Project > Add to Project and select your frameworks .xcodeproj file. Xcode adds the framework project and displays its products in the Groups & Files pane of your application project.
2) Modify the Build Products Path setting for both the application and framework targets so that they use the same build directory. You need to modify each target in their original Xcode project file.
3)In your application project, modify the Header Search Paths setting of the application target by adding the directories containing any framework header files.

– the important part is to change the build location of one of the two projects (I changed test-vlckit to that of vlckit by doubleclicking the project icon under groups&files and selecting as the custom build location the location of vlckit/build/Debug)
(- I dragged the vlckit framework file in the groups&files view to linked frameworks – this is probably not important)
– you can now import VLCKit/VLCKit.h and code away using vlckit
– I created a simple controller that plays a file from my hard drive in an NSView (that is created in the Interface Builder and connected to the controller’s videoHolderView):

update I: to get the release version to build without errors open project settings, build tab, select 64 bit only architecture (and the only build for this architecture checkbox), maybe set the compiler to LLVM 4.2 (not sure if this makes an impact) – keep the OS as OS X 10.6

update II: use vlckit without cross-project references
For deploying the application it’s probably simpler not to use a cross-project reference, but a normal framework installed on the system.

To do this, you need to build the VLCKit project as a release. To avoid build errors go to project settings, build tab and try to set the following:
– use only 64 bit, delete all the i386 stuff, and make sure all is 10.6
– use llvm gcc… but that is default
(- maybe turn off the garbage colloctor if it’s still not working)

Now do a full release build (it takes a few minutes – go fence with someone in the meantime).

Once it’s done copy the stuff from the build/Release folder (some vlc_buil stuff and the VLCKit.framework) to /Library/Frameworks.

Congrats, you should now be able to use VLCKit in new project by doing a simple “add existing frameworks to project”.

Epilogue

update III: after all the effort in setting this up, I was unsuccessful at getting the sound working, even after getting VLCKit to play an a/v stream, as discussed in this StackOverflow topic.

5 thoughts on “How to set up VLCKit in OS X”

I have been trying to make this work using the nightly builds of VLCkit (as of 06-Feb-2013). When playing any clip, the first image is rendered and then the process dies with EXC_BAD_ADDRESS in a function called vout_window_Control.
I read about the sound issues you had so did you abandon VLCKit altogether? What version of VLCKit did you do the above code with?

In the end we abandoned it, yes. Never could get that sound working properly and the docs were almost non-existent – basically you have to hunt through the VLC player code. We really had bad experience with all the streaming technologies available in OS X at the time – from QtKit onwards. In the end we had to do some nasty hacking to get anything usable working – opening an actual VLC with streaming/viewing options from the terminal to see the other person and using Applescript to fullscreen and focus the window. I don’t remember which version exactly were we using – it was two years ago. If I approached it again, I would probably try a more low-level approach – searching for a way to get standard C/C++ libraries for streaming (which I know are used in production-quality systems) like gstreamer plugged into Cocoa’s windowing and audio system. Good luck!

The crash in Control() was fixed by me last afternoon, so please update your git checkout (both of vlc and VLCKit) to get it to work. I also fixed some more stuff, which should ease the integration.

@Draen: I’m sorry to hear that the sound never worked out for you. FYI: We are working adding proper release management and documentation to VLCKit and we are always open to hear about any issues through our communication channels.

Felix, glad to hear that you’re improving it. VLC is the best video player – would be great to turn it into the best streaming framework for developers too! I feel kind of bad now that I didn’t try to pursue the official support channels back then while working on the project – lack of experience.