IOS VLC (第三方音频)的使用

使用注意

注意点
存放VLC的文件夹名不要有空格
一旦执行过编译脚本sh,就别再修改存放VLC的文件夹名
 

编译

打开最外层的工作空间

 

 

选择真机运行

 

编译

一些简单的示例程序

 

 

集成

 

静态库+头文件

 

依赖库
 
 
C++标准库

 

 

导入头文件, 播放视频

 

#import "VLCMediaPlayer.h"

 self.vlcPlayer = [[VLCMediaPlayer alloc] init];

self.vlcPlayer.drawable = self.view;
self.vlcPlayer.media = [VLCMedia mediaWithURL:[NSURL
URLWithString:@"http://streams.videolan.org/streams/mp4/Mr_Mr
sSmith-h264_aac.mp4"]];
[self.vlcPlayer play];


VLCMediaPlayer – 常见方法
播放控制
- (BOOL)play;
- (void)pause;
- (void)stop;
- (BOOL)isPlaying;
@property float rate; // 播放速率

 

播放进度
- (void)setTime:(VLCTime *)value; // 当前的播放时间
- (VLCTime *)time;
@property (readonly) VLCTime *remainingTime; // 剩余的播放时间

- (void)setPosition:(float)newPosition; // 播放进度(0.0 ~ 1.0)

- (float)position;

 

 

播放的内容
- (void)setMedia:(VLCMedia *)value;
- (VLCMedia *)media;

 

播放的载体(显示到哪里, 一般是一个UIView)

@property (retain) id drawable;

 

 

VLCMediaPlayer – 播放器的状态
 
播放器的状态
- (VLCMediaPlayerState)state;
enum {

        VLCMediaPlayerStateStopped,// 播放器已经停止

   VLCMediaPlayerStateOpening, // 流正在打开
   VLCMediaPlayerStateBuffering,// 流正在缓冲
   VLCMediaPlayerStateEnded,// 流已经结束 
   VLCMediaPlayerStateError,// 播放器产生了错误
   VLCMediaPlayerStatePlaying,// 流正在播放
   VLCMediaPlayerStatePaused// 流被暂停了  
 

};

 

VLCMediaPlayerDelegate
 
通过代理对象可以监听播放器的状态
当播放器的状态改变就调用

 

- (void)mediaPlayerStateChanged:(NSNotification
*)aNotification;

当播放器的时间改变就调用

- (void)mediaPlayerTimeChanged:(NSNotification
*)aNotification;

 

 

 

posted on 2017-05-22 23:16  守望星空  阅读(2960)  评论(0编辑  收藏  举报

导航