PLVPPTWebview
Objective-C
@interface PLVPPTWebview
Swift
class PLVPPTWebview
PPT视图
Note
直播,添加至相应视图中即可; 回放,添加至相应视图中,并调用 [pptStart] 方法即可;// 直播场景 代码演示
// 1.创建及加载
PLVPPTWebview * pptWebiew = [[PLVPPTWebview alloc] init];
[someView addSubview:pptWebiew];
pptWebiew.frame = someView.bounds;
[pptWebiew loadOnlinePPT];
// 2. socket 登录成功后设置用户信息
pptWebiew.userInfo = userInfo;
// 3. 接收到 socket PPT事件则执行刷新
[pptWebiew refreshPPT:json];
-
delegate
Declaration
Objective-C
@property (nonatomic, weak) id<PLVPPTWebviewDelegate> _Nullable delegate;
Swift
weak var delegate: PLVPPTWebviewDelegate! { get set }
-
直播场景,在 socket 登录成功后,需将用户信息同步至 PPT视图
Declaration
Objective-C
@property (nonatomic, strong) NSDictionary *_Nonnull userInfo;
Swift
var userInfo: UnsafeMutablePointer<Int32>! { get set }
-
jsbridge delegate
Note
当需要接收 webview 回调事件时,可设置此 jsDelegateDeclaration
Objective-C
@property (nonatomic, weak) id _Nullable jsDelegate;
Swift
weak var jsDelegate: AnyObject! { get set }
-
是否自定义‘加载指示器’ (YES:内置加载指示器将不显示 NO:内置加载指示器将显示;默认 NO)
Note
需同时设置 jsDelegate,以接收对应的回调。回调介绍,具体请参考Declaration
Objective-C
@property (nonatomic) BOOL customActivityIndicator;
Swift
var customActivityIndicator: Int32 { get set }
-
调试模式 (YES:打印调试信息 NO:不打印调试信息;默认 NO)
Declaration
Objective-C
@property (nonatomic) BOOL jsDebugMode;
Swift
var jsDebugMode: Int32 { get set }
-
加载在线 互动页面
Declaration
Objective-C
- (void)loadOnlinePPT;
Swift
func loadOnlinePPT()
-
加载本地 互动页面
Declaration
Objective-C
- (void)loadLocalPPTWithHTMLString:(nonnull NSString *)htmlString baseURL:(nonnull NSURL *)baseURL;
Swift
func loadLocalPPT(withHTMLString htmlString: Any!, baseURL: Any!)
Parameters
htmlString
本地 html 解析后内容
baseURL
可访问的文件夹路径 (注意是 file:// 开头的 URL)
-
加载本地 html 文件
Note
该方法要求 iOS9 以上;对本地文件读取的兼容性更好
Declaration
Objective-C
- (void)loadLocalPPTWithFileURL:(nonnull NSURL *)URL allowingReadAccessToURL:(nonnull NSURL *)readAccessURL;
Swift
func loadLocalPPT(withFileURL URL: Any!, allowingReadAccessToURL readAccessURL: Any!)
Parameters
URL
html 本地文件路径 (注意是 file:// 开头的 URL)
readAccessURL
可访问的文件夹路径 (注意是 file:// 开头的 URL)
-
刷新PPT内容
Declaration
Objective-C
- (void)refreshPPT:(nonnull NSString *)json;
Swift
func refreshPPT(_ json: Any!)
Parameters
json
PPT内容
-
刷新PPT内容
Declaration
Objective-C
- (void)refreshPPT:(nonnull NSString *)json delay:(NSUInteger)delay;
Swift
func refreshPPT(_ json: Any!, delay: Any!)
Parameters
json
PPT内容
delay
延迟时间 (单位毫秒)
-
设置视频SEI信息
Declaration
Objective-C
- (void)setSEIData:(nonnull NSString *)json;
Swift
func setSEIData(_ json: Any!)
Parameters
json
SEI信息
-
设置画笔相关权限
Declaration
Objective-C
- (void)setPaintPermission:(BOOL)paint controlPPTPermission:(BOOL)control;
Swift
func setPaintPermission(_ paint: Any!, controlPPTPermission control: Any!)
Parameters
paint
画笔权限 (YES:允许使用 NO:禁用)
control
操作ppt权限 (YES:允许使用 NO:禁用)
-
设置画板可绘制状态
Declaration
Objective-C
- (void)setPaintStatus:(nonnull NSString *)status;
Swift
func setPaintStatus(_ status: Any!)
Parameters
status
可绘制状态 (close:关闭画笔 open:开启画笔)
-
设置画笔颜色
Declaration
Objective-C
- (void)setBrushColor:(nonnull NSString *)color;
Swift
func setBrushColor(_ color: Any!)
Parameters
color
画笔颜色色值字符串
-
开启画笔删除状态
Declaration
Objective-C
- (void)toDelete;
Swift
func toDelete()
-
加载回放PPT
Declaration
Objective-C
- (void)pptStart:(nonnull NSString *)vid;
Swift
func pptStart(_ vid: Any!)
Parameters
vid
回放视频的vid
-
PPT 恢复播放
Declaration
Objective-C
- (void)pptPlay:(long)currentTime;
Swift
func pptPlay(_ currentTime: Int)
Parameters
currentTime
当前播放时间点
-
PPT 暂停播放
Declaration
Objective-C
- (void)pptPause:(long)currentTime;
Swift
func pptPause(_ currentTime: Int)
Parameters
currentTime
当前播放时间点
-
PPT 跳至某个播放点
Declaration
Objective-C
- (void)pptSeek:(long)toTime;
Swift
func pptSeek(_ toTime: Int)
Parameters
toTime
需要跳至的播放时间点