[EDIT Feb 2012]:
It has been a pretty long time since I put this post together and a lot has changed in VLC, FFMPEG and iOS since then. Whilst I hope that there is still useful information here I am not sure that this guide should be considered up to date and correct anymore. Maybe one day I can find time to update it but I am just too busy with other projects for it to be top of my list.
Do keep leaving comments if you have corrections or new info and I will try and add them in.
[NOTE]:
Sorry but I am not able to distribute pre-built binaries for any part of this app so please don't waste time asking me to send you a compiled version, it probably wouldn't work anyways (code signing etc.)
I have been messing with the VLC iOS source recently to see if I could hack it up to work with the new airplay protocols for Apple TV. Sadly any airplay hook up is not going to be straight forward as the VLC player is not using a MPMoviePlayerController instance or subclass to display the movie. It's not clear yet if I can hijack the video stream from the custom view and pipe it over the hard way but I will keep hacking in spare moments.
Actually getting the source to compile was a bit of a mission and looking at the videolan forums there are a few others out there struggling to compile the sources too so here is how I managed it. There are quite a few steps so I have split it up into the three main tasks.
Build the Aggregate libraries.
- Install git if you don't have it already. You will need this to grab the latest source and for the build script to complete.
- Open up a terminal window and cd to the directory you want to download and build in.
- clone the MobileVLC.git repo.
git clone git://git.videolan.org/MobileVLC.git
- Open up buildMobileVLC.sh in your favourite editor.
- I had a problem with the build script failing trying to remove symbolic links that didn't exist. I fixed this by editing line 121 to wrap a remove in a conditional.
From:
To:rm External/MobileVLCKit
if [ -e External/MobileVLCKit ]; then rm External/MobileVLCKit fi
- If you have XCode setup to use a custom build location (for instance if you use a shared location to leverage project includes in your other projects) then the easiest way to get this working is to go to preferences and set the option back to the default (Place build products in project directory). If you don't do this then you will need to edit the buildMobileVLC.sh lines 117 and 118 so that the products can be found.
- In theory the buildMobileVLC.sh script should take a flag to set the SDK you want to use. However in practice I found that it didn't so edited all occurences of 3.2 to be 4.2.
At the time of writing a recent commit causes the AggregateStaticPlugins.sh script phase of MobileVLCKit to fail. Check that ImportedSources/vlc/projects/macosx/framework/MobileVLCKit/AggregateStaticPlugins.sh does not haveplugins+="access/access_mmap ". If it does then just delete this line.** This has been resolved in the latest revision.- In terminal cd into the MobileVLC directory and execute buildMobileVLC.sh passing the -s flag for simulator, then run it again without the flag to build for device. This is just so that later you can switch between simulator and device in XCode without any problem.
- The script will take a little while to run, especially first time out as it needs to bring in 2 repos from git.videolan.org and compile a metric ass ton of dependant libraries. There are a shocking amount of warnings and errors reported by the build of the libraries, no wonder building this thing is so brittle. Once its finished you are looking to see the magic words "Build complete" and you should be OK.
- Next open up the MobileVLC.xcodeproj. We will get it running from here in the simulator first.
- Select the project root and open up the inspector (get info). On the General tab set the "Base SDK for all configurations" to be the SDK you are using (in this case it was 4.2).
- Close the inspector and toggle the target select dropdown to debug then back to release so that the "missing base SDK" warning disappears.
- Now you can set the target hardware to Simulator and the active executable to iPad (although this guide should work for iPhone too).
- You can if you like hit build and run but the VLC app will crash as soon as it launches. This is because there is a bad path to the MediaLibrary data model for core data.
Expand the External/MediaLibraryKit group and select the MediaLibrary.xcdatamodel (it should be highlighted red showing there is a problem) and open inspector. - Hit choose to find the correct the path. Project relative it is ImportedSources/MediaLibraryKit/MediaLibrary.xcdatamodel.
- Finally you should be able to hit build and run and see the VLC app open up in the simulator.
- I am going to assume you already have a developer certificate and an application agnostic Team Provisioning Profile. If not then this next bit is of no use to you anyway.
- Select the MobileVLC target and open the inspector.
- On the build tab set the code signing entity to use your developer identity.
- Change the target to device in the target select dropdown, plug in your iPad and build and run.
- If the build fails at this point with something like:
Then go back to terminal and run buildMobileVLC.sh again with no flags.file was built for unsupported file format which is not the architecture being linked (armv7) Undefined symbols: "_OBJC_CLASS_$_VLCMediaPlayer", referenced from: objc-class-ref-to-VLCMediaPlayer in MVLCMovieViewController.o "_OBJC_CLASS_$_VLCMedia", referenced from: objc-class-ref-to-VLCMedia in MVLCMovieViewController.o "_OBJC_CLASS_$_VLCTime", referenced from: objc-class-ref-to-VLCTime in MVLCMovieGridViewCell.o "_OBJC_CLASS_$_MLMediaLibrary", referenced from: objc-class-ref-to-MLMediaLibrary in MobileVLCAppDelegate.o "_OBJC_CLASS_$_MLFile", referenced from: objc-class-ref-to-MLFile in MVLCMovieListViewController.o l_OBJC_$_CATEGORY_MLFile_$_HD in MLFile+HD.o ld: symbol(s) not found collect2: ld returned 1 exit status
- You should now be seeing the VLC app running on the iPad.