當(dāng)配置好ijkframework以后秒啦,就可以先拋開(kāi)采集不說(shuō)余境,講講播放了
ijk初始化的時(shí)候需要兩個(gè)參數(shù)1:url? ? ? 2:option
url就是視頻播放地址? ?option就是硬件控制
//開(kāi)啟硬件解碼
[options setPlayerOptionIntValue:1 forKey:@"videotoolbox"];
// 幀速率(fps) (可以改灌诅,確認(rèn)非標(biāo)準(zhǔn)楨率會(huì)導(dǎo)致音畫(huà)不同步,所以只能設(shè)定為15或者29.97)
[options setPlayerOptionIntValue:29.97 forKey:@"r"];
// 設(shè)置音量大小猜拾,256為標(biāo)準(zhǔn)音量。(要設(shè)置成兩倍音量時(shí)則輸入512侥涵,依此類推)
[options setPlayerOptionIntValue:512 forKey:@"vol"];
// 最大fps
[options setPlayerOptionIntValue:30 forKey:@"max-fps"];
// 跳幀開(kāi)關(guān)
[options setPlayerOptionIntValue:0 forKey:@"framedrop"];
// 指定最大寬度
[options setPlayerOptionIntValue:960 forKey:@"videotoolbox-max-frame-width"];
// 自動(dòng)轉(zhuǎn)屏開(kāi)關(guān)
[options setFormatOptionIntValue:0 forKey:@"auto_convert"];
// 重連次數(shù)
[options setFormatOptionIntValue:1 forKey:@"reconnect"];
// 超時(shí)時(shí)間,timeout參數(shù)只對(duì)http設(shè)置有效务豺,若果你用rtmp設(shè)置timeout,ijkplayer內(nèi)部會(huì)忽略timeout參數(shù)笼沥。rtmp的timeout參數(shù)含義和http的不一樣娶牌。
[options setFormatOptionIntValue:30 * 1000 * 1000 forKey:@"timeout"];
二,初始化的ijk的對(duì)象也有2個(gè)屬性
// 填充fill
moviePlayer.scalingMode=IJKMPMovieScalingModeAspectFill;
// 設(shè)置自動(dòng)播放
moviePlayer.shouldAutoplay=YES;