PLVLivePlayerDelegate

Objective-C

@protocol PLVLivePlayerDelegate <NSObject>

@optional
/// 直播播放器 ‘加载状态’ 发生改变
///
/// @param livePlayer 直播播放器
/// @param loadState 当前加载状态
- (void)plvLivePlayer:(PLVLivePlayer *)livePlayer loadStateDidChanged:(PLVLivePlayerLoadState)loadState;

/// 直播播放器 ‘流状态’ 更新
///
/// @param livePlayer 直播播放器
/// @param newestStreamState 当前最新的 ’流状态’
/// @param streamStateDidChanged ’流状态‘ 相对上一次 是否发生变化
- (void)plvLivePlayer:(PLVLivePlayer *)livePlayer streamStateUpdate:(PLVChannelLiveStreamState)newestStreamState streamStateDidChanged:(BOOL)streamStateDidChanged;

/// 直播播放器 发生错误
///
/// @param livePlayer 直播播放器
/// @param error 错误信息对象 (可能为nil;error.code 可详见 PLVFPlayErrorCodeGenerator.h)
- (void)plvLivePlayer:(PLVLivePlayer *)livePlayer loadMainPlayerFailureWithError:(NSError * _Nullable)error;

/// 直播播放器 ‘频道信息’ 发生改变
///
/// @param livePlayer 直播播放器
/// @param channelInfo 当前最新 ’频道信息‘ 对象
- (void)plvLivePlayer:(PLVLivePlayer *)livePlayer channelInfoDidUpdated:(PLVChannelInfoModel *)channelInfo;

/// 直播播放器 ‘码率可选项、当前码率、线路可选数、当前线路‘ 更新
///
/// @note 此回调触发时,可同时在 [channelInfo] 属性中,读取出 ‘码率信息、线路信息’ 的最新值;
///       调用 [switchToLineIndex:codeRate:] 切换 ’当前线路‘ 或 ’当前码率‘,会触发此回调;
///       [channelInfo] 刷新时,也会触发此回调,用于告知当前 ‘码率信息、线路信息’ 的最新值;
///
/// @param livePlayer 直播播放器
/// @param codeRateOptions 码率/清晰度 可选项字符串数组
/// @param currentCodeRate 当前 码率/清晰度
/// @param lineNum 线路可选数
/// @param currentLineIndex 当前线路下标 (由 0 起始)
- (void)plvLivePlayer:(PLVLivePlayer *)livePlayer codeRateOptions:(NSArray <NSString *> *)codeRateOptions currentCodeRate:(NSString *)currentCodeRate lineNum:(NSInteger)lineNum currentLineIndex:(NSInteger)currentLineIndex;

/// 直播播放器 需获知外部 ‘当前是否正在连麦’
///
/// @note 此回调不保证在主线程触发
///
/// @param livePlayer 直播播放器
///
/// @return BOOL 需返回 ‘当前外部是否正在连麦’ 的状态布尔值
- (BOOL)plvLivePlayerGetInLinkMic:(PLVLivePlayer *)livePlayer;

/// 直播播放器 需获知外部 ‘当前是否暂停观看无延迟’
///
/// @note 此回调不保证在主线程触发
///
/// @param livePlayer 直播播放器
///
/// @return BOOL 需返回 ‘当前外部是否正在连麦’ 的状态布尔值
- (BOOL)plvLivePlayerGetPausedWatchNoDelay:(PLVLivePlayer *)livePlayer;

/// 直播播放器 需展示暖场图片
///
/// @param livePlayer 直播播放器
/// @param show 是否展示 (YES:展示 NO:隐藏)
/// @param warmUpImageURLString 暖场图片链接地址
- (void)plvLivePlayer:(PLVLivePlayer *)livePlayer showWarmUpImage:(BOOL)show warmUpImageURLString:(NSString * _Nullable)warmUpImageURLString;

/// 直播播放器 快直播网络质量检测回调
///
/// @note 仅在 快直播观看 时会触发该回调(即 [quickLiveWatching]为YES时);
///
/// @param livePlayer 直播播放器
/// @param netWorkQuality 网络质量
- (void)plvLivePlayer:(PLVLivePlayer *)livePlayer quickLiveNetworkQuality:(PLVLivePlayerQuickLiveNetworkQuality)netWorkQuality;

@end

Swift

protocol PLVLivePlayerDelegate : NSObjectProtocol

Undocumented

  • 直播播放器 ‘加载状态’ 发生改变

    Declaration

    Objective-C

    - (void)plvLivePlayer:(nonnull PLVLivePlayer *)livePlayer
        loadStateDidChanged:(PLVLivePlayerLoadState)loadState;

    Swift

    optional func plvLivePlayer(_ livePlayer: PLVLivePlayer, loadStateDidChanged loadState: PLVLivePlayerLoadState)

    Parameters

    livePlayer

    直播播放器

    loadState

    当前加载状态

  • 直播播放器 ‘流状态’ 更新

    Declaration

    Objective-C

    - (void)plvLivePlayer:(nonnull PLVLivePlayer *)livePlayer
            streamStateUpdate:(PLVChannelLiveStreamState)newestStreamState
        streamStateDidChanged:(BOOL)streamStateDidChanged;

    Swift

    optional func plvLivePlayer(_ livePlayer: PLVLivePlayer, streamStateUpdate newestStreamState: PLVChannelLiveStreamState, streamStateDidChanged: Bool)

    Parameters

    livePlayer

    直播播放器

    newestStreamState

    当前最新的 ’流状态’

    streamStateDidChanged

    ’流状态‘ 相对上一次 是否发生变化

  • 直播播放器 发生错误

    Declaration

    Objective-C

    - (void)plvLivePlayer:(nonnull PLVLivePlayer *)livePlayer
        loadMainPlayerFailureWithError:(NSError *_Nullable)error;

    Swift

    optional func plvLivePlayer(_ livePlayer: PLVLivePlayer, loadMainPlayerFailureWithError error: Error?)

    Parameters

    livePlayer

    直播播放器

    error

    错误信息对象 (可能为nil;error.code 可详见 PLVFPlayErrorCodeGenerator.h)

  • 直播播放器 ‘频道信息’ 发生改变

    Declaration

    Objective-C

    - (void)plvLivePlayer:(nonnull PLVLivePlayer *)livePlayer
        channelInfoDidUpdated:(nonnull PLVChannelInfoModel *)channelInfo;

    Swift

    optional func plvLivePlayer(_ livePlayer: PLVLivePlayer, channelInfoDidUpdated channelInfo: PLVChannelInfoModel)

    Parameters

    livePlayer

    直播播放器

    channelInfo

    当前最新 ’频道信息‘ 对象

  • 直播播放器 ‘码率可选项、当前码率、线路可选数、当前线路‘ 更新

    Note

    此回调触发时,可同时在 [channelInfo] 属性中,读取出 ‘码率信息、线路信息’ 的最新值; 调用 [switchToLineIndex:codeRate:] 切换 ’当前线路‘ 或 ’当前码率‘,会触发此回调; [channelInfo] 刷新时,也会触发此回调,用于告知当前 ‘码率信息、线路信息’ 的最新值;

    Declaration

    Objective-C

    - (void)plvLivePlayer:(nonnull PLVLivePlayer *)livePlayer
          codeRateOptions:(nonnull NSArray<NSString *> *)codeRateOptions
          currentCodeRate:(nonnull NSString *)currentCodeRate
                  lineNum:(NSInteger)lineNum
         currentLineIndex:(NSInteger)currentLineIndex;

    Swift

    optional func plvLivePlayer(_ livePlayer: PLVLivePlayer, codeRateOptions: [String], currentCodeRate: String, lineNum: Int, currentLineIndex: Int)

    Parameters

    livePlayer

    直播播放器

    codeRateOptions

    码率/清晰度 可选项字符串数组

    currentCodeRate

    当前 码率/清晰度

    lineNum

    线路可选数

    currentLineIndex

    当前线路下标 (由 0 起始)

  • 直播播放器 需获知外部 ‘当前是否正在连麦’

    Note

    此回调不保证在主线程触发

    Declaration

    Objective-C

    - (BOOL)plvLivePlayerGetInLinkMic:(nonnull PLVLivePlayer *)livePlayer;

    Swift

    optional func plvLivePlayerGet(inLinkMic livePlayer: PLVLivePlayer) -> Bool

    Parameters

    livePlayer

    直播播放器

    Return Value

    BOOL 需返回 ‘当前外部是否正在连麦’ 的状态布尔值

  • 直播播放器 需获知外部 ‘当前是否暂停观看无延迟’

    Note

    此回调不保证在主线程触发

    Declaration

    Objective-C

    - (BOOL)plvLivePlayerGetPausedWatchNoDelay:(nonnull PLVLivePlayer *)livePlayer;

    Swift

    optional func plvLivePlayerGetPausedWatchNoDelay(_ livePlayer: PLVLivePlayer) -> Bool

    Parameters

    livePlayer

    直播播放器

    Return Value

    BOOL 需返回 ‘当前外部是否正在连麦’ 的状态布尔值

  • 直播播放器 需展示暖场图片

    Declaration

    Objective-C

    - (void)plvLivePlayer:(nonnull PLVLivePlayer *)livePlayer
             showWarmUpImage:(BOOL)show
        warmUpImageURLString:(NSString *_Nullable)warmUpImageURLString;

    Swift

    optional func plvLivePlayer(_ livePlayer: PLVLivePlayer, showWarmUpImage show: Bool, warmUpImageURLString: String?)

    Parameters

    livePlayer

    直播播放器

    show

    是否展示 (YES:展示 NO:隐藏)

    warmUpImageURLString

    暖场图片链接地址

  • 直播播放器 快直播网络质量检测回调

    Note

    仅在 快直播观看 时会触发该回调(即 [quickLiveWatching]为YES时);

    Declaration

    Objective-C

    - (void)plvLivePlayer:(nonnull PLVLivePlayer *)livePlayer
        quickLiveNetworkQuality:
            (PLVLivePlayerQuickLiveNetworkQuality)netWorkQuality;

    Swift

    optional func plvLivePlayer(_ livePlayer: PLVLivePlayer, quickLiveNetworkQuality netWorkQuality: PLVLivePlayerQuickLiveNetworkQuality)

    Parameters

    livePlayer

    直播播放器

    netWorkQuality

    网络质量