1. 程式人生 > >ijkplayer 引數文件

ijkplayer 引數文件

  • 摘要:ijkplayer引數說明文件IJKMediaPlayback#pragmamark-IJKMediaPlayback#pragmamark通知IJKMPMediaPlaybackIsPreparedToPlayDidChangeNotification;//播放狀態的改變代替MPMoviePlayerContentPreloadDidFinishNotificationIJKMPMoviePlayerScalingModeDidChangeNotification;//縮放 

  • ijkplayer 引數說明文件 
    IJKMediaPlayback 
    #pragma mark - IJKMediaPlayback 
    #pragma mark 通知 
    IJKMPMediaPlaybackIsPreparedToPlayDidChangeNotification; // 播放狀態的改變 代替 MPMoviePlayerContentPreloadDidFinishNotification 
    IJKMPMoviePlayerScalingModeDidChangeNotification; // 縮放比例的改變 
    IJKMPMoviePlayerPlaybackDidFinishNotification; 
    IJKMPMoviePlayerPlaybackDidFinishReasonUserInfoKey; // NSNumber (IJKMPMovieFinishReason) 
    當電影播放結束或使用者退出播放時呼叫。 
    IJKMPMoviePlayerPlaybackStateDidChangeNotification; // 使用者改變播放狀態改變時呼叫 
    IJKMPMoviePlayerLoadStateDidChangeNotification; // 當網路載入狀態發生變化時。 
    IJKMPMoviePlayerIsAirPlayVideoActiveDidChangeNotification; // 當視訊通過 AirPlay 開始播放視訊或結束時呼叫 
    Movie Property Notifications 
    屬性相關的同時宣告 
    IJKMPMovieNaturalSizeAvailableNotification; // 在執行 prepareToPlay 時開始非同步確定影片屬性,當相關屬性變為有效可用時呼叫該通知 
    IJKMPMoviePlayerVideoDecoderOpenNotification; // 視訊 編譯器開啟通知 
    IJKMPMoviePlayerFirstVideoFrameRenderedNotification; // 視訊 視訊第一幀時通知 
    IJKMPMoviePlayerFirstAudioFrameRenderedNotification; // 視訊 音訊第一段時通知 
    #pragma mark 列舉 
    typedef NS_OPTIONS(NSUInteger, IJKMPMovieLoadState) { 
    IJKMPMovieLoadStateUnknown = 0, // 未知狀態 
    IJKMPMovieLoadStatePlayable = 1 << 0, // 
    IJKMPMovieLoadStatePlaythroughOK = 1 << 1, // 當shouldAutoPlay 為Yes時,將開始在這種狀態 
    IJKMPMovieLoadStateStalled = 1 << 2, // 播放後,自動設定為該方法 
    }; 
    typedef NS_ENUM(NSInteger, IJKMPMoviePlaybackState) { 
    IJKMPMoviePlaybackStateStopped, // 播放停止 
    IJKMPMoviePlaybackStatePlaying, // 開始播放 
    IJKMPMoviePlaybackStatePaused, // 暫停播放 
    IJKMPMoviePlaybackStateInterrupted, // 播放間斷 
    IJKMPMoviePlaybackStateSeekingForward, // 播放快進 
    IJKMPMoviePlaybackStateSeekingBackward // 播放後退 
    }; 
    typedef NS_ENUM(NSInteger, IJKMPMovieScalingMode) { 
    IJKMPMovieScalingModeNone, // 沒有縮放比例 
    IJKMPMovieScalingModeAspectFit, //尺寸比例不變填滿螢幕為止 
    IJKMPMovieScalingModeAspectFill, // 尺寸比例不變填滿螢幕,可能造成內容缺少 
    IJKMPMovieScalingModeFill // 尺寸比例變形也會填滿螢幕 
    }; 

    int reason =[[[notification userInfo] valueForKey:IJKMPMoviePlayerPlaybackDidFinishReasonUserInfoKey] intValue]; 
    用於IJKMPMoviePlayerPlaybackDidFinishReasonUserInfoKey通知中,判斷reason為一列舉 
    typedef NS_ENUM(NSInteger, IJKMPMovieFinishReason) { 
    IJKMPMovieFinishReasonPlaybackEnded, // 完成原因:播放結束 
    IJKMPMovieFinishReasonPlaybackError, // 完成原因:播放出現錯誤 
    IJKMPMovieFinishReasonUserExited // 完成原因:出現使用者行為退出 
    }; 

    Thumbnails (縮圖) 
    獲取在指定播放時間的視訊縮圖,第一個引數是獲取縮圖的時間點陣列;第二個引數代表時間點精度,列舉型別 
    typedef NS_ENUM(NSInteger, IJKMPMovieTimeOption) { 
    IJKMPMovieTimeOptionNearestKeyFrame, // 時間點附近 
    IJKMPMovieTimeOptionExact //準確時間 
    }; 
    #pragma mark Attribute 
    @property(nonatomic, readonly) UIView *view; // 用於顯示視訊播放的view,呼叫次view 
    @property(nonatomic) NSTimeInterval currentPlaybackTime; // 當前播放的時間點 
    @property(nonatomic, readonly) NSTimeInterval duration; // 總時長 
    @property(nonatomic, readonly) NSTimeInterval playableDuration; // 可播放時長 
    @property(nonatomic, readonly) NSInteger bufferingProgress; // 緩衝進度 
    @property(nonatomic, readonly) BOOL isPreparedToPlay; // 準備播放 
    @property(nonatomic, readonly) IJKMPMoviePlaybackState playbackState; // 播放終止狀態列舉 
    @property(nonatomic, readonly) IJKMPMovieLoadState loadState; // 載入狀態列舉 
    @property(nonatomic, readonly) int64_t numberOfBytesTransferred; // 傳輸位元組數 
    @property(nonatomic, readonly) CGSize naturalSize; // 視訊原始顯示View size, 
    @property(nonatomic) IJKMPMovieScalingMode scalingMode; // 視訊尺寸模式 
    @property(nonatomic) BOOL shouldAutoplay; // 需要自動播放 
    @property (nonatomic) BOOL allowsMediaAirPlay; // 支援AirPlay 媒體 
    @property (nonatomic) BOOL isDanmakuMediaAirPlay; // 支援彈幕AirPlay媒體 
    @property (nonatomic, readonly) BOOL airPlayMediaActive; AirPlay 是否活躍 
    @property (nonatomic) float playbackRate; // 返回音訊/視訊的當前播放速度 0-1 
    - (UIImage *)thumbnailImageAtCurrentTime; //獲取當前時間的封面幀圖片 
    IJKMediaUrlOpenDelegate &;&; IJKMediaUrlOpenData 
    typedef NS_ENUM(NSInteger, IJKMediaUrlOpenType) { 
    IJKMediaUrlOpenEvent_ConcatResolveSegment = 0x10000, 
    IJKMediaUrlOpenEvent_TcpOpen = 0x10001, 
    IJKMediaUrlOpenEvent_HttpOpen = 0x10002, 
    IJKMediaUrlOpenEvent_LiveOpen = 0x10004, 
    }; 
    - (id)initWithUrl:(NSString *)url 
    openType:(IJKMediaUrlOpenType)openType 
    segmentIndex:(int)segmentIndex 
    retryCounter:(int)retryCounter; 
    @property(nonatomic, readonly) IJKMediaUrlOpenType openType; 
    @property(nonatomic, readonly) int segmentIndex; 
    @property(nonatomic, readonly) int retryCounter; // 重試次數 
    @property(nonatomic, retain) NSString *url; 
    @property(nonatomic) int error; // 錯誤提示,發生錯誤該屬性為負 
    @property(nonatomic, getter=isHandled) BOOL handled; // 如果url發生改變,該數值變為Yes 
    @property(nonatomic, getter=isUrlChanged) BOOL urlChanged; // 通過改變url設定為YES 
    IJKMediaModule 
    @property(atomic, getter=isAppIdleTimerDisabled) BOOL appIdleTimerDisabled; // 如果不希望在執行程式時鎖屏 ,設定為YES 
    @property(atomic, getter=isMediaModuleIdleTimerDisabled) BOOL mediaModuleIdleTimerDisabled; 
    IJKFFOptions 
    typedef enum IJKFFOptionCategory { 
    kIJKFFOptionCategoryFormat = 1, 
    kIJKFFOptionCategoryCodec = 2, 
    kIJKFFOptionCategorySws = 3, 
    kIJKFFOptionCategoryPlayer = 4, 
    } IJKFFOptionCategory; 

    // 解碼器選項 skip_loop_filter &; skip_frame 
    typedef enum IJKAVDiscard { 
    /* We leave some space between them for extensions (drop some 
    * keyframes for intra-only or drop just some bidir frames). */ 
    IJK_AVDISCARD_NONE =-16, ///< discard nothing 
    IJK_AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi 
    IJK_AVDISCARD_NONREF = 8, ///< discard all non reference 
    IJK_AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames 
    IJK_AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes 
    IJK_AVDISCARD_ALL = 48, ///< discard all 
    } IJKAVDiscard; 

    +(IJKFFOptions *)optionsByDefault; //初始化用 
    -(void)applyTo:(struct IjkMediaPlayer *)mediaPlayer; 
    - (void)setOptionValue:(NSString *)value forKey:(NSString *)key ofCategory:(IJKFFOptionCategory)category; 
    - (void)setOptionIntValue:(int64_t)value forKey:(NSString *)key ofCategory:(IJKFFOptionCategory)category; 

    -(void)setFormatOptionValue: (NSString *)value forKey:(NSString *)key; 
    -(void)setCodecOptionValue: (NSString *)value forKey:(NSString *)key; 
    -(void)setSwsOptionValue: (NSString *)value forKey:(NSString *)key; 
    -(void)setPlayerOptionValue: (NSString *)value forKey:(NSString *)key; 
    -(void)setFormatOptionIntValue: (int64_t)value forKey:(NSString *)key; 
    -(void)setCodecOptionIntValue: (int64_t)value forKey:(NSString *)key; 
    -(void)setSwsOptionIntValue: (int64_t)value forKey:(NSString *)key; 
    -(void)setPlayerOptionIntValue: (int64_t)value forKey:(NSString *)key; // value:1 forKey:@"videotoolbox";開啟硬體解碼 
    @property(nonatomic) BOOL useRenderQueue; // 使用渲染佇列 
    @property(nonatomic) BOOL showHudView; // 顯示載入指示器檢視 

    由Options 中可得知它的所有屬性
    start-on-prepared (開始準備);
    overlay-format、max-fps(最大fps);
    framedrop(跳幀開關);
    videotoolbox-max-frame-width(指定最大寬度);
    videotoolbox(播放工具模組);
    video-pictq-size ;
    ijkinject-opaque;
    user-agent ;
    auto_convert(自動旋轉螢幕開關);
    timeout(超時時間);
    reconnect (重連次數);
    safe ;
    skip_frame;
    skip_loop_filter;
    使用方法如下:


    [options setPlayerOptionIntValue:29.97 forKey:@"r"]; // 幀速率(fps)可以改,確認非標準楨率會導致音畫不同步,所以只能設定為15或者29.97) 
    [options setPlayerOptionIntValue:512 forKey:@"vol"]; // 設定音量大小,256為標準音量。(要設定成兩倍音量時則輸入512,依此類推 
    [options setPlayerOptionIntValue:30 forKey:@"max-fps"]; // 最大fps 
    [options setPlayerOptionIntValue:0 forKey:@"framedrop"]; // 跳幀開關 
    [options setPlayerOptionIntValue:960 forKey:@"videotoolbox-max-frame-width"]; // 指定最大寬度 
    [options setFormatOptionIntValue:0 forKey:@"auto_convert"]; // 自動旋轉螢幕開關 
    [options setFormatOptionIntValue:1 forKey:@"reconnect"]; // 重連次數 
    [options setFormatOptionIntValue:30 * 1000 * 1000 forKey:@"timeout"]; // 超時時間,timeout引數只對http設定有效,若果你用rtmp設定timeout,ijkplayer內部會忽略timeout引數。rtmp的timeout引數含義和http的不一樣。 
    _player = [[IJKFFMoviePlayerController alloc] initWithContentURL:self.url withOptions:options]; 
    IJKFFMoviePlayerController 
    // LogLevel 日誌等級 
    typedef enum IJKLogLevel { 
    k_IJK_LOG_UNKNOWN = 0, //未知 
    k_IJK_LOG_DEFAULT = 1, //預設 
    k_IJK_LOG_VERBOSE = 2, //詳細 
    k_IJK_LOG_DEBUG = 3, //除錯 
    k_IJK_LOG_INFO = 4, //詳情資訊 
    k_IJK_LOG_WARN = 5, //警告 
    k_IJK_LOG_ERROR = 6, //錯誤 
    k_IJK_LOG_FATAL = 7, //致命 
    k_IJK_LOG_SILENT = 8, // 
    } IJKLogLevel; 

    - (id)initWithContentURL:(NSURL *)aUrl 
    withOptions:(IJKFFOptions *)options; 
    - (id)initWithContentURLString:(NSString *)aUrlString 
    withOptions:(IJKFFOptions *)options; 
    - (void)prepareToPlay; // 播放準備 
    - (void)play; // 播放 
    - (void)pause; // 暫停 
    - (void)stop; // 停止播放 
    - (BOOL)isPlaying; // 是否正在播放中 
    - (void)setPauseInBackground:(BOOL)pause; // 後臺暫停 
    - (BOOL)isVideoToolboxOpen; // 視訊工具欄是否開啟(一般不用這個,太醜) 
    + (void)setLogReport:(BOOL)preferLogReport; // 日誌報告輸出 
    + (void)setLogLevel:(IJKLogLevel)logLevel; // 日誌報告等級 
    + (BOOL)checkIfFFmpegVersionMatch:(BOOL)showAlert; // 檢查版本是否匹配 
    + (BOOL)checkIfPlayerVersionMatch:(BOOL)showAlert // 檢查版本是否匹配 
    major:(unsigned int)major 
    minor:(unsigned int)minor 
    micro:(unsigned int)micro; 
    @property(nonatomic, readonly) CGFloat fpsInMeta; // fps 率 
    @property(nonatomic, readonly) CGFloat fpsAtOutput; // fps輸出值 
    - (void)setOptionValue:(NSString *)value forKey:(NSString *)key ofCategory:(IJKFFOptionCategory)category; 
    - (void)setOptionIntValue:(int64_t)value forKey:(NSString *)key ofCategory:(IJKFFOptionCategory)category; 

    - (void)setFormatOptionValue: (NSString *)value forKey:(NSString *)key; 
    - (void)setCodecOptionValue: (NSString *)value forKey:(NSString *)key; 
    - (void)setSwsOptionValue: (NSString *)value forKey:(NSString *)key; 
    - (void)setPlayerOptionValue: (NSString *)value forKey:(NSString *)key; 
    - (void)setFormatOptionIntValue: (int64_t)value forKey:(NSString *)key; 
    - (void)setCodecOptionIntValue: (int64_t)value forKey:(NSString *)key; 
    - (void)setSwsOptionIntValue: (int64_t)value forKey:(NSString *)key; 
    - (void)setPlayerOptionIntValue: (int64_t)value forKey:(NSString *)key; 
    @property (nonatomic, retain) id<IJKMediaUrlOpenDelegate> segmentOpenDelegate; 
    @property (nonatomic, retain) id<IJKMediaUrlOpenDelegate> tcpOpenDelegate; 
    @property (nonatomic, retain) id<IJKMediaUrlOpenDelegate> httpOpenDelegate; 
    @property (nonatomic, retain) id<IJKMediaUrlOpenDelegate> liveOpenDelegate;