Installing MobileVLCKit in an iOS project

This forum is about all development around libVLC.
flarosa
New Cone
New Cone
Posts: 3
Joined: 13 Jan 2017 22:19

Installing MobileVLCKit in an iOS project

Postby flarosa » 13 Jan 2017 22:32

Hi,

I'm trying to get an iOS project going that uses MobileVLCKit.

First, I attempted to build the iOS version by following the instructions here:
https://wiki.videolan.org/VLCKit/

I executed the ./buildMobileVLCKit.sh -f command after cloning the repository. The script ran for about 15 minutes. I did not observe any error messages, however, I'm not sure if it was successful and what I should do next. I expected to find a MobileVLCKit.framework file somewhere, but I looked everywhere, and can't find it.

Next, I tried opening the MobileVLCKit.xcodeproj with Xcode, figuring I could build it from there. When I tried to build the first target (MobileVLCKit), I received an error that says "vlc-plugins-iPhone.h file not found". I also tried the StaticLibVLC target, which reports several libtool errors looking for files such as libvlc.a that do not exist.

Lastly, I decided to try the Cocoapods approach. I created a new single-view iOS project in Xcode, closed Xcode, and installed the 'MobileVLCKit' pod according to the instructions here:
https://cocoapods.org/pods/MobileVLCKit

This appears to have installed successfully. After opening the workspace file and attempting to build the project, I receive 78 linker errors. Most of them refer to things like std::ostream or std::string, etc.

I'm not sure what to do next, or what I did wrong. Can anyone help?

Thanks,
Frank

flarosa
New Cone
New Cone
Posts: 3
Joined: 13 Jan 2017 22:19

Re: Installing MobileVLCKit in an iOS project

Postby flarosa » 13 Jan 2017 22:50

Additionally, I can report that both of the sample projects include in the Cocoapod fail on my computer ('pod try MobileVLCKit').

flarosa
New Cone
New Cone
Posts: 3
Joined: 13 Jan 2017 22:19

Re: Installing MobileVLCKit in an iOS project

Postby flarosa » 13 Jan 2017 23:05

I also tried downloading a prepared nightly build of the framework... I put this in a brand-new empty project and tried to build the project. It failed with a linker error and a message saying "Framework not found".

This is very frustrating... does this library actually work? Is it some old thing that became obsolete at some point?

ssbmaccom
Cone that earned his stripes
Cone that earned his stripes
Posts: 184
Joined: 26 Nov 2015 15:21
Operating System: Mac OS, iOS, tvOS

Re: Installing MobileVLCKit in an iOS project

Postby ssbmaccom » 19 Jan 2017 18:23

To troubleshoot the issue we would need a bit more info.
Building for any Apple platform seems to be broken since early December and the repository has not been updated since Dec. 7th.

So go with the nightly. Instead of using a blank project first try with the samples. Then you can compare the frameworks used there with the ones in your project.

It needs a bit patience for the initial start but it is no rocket sience - it maybe took me a day to get it into my tvOS App including local build (no nightly at that time).
The work started when using VLCKit ;-)

sagarkrishna
New Cone
New Cone
Posts: 2
Joined: 23 Feb 2017 10:26

Re: Installing MobileVLCKit in an iOS project

Postby sagarkrishna » 23 Feb 2017 10:55

I had a similar feeling like @flarosa "does this library actually work ?" but then with determination and a lot of patience, I was able to make MobileVLCkit work seamlessly in my iOS swift project. Here are the steps I followed.

1. Create a dummy Xcode project, download MobileVLCkit using cocoa pods.
2.Copy the downloaded "MobileVLCKit.framework" file from the dummy project, into your project root folder.
3.Go to your project's target build settings and add the following lines to your "Header Search Paths" (add the quotes too)
"$(PROJECT_DIR)/MobileVLCKit.framework/Headers"
"$(BUILT_PRODUCTS_DIR)"
4. In your project's target build settings add the following lines to your framework search paths (add the quotes too)
"$(SRCROOT)/MobileVLCKit.framework"
"$(PROJECT_DIR)"
5. in Other linker flags add the following lines
-l"bz2"
-l"iconv"
-framework
"MobileVLCKit"
6.In General > Linked Frameworks and Libraries add the following library by clicking on the + icon
libstdc++.6.tbd
7.Most important of all add the reference to the Bridging-Header.h by including the following line
#import "MobileVLCKit/MobileVLCKit.h"

8.Test by typing VLCMediaPlayerDelegate, see if that auto completes. If so help others by pointing them here, else retrace your steps to see what you have missed.

Hope that helps.

kbroich
New Cone
New Cone
Posts: 1
Joined: 03 Apr 2017 07:45

Re: Installing MobileVLCKit in an iOS project

Postby kbroich » 03 Apr 2017 07:52

Man, thank you so much for sharing your effort. It worked right away with your instructions.

chustruth
New Cone
New Cone
Posts: 3
Joined: 04 May 2017 20:23

Re: Installing MobileVLCKit in an iOS project

Postby chustruth » 04 May 2017 20:42

Your solution works for me when I am starting a new project but otherwise I keep getting a linking error when I try to run it on my device, but it works well in the simulator. Does anyone know why this would happen?


Also when I am integrating with the box-ios-sdk cocoapod I always get a mach-o linking error.

DanielChen
New Cone
New Cone
Posts: 1
Joined: 16 May 2017 13:00

Re: Installing MobileVLCKit in an iOS project

Postby DanielChen » 17 May 2017 03:56

I got same problem when I try to run it on my device.

And I check my Reveal in Log it show this message " does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)".

So go project>Targets>Build Settings>search bitcode > Build Options > Enable Bitcode > set NO.

Rebuild Success.
Hope that helps.

ssbmaccom
Cone that earned his stripes
Cone that earned his stripes
Posts: 184
Joined: 26 Nov 2015 15:21
Operating System: Mac OS, iOS, tvOS

Re: Installing MobileVLCKit in an iOS project

Postby ssbmaccom » 17 May 2017 18:20

Be careful:
- disabling Bitcode is only a partial solution.Works for now, but once Apple will discard Apps without Bitcode enabled also on iOS. To prepare VLCKit with Bitcode make sure to use -fb as option, when building VLCKit.
- You should not use libstdc++, it may work but it has awful side effects. You should better use libc++.

Maybe your Pod is too old. There hasn't been successful nightlies for a long time. This is caused by an error when building the simulator version of VLCKit inside xcodebuild. When you open the Xcode Project and build it in Xcode, it works. Then you should run "./buildMobileVLCKit -fbln" again. This will skip repository updates and re-build of libVLC,only the xcodebuild step will be performed - and then it works.

1. ./buildMobileVLCKit -fb (or -tfb for tvOS)
2. open MobileVLCKit.xcodeproj in Xcode and build it
3. ./buildMobileVLCKit -fbln (or -tfbln) to finalize the xcodebuild

In the last step it will also run lipo to create a universal binary for device and simulator and prepare the package you desire (MobileVLCKit.framework) including the header files etc.
You can then use the framework for Device and Simulator... quite useful.

Problem is, that updates on VLCKit are late and often unstable - at the moment it fails to play TS-Streams with 720p h.264 contents... Audio works, but no video and it runs into a deadlock.

Needlerp
New Cone
New Cone
Posts: 4
Joined: 04 Mar 2019 09:18

Re: Installing MobileVLCKit in an iOS project

Postby Needlerp » 04 Mar 2019 09:20

Be careful:
- disabling Bitcode is only a partial solution.Works for now, but once Apple will discard Apps without Bitcode enabled also on iOS. To prepare VLCKit with Bitcode make sure to use -fb as option, when building VLCKit.
- You should not use libstdc++, it may work but it has awful side effects. You should better use libc++.

Maybe your Pod is too old. There hasn't been successful nightlies for a long time. This is caused by an error when building the simulator version of VLCKit inside xcodebuild. When you open the Xcode Project and build it in Xcode, it works. Then you should run "./buildMobileVLCKit -fbln" again. This will skip repository updates and re-build of libVLC,only the xcodebuild step will be performed - and then it works.

1. ./buildMobileVLCKit -fb (or -tfb for tvOS)
2. open MobileVLCKit.xcodeproj in Xcode and build it
3. ./buildMobileVLCKit -fbln (or -tfbln) to finalize the xcodebuild

In the last step it will also run lipo to create a universal binary for device and simulator and prepare the package you desire (MobileVLCKit.framework) including the header files etc.
You can then use the framework for Device and Simulator... quite useful.

Problem is, that updates on VLCKit are late and often unstable - at the moment it fails to play TS-Streams with 720p h.264 contents... Audio works, but no video and it runs into a deadlock.
Where do I find buildMobileVLCKit.sh from? I've tried downloading from the GitHub repository, but the only script available is compileAndBuildVLCKit.sh and when I run that I get the following errors:
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'SDKVersion' in SDK 'iphoneos'

Needlerp
New Cone
New Cone
Posts: 4
Joined: 04 Mar 2019 09:18

Re: Installing MobileVLCKit in an iOS project

Postby Needlerp » 08 Mar 2019 17:19

So I worked out that I needed to enable the command line in Xcode, and have managed to follow the instructions above and create MobileVLCKit.framework.

However, I've copied this across to the Xcode project folder and when I build my project I still get the following error:

ld: '/Users/PaulNeedler/Documents/XCode/iParcelBox/MobileVLCKit.framework/MobileVLCKit(lib.c.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 8 guests