码迷,mamicode.com
首页 > 移动开发 > 详细

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

时间:2017-05-23 00:33:57      阅读:438      评论:0      收藏:0      [点我收藏+]

标签:retain   显示   内容   播放器   position   enum   layer   lan   静态库   

使用注意

注意点
存放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;

 

 

 

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

标签:retain   显示   内容   播放器   position   enum   layer   lan   静态库   

原文地址:http://www.cnblogs.com/liuwj/p/6892014.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!