简体   繁体   中英

Cant set VLCKit for IOS

The last days I'm trying to make an app for IOS including VLCKit. I tried to follow all the methods and tutorials that I found, but I can not get the application to compile correctly.

I've tried using cocoapods pod 'MobileVLCKit', '~> 2.2' . But it ends up giving a compilation error, for lack of binaries, when I try to compile the application. I have told xcode not to use binaries, but that only causes more compilation errors, due to lack of functions. So I followed the advice of the Forum

  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.

But in the end it gives the same error.

............

Then I tried to add the libraries by hand, following the official documentation Documentation

But it never ends correctly. After much searching it seems that the latest version could have a failure. So I tried this Suggestion , But just as before it does not work.

  1. rm -Rf VLCKit # Delete the current clone of VLCKit to restart from new one.

  2. git clone https://code.videolan.org/videolan/VLCKit.git #clone VLCKit current version

  3. cd VLCKit #move to VLCKit directory

  4. git reset --hard 2453a955435b9cae2c1637274416a4841ce66909 #move to working commit version

  5. Edit buildMobileVLCKit.sh to add bitcode support using @ssbmaccom patch above

  6. ./buildMobileVLCKit.sh -fb #Build VLCKit for device and Simulator with bitcode

................

Any idea how to fix it?

My operating system is -> MacOS Sierra 10.12.6

The version of xcode is -> 9.0.1


Finally I have managed to make it work, both the video and the audio. Testing all the versions and confiurations of the library I have found one that seems to work, or at least does what I need.

pod 'MobileVLCKit-prod', '2.7.9'

Disabling the use of binaries.

You need add the MobileVLCKit.framework by yourself. 在此处输入图片说明

在此处输入图片说明

在此处输入图片说明 在此处输入图片说明

Have you tried with Cocoapods? It's really easy:

  1. Add the pod MobileVLCKit to your Podfile and run pod install
  2. After adding VLC as a pod, your project shouldn't link anymore. On my side, I have 78 link errors. To fix it, simply add an Objective-C++ file (for instance forVLCLink.mm )
  3. Once your project is compiling you can import MobileVLCKit in your bridging header.
  4. Here is how you play the video with MobileVLCKit :

     let mediaPlayer = VLCMediaPlayer() func playURI(uri: String) { mediaPlayer.drawable = self.movieView let url = URL(string: uri) let media = VLCMedia(url: url) mediaPlayer.media = media mediaPlayer.play() }

More information at the end of this article: https://hackernoon.com/live-stream-an-onvif-camera-on-your-ios-app-57fe9cead5a5

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM