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; 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM