VLCMediaPlayer比苹果自带的播放器更强大,用法:
#import <UIKit/UIKit.h>
#import <MobileVLCKit/MobileVLCKit.h>
@interface ViewController : UIViewController {
UIView *videoView;
VLCMediaPlayer *vlcPlayer;
}
@end
#import “ViewController.h”
/* 确保选中 GNU C++ 而不是Apple的C++ */
@implementation ViewController
– (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
videoView = [[UIView alloc] initWithFrame:CGRectMake(10, 80, 300, 300)];
videoView.backgroundColor = [UIColor blackColor];
[self.view addSubview:videoView];
// 1. 创建一个播放器
vlcPlayer = [[VLCMediaPlayer alloc] initWithOptions:nil];
// 2. 让videoView作为vlc的视频播放的内