Classes

The following classes are available globally.

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface PLVContentAreaView : UIView
    
    /// 频道信息
    @property (nonatomic, strong) PLVWebViewLiveChannelInfo * __nullable liveChannelInfo;
    /// 加载的WebView
    @property (nonatomic, strong, readonly) PLVWKWebView *mainWebView;
    
    /// 设置视图控制器和WebView配置
    /// @param webViewController 当前页面的视图控制器
    /// @param config 配置项
    - (void)setupWebViewController:(UIViewController *)webViewController config:(PLVWebViewConfig *)config;
    
    /// 添加至外部父视图
    - (void)addToSuperview:(UIView *)view;
    
    /// 销毁方法
    - (void)destroy;
    
    #pragma mark 小窗操作
    /// 主动切换到悬浮窗
    /// @note 当allowFloatingWindow为YES、supportFloatingWindow也为YES时才会切换
    - (BOOL)changeToFloatingWindow;
    
    /// 点击商品来唤出小窗
    /// @param link 商品链接
    /// @param data 商品数据
    /// @param size 小窗尺寸
    /// @param newPage 是否打开新页面
    - (void)changeToWindowForProductLink:(NSString *)link data:(NSDictionary *)data size:(CGSize)size newPage:(BOOL)newPage;
    
    /// 小窗恢复到正常全屏页面状态
    - (void)revertWindowToNormal;
    
    /// 主动关闭悬浮窗
    /// @note 主动调用不触发相关回调
    - (void)closeWindow;
    
    /// 获取当前网络状态
    - (void)getCurrentNetworkStatus;
    
    @end

    Swift

    class PLVContentAreaView
  • 浮窗管理器,负责在悬浮窗上显示webView,以及关闭悬浮窗

    See more

    Declaration

    Objective-C

    @interface PLVFloatWindowManager : NSObject

    Swift

    class PLVFloatWindowManager : NSObject
  • 与js的通信封装类:包括原生通知h5、h5通知原生

    See more

    Declaration

    Objective-C

    @interface PLVFloatableWebViewBridge : NSObject

    Swift

    class PLVFloatableWebViewBridge : NSObject
  • 配置管理类,设置白名单功能

    See more

    Declaration

    Objective-C

    @interface PLVUAConfigManager : NSObject

    Swift

    class PLVUAConfigManager : NSObject
  • 进行适配优化的webView子类,使其满足以下需求:

    1. 当打开保利威相关域名的网页时,配置自定义UserAgent,使其支持小窗功能
    2. 支持网页音视频自动播放。
    3. 防止ipad上因误识别为Mac端浏览器导致出现白屏。
    4. 开放了 Native - JS 通信的接口。
    See more

    Declaration

    Objective-C

    @interface PLVWKWebView : WKWebView

    Swift

    class PLVWKWebView : WKWebView
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface PLVWVFdUtil : NSObject
    
    + (UIColor *)colorFromHexString:(NSString *)hexString alpha:(float)alpha;
    
    /// 检查字符串是否可用 (YES-可用;NO-不可用;‘可用’代表不为空、NSString类型、length大于0)
    + (BOOL)checkStringUseable:(NSString *)string;
    
    /// 检查字典是否可用 (YES-可用;NO-不可用;‘可用’代表不为空、NSDictionary类型、count大于0)
    + (BOOL)checkDictionaryUseable:(NSDictionary *)dict;
    
    /// 检查数组是否可用 (YES-可用;NO-不可用;‘可用’代表不为空、NSArray类型、count大于0)
    + (BOOL)checkArrayUseable:(NSArray *)array;
    
    + (BOOL)safeBoolForValue:(id)value;
    
    /// 将屏幕旋转至相应方向
    + (void)changeDeviceOrientation:(UIDeviceOrientation)orientation;
    
    + (UIWindow *_Nonnull)getFirstUIWindowFormUIApplication;
    
    + (UIViewController *)getCurrentViewController;
    
    + (NSString *)URLEncodedString:(NSString *)url;
    
    @end

    Swift

    class PLVWVFdUtil : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface PLVWVLogUtils : NSObject
    
    /// 是否开启日志打印
    + (void)setLogEnable:(BOOL)enable;
    
    + (void)logWithMethod:(NSString *)method format:(NSString *)format;
    
    @end

    Swift

    class PLVWVLogUtils : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface PLVWebViewBaseViewController : UIViewController<
    PLVFloatableWebViewBridgeDelegate
    >
    
    /// WebView 容器,负责小窗或正常页面显示
    @property (nonatomic, strong, readonly) PLVContentAreaView *contentAreaView;
    
    - (instancetype)initWithConfig:(PLVWebViewConfig *)config;
    
    /// 初始化阶段,可进行自定义配置
    - (void)initHandleForDemo;
    
    @end

    Swift

    class PLVWebViewBaseViewController : PLVFloatableWebViewBridgeDelegate
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface PLVWebViewConfig : NSObject
    
    /// 加载 WebView 链接
    @property (nonatomic, copy) NSString *urlString;
    /// WebView 默认的UA
    @property (nonatomic, copy) NSString *userAgent;
    /// 浮窗类型(YES:系统浮窗画中画,NO:应用内浮窗) 默认为NO
    @property (nonatomic, assign) BOOL isSystemFloatingWindow;
    /// 是否允许使用浮窗功能,默认为YES
    @property (nonatomic, assign) BOOL allowFloatingWindow;
    /// 是否自动开启悬浮窗,默认为NO
    @property (nonatomic, assign) BOOL enableAutoFloatWindow;
    
    @end

    Swift

    class PLVWebViewConfig : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface PLVWebViewLiveChannelInfo : NSObject
    
    /// 当前频道类型
    @property (nonatomic, assign, readonly) PLVWebViewChannelVideoType videoType;
    /// 是否能开启小窗 暖场或者其它特殊场景不会自动开启小窗
    @property (nonatomic, assign, readonly) BOOL enableWindowAbility;
    /// 直播回放视频的播放地址
    @property (nonatomic, copy, readonly) NSString *vodURL;
    /// 视频的尺寸,应用内小窗时需要以此尺寸展示
    @property (nonatomic, assign, readonly) CGSize videoSize;
    
    + (instancetype)liveChannelInfoModelWithDict:(NSDictionary *)dict;
    
    @end

    Swift

    class PLVWebViewLiveChannelInfo : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface PLVWebViewLiveUserInfo : NSObject
    
    /// PLV账户 用户Id
    @property (nonatomic, copy, readonly) NSString * accountUserId;
    /// 频道ID
    @property (nonatomic, copy, readonly) NSString * channelId;
    
    @property (nonatomic, copy, readonly) NSString * appId;
    @property (nonatomic, copy, readonly) NSString * appSecret;
    
    #pragma mark - 直播自定义参数
    
    /// 统计后台自定义参数1(观众/学员Id)
    @property (nonatomic, copy) NSString *liveParam1;
    /// 统计后台自定义参数2(观众/学员昵称)
    @property (nonatomic, copy) NSString *liveParam2;
    /// 统计后台自定义参数3
    @property (nonatomic, copy) NSString *liveParam3;
    /// 统计后台自定义参数4
    @property (nonatomic, copy) NSString *liveParam4;
    /// 统计后台自定义参数5
    @property (nonatomic, copy) NSString *liveParam5;
    
    @property (nonatomic, strong, nullable) PLVWebViewLiveChannelInfo *channelInfo;
    
    + (instancetype)liveUserInfoModelWithDict:(NSDictionary *)dict;
    
    @end

    Swift

    class PLVWebViewLiveUserInfo : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface PLVWebViewPictureInPictureLifeManager : NSObject
    
    @property (nonatomic, weak) id<PLVWebViewPictureInPictureLifeManagerDelegate> delegate;
    /// 用于开启画中画后离开页面时,持有原来的页面
    @property (nonatomic, strong, nullable) UIViewController *viewController;
    /// 直播视频解码是否使用“硬解码” (默认为NO 软解码)
    @property (nonatomic, assign) BOOL videoToolBox;
    /// 是否开启 后台自动开启画中画功能
    @property (nonatomic, assign) BOOL backgroundAutoPictureInPicture;
    /// 用户信息
    @property (nonatomic, strong) PLVWebViewLiveUserInfo * _Nullable liveUserInfo;
    /// 频道信息
    @property (nonatomic, strong) PLVWebViewLiveChannelInfo * _Nullable liveChannelInfo;
    /// 画中画是否将要开启状态
    @property (nonatomic, assign, readonly) BOOL pictureInPictureWillStart;
    /// 画中画是否已开启
    @property (nonatomic, assign, readonly) BOOL pictureInPictureActive;
    /// 画中画播放器当前播放时间
    @property (nonatomic, assign, readonly) NSTimeInterval currentPlaybackTime;
    
    /// 画中画管理器单例
    + (instancetype)sharedManager;
    
    /// 跳转画中画回放播放器到指定时间
    /// - Parameter toTime: 播放的时间
    - (void)seekPictureInPictureToTime:(NSTimeInterval)toTime;
    
    /// 更新画中画自动开启的状态
    - (void)updateAutoPictureInPictureEnableStatus;
    
    /// 开启画中画
    - (void)startPictureInPicture;
    
    /// 开启画中画
    /// - Parameter block: 是否开启成功的回调
    - (void)startPictureInPictureBlock:(PLVWebViewStartPictureInPictureBlock)block;
    
    /// 关闭画中画
    - (void)stopPictureInPicture;
    
    /// 清理画中画管理的数据
    - (void)cleanPictureInPictureLifeManager;
    
    @end

    Swift

    class PLVWebViewPictureInPictureLifeManager : NSObject