PLVLivePlaybackPlayer

Objective-C

@interface PLVLivePlaybackPlayer
    : PLVPlayer <PLVLivePlayerPictureInPictureProtocol>

Swift

class PLVLivePlaybackPlayer : PLVPlayer, PLVLivePlayerPictureInPictureProtocol

直播回放播放器

Note

直播回放播放器 继承自 PLVPlayer.h; 若您希望了解 播放器基础功能 相关属性方法,可查看 PLVPlayer.h; 若您希望了解 直播回放业务 相关属性方法,可查看 PLVLivePlaybackPlayer.h;
// 使用演示
PLVLivePlaybackPlayer * livePlaybackPlayer = [[PLVLivePlaybackPlayer alloc] initWithPLVAccountUserId:accountUserId channelId:channelId vodId:vodId vodList:NO];
livePlaybackPlayer.delegate = self;
livePlaybackPlayer.livePlaybackDelegate = self;
[livePlaybackPlayer setupDisplaySuperview:displaySuperview];

可配置项

  • 直播回放播放器 livePlaybackDelegate

    Note

    父类 PLVPlayer 的 delegate 也有播放器基础功能的回调,详情可见 PLVPlayer.h

    Declaration

    Objective-C

    @property (nonatomic, weak) id<PLVLivePlaybackPlayerDelegate> _Nullable livePlaybackDelegate;

    Swift

    weak var livePlaybackDelegate: PLVLivePlaybackPlayerDelegate? { get set }
  • 视频解码是否使用“硬解码”

    Note

    硬解码效率更高,而软解码兼容性更好; YES:使用硬解码 NO:使用软解码; 默认值 YES;

    Declaration

    Objective-C

    @property (nonatomic) BOOL videoToolBox;

    Swift

    var videoToolBox: Bool { get set }
  • 后台统计参数数据模型

    Note

    播放器发送 ViewLog 日志所需要的数据模型,详见 PLVViewLogCustomParam.h 参考可配置的统计参数

    Declaration

    Objective-C

    @property (nonatomic, strong) PLVViewLogCustomParam *_Nonnull customParam;

    Swift

    var customParam: PLVViewLogCustomParam { get set }

数据

  • 频道信息数据模型

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) PLVChannelInfoModel *_Nonnull channelInfo;

    Swift

    var channelInfo: PLVChannelInfoModel { get }
  • 回放视频ID(请求'直播回放视频的信息‘接口返回的视频Id,与后台回放列表看到的vid不是同一个数据)

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull videoId;

    Swift

    var videoId: String { get }
  • 文件ID(请求'直播回放视频的信息‘接口返回的文件Id,与后台回放列表看到的vid不是同一个数据,适用于暂存/素材库)

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull fileId;

    Swift

    var fileId: String { get }
  • 已缓存进度

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGFloat downloadProgress;

    Swift

    var downloadProgress: Double { get }
  • 已播放进度

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGFloat playedProgress;

    Swift

    var playedProgress: Double { get }
  • 已播放时间点字符串 (示例 “01:23”)

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull playedTimeString;

    Swift

    var playedTimeString: String { get }
  • 总时长字符串 (示例 “01:23”)

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull durationTimeString;

    Swift

    var durationTimeString: String { get }
  • 直播回放播放器ID

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSString *_Nonnull livePlaybackPlayerId;

    Swift

    var livePlaybackPlayerId: String { get }
  • 用户观看时长 (单位:秒;播放器暂停则不认为“观看”)

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSInteger watchDuration;

    Swift

    var watchDuration: Int { get }
  • 用户停留时长 (单位:秒)

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSInteger stayDuration;

    Swift

    var stayDuration: Int { get }

[ 方法 ]

  • Deprecated

    Please use initWithPLVAccountUserId:

    创建 直播回放播放器

    Note

    创建后需调用父类方法 [setupDisplaySuperview:] 进行画面添加,才可正常显示播放内容

    Declaration

    Objective-C

    - (nonnull instancetype)initWithPolyvAccountUserId:
                                (nonnull NSString *)accountUserId
                                             channelId:(nonnull NSString *)channelId
                                                 vodId:(nonnull NSString *)vodId
                                               vodList:(BOOL)vodList;

    Swift

    init(polyvAccountUserId accountUserId: String, channelId: String, vodId: String, vodList: Bool)

    Parameters

    accountUserId

    PLV账户Id

    channelId

    频道号Id

    vodId

    直播回放Id

    vodList

    是否 ‘点播列表’ 视频

  • Undocumented

    Declaration

    Objective-C

    - (instancetype)initWithPLVAccountUserId:(NSString *)accountUserId channelId:(NSString *)channelId vodId:(NSString *)vodId vodList:(BOOL)vodList;

    Swift

    init(plvAccountUserId accountUserId: String, channelId: String, vodId: String, vodList: Bool)
  • 创建 直播暂存播放器

    Note

    创建后需调用父类方法 [setupDisplaySuperview:] 进行画面添加,才可正常显示播放内容

    Declaration

    Objective-C

    - (nonnull instancetype)
        initWithPLVAccountUserId:(nonnull NSString *)accountUserId
                       channelId:(nonnull NSString *)channelId
                      recordFile:(nonnull PLVLiveRecordFileModel *)recordFile;

    Swift

    init(plvAccountUserId accountUserId: String, channelId: String, recordFile: PLVLiveRecordFileModel)

    Parameters

    accountUserId

    PLV账户Id

    channelId

    频道号Id

    recordFile

    录制文件

  • 跳至某个时间点 (单位: 秒)

    Declaration

    Objective-C

    - (void)seekLivePlaybackToTime:(NSTimeInterval)toTime;

    Swift

    func seekLivePlayback(toTime: TimeInterval)
  • 切换倍速 (范围值 0.0~2.0)

    Declaration

    Objective-C

    - (void)switchLivePlaybackSpeedRate:(CGFloat)toSpeed;

    Swift

    func switchLivePlaybackSpeedRate(_ toSpeed: Double)
  • 切换回放视频

    Declaration

    Objective-C

    - (void)changeLivePlaybackVodId:(nonnull NSString *)vodId;

    Swift

    func changeLivePlaybackVodId(_ vodId: String)

    Parameters

    vodId

    直播回放Id (当为同一channelId下的vodId才能切换成功)

  • 切换暂存视频

    Declaration

    Objective-C

    - (void)changeLivePlaybackFileId:(nonnull NSString *)fileId;

    Swift

    func changeLivePlaybackFileId(_ fileId: String)

    Parameters

    fileId

    暂存视频fileId(当为同一channelId下的vodId才能切换成功)