# put first demo address https://github.com/ssj1314/iOS-VLC-RTSP- making library is too big, I will not come up. Add it after downloading the framework on your web disk. Somebody teach me a lesson. ### Baidu net disk can also gather together live once. Link: http://pan.baidu.com/s/1sljIVTj password: ctak gay friends demo2 out small projects Pulled out library or too big, can put in the library directly. Link: https://pan.baidu.com/s/1hrETkAo password: 5 u6k

1. The VLC is introduced

What is VLC? (Borrowed, this is more complete)

VLC VLC Media Player (VideoLAN) provides a video player, decoder for Windows, Linux, OS X, Android, iOS Windows Phone, etc. It can play files from the network, camera, disk, CD drive, etc. Support including MPEG 1/2 /4, H264, VC-1, DivX, WMV, Vorbis format, AC3, AAC format decoding. VLC on Windows and Linux is written using C ++ / Qt to provide a consistent user experience. VLC is also native for OS X. Mac OS X VLC’s user interface is written using the Cocoa framework and has an excellent native experience in OS X.

  • VLC also has a very nice feature – playing video files that have not been downloaded in full.
  • VLC covers almost all media formats.

PS: Recently, the company wanted to make an App about train camera. I had no choice but to look for wheels. First, I found iJkPlayer, and I heard that it worked well. After a few articles, it worked. Haha, I felt so happy. It took me about two days and I had a headache many times in the middle, but I succeeded in the end. Write it down and talk about it as consolation. Come on baby!!

####2. How to download and use this is a powerful full platform player, almost all audio and video formats for playback, official website address :www.videolan.org/

  • IOS can also integrate THE SDK of VLC for development. Before using it, you need to download the SDK from the official website and compile it into the library file used in iOS before using it. This integration method requires VPN wall climbing for network compilation during compilation. Easy to compile error, if the connection is good, can according to the instructions of the wiki to compile: [https://wiki.videolan.org/iOSCompile]
  • The second way is to download this thing without compiling it. Just drag it into the project. Remember to check copy first. Then add the dependency library.

  • So, this problem is so difficult, I don’t want to compile it. Baidu cloud download line not – link: https://pan.baidu.com/s/1sk9QvxV password: trf4

I was scared to compile iJkPlayer, and I was in a hurry, so I chose the second option, which was simple and crude. Can also be cocoapods integration or direct download on the net – > download address: nightlies.videolan.org/build/ios/. After opening the page, drag to the bottom of the page to see the latest Mobilevlckit. framework, if the latest error, try another. I’m using version 2.2.2, which pod Search can find.

#####3. How to integrate on how to integrate, we recommend to see this article VLC integration and use, god has been very clear. Add a dependency library to your project (a little different, I don’t know if I’m using it wrong, mine is)

What I want to say is just some of the problems I have encountered, perhaps only I have encountered unfortunately, but I still hope to write it down. After the integration, the first compilation reported a bitcode error, then changed the bitcode to NO, and the VLC library used C++, so changed the appdelegate.m file to.mm. C++ standard library is the first option, all in build Settings. For that, check out this article, a simple Demo of VLC for iOS. This blogger has written two articles about VLC, with good graphics and pictures.

4. Specific usage

Because our project has low requirements for the camera, it is relatively simple to write, as long as the interface used, import the header file:

#import<MobileVLCKit/MobileVLCKit.h>
Copy the code

Declare the last property:

@property (nonatomic, strong)VLCMediaPlayer *player;

Copy the code

Then it’s easy to use.

- (void)viewDidLoad { UIView *videoView = [[UIView alloc] initWithFrame:CGRectMake(0, 50, self.view.bounds.size.width, 400)]; videoView.backgroundColor = [UIColor blackColor]; [self.view addSubview:videoView]; VLCMediaPlayer *player = [[VLCMediaPlayer alloc] initWithOptions:nil]; self.player = player; Self.player. drawable = videoView; NSURL *url = [NSURL URLWithString:@"RTSP: / / 10.0.0.89 session0. MPG"]; Self.player. media = [VLCMedia mediaWithURL:url]; // start playing [self.player play]; }Copy the code

#### if you don’t want to see words, see pictures

##### but this is the primary use, before the blog wrote very detailed, the need for complex use of students can go to him, address —-> VLC integration and use, and this encounter problems can see the reference to this article, based on iOS VLC simple Demo.

OK! That’s it. I’ll talk about it next time. Once again, twice. 😝 Love this image