VideoPlsInterfaceController 2.0.9

VideoPlsInterfaceController 2.0.9

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最后发布2018年7月

Zard1096李少帅jimJingShengshan维护。



  • Zard1096、李少帅和 Bill 编写




示例

要运行示例项目,先克隆仓库,然后从 Example 目录运行 pod install

需求

安装

VideoPlsInterfaceViewSDK 通过CocoaPods提供。要安装它,只需要将以下行添加到您的 Podfile 中
使用

只引入接入层,不引入直播和点播的SDK,不建议使用
pod "VideoPlsInterfaceController"

引入点播
VideoOS
pod "VideoPlsInterfaceController/VideoOS"

引入直播
LiveOS
pod "VideoPlsInterfaceController/LiveOS"

引入点播和直播
pod "VideoPlsInterfaceController", :subspecs => ['VideoOS', 'LiveOS']

1.设置 AppKeyplatformID

AppDelegate.m 文件中,

  • #import <VideoPlsInterfaceControllerSDK/VPConfigSDK.h>

  • didFinishLaunchingWithOptions 中设置与 bundleID 对应的 appkey 和 bundleID。(注:如何在我们官网注册应用并获得 appkey 和 BundleID,请点击链接查看我们的十分钟玩转控制台教程。)

     - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
     
     	[VPConfigSDK setAppKey:@"B1016yZS-"
                 platformID:@"575e6e087c395e0501980c89"];
     	return YES;
    

}
```

2.创建 InterfaceController

  • 调用 init 方法创建 InterfaceController

     - (instancetype)initWithFrame:(CGRect)frame
               videoIdentifier:(NSString *)identifier
                        isLive:(BOOL)isLive;
  • 如果是直播,则需要额外设置一个 platformUserID

  • videoTitle 是可选项,可以在后台配置时更清晰明确,建议设置

  • 将生成的 controller 中的 view 添加到视频播放层中,最佳加载位置为控制栏下方,手势层上方,请不要将 interfaceController.view 放入包含手势操作的 view

      //播放器层
      [self.view addSubview:_player.view]; 
      //互动层
     [self.view addSubview:_interfaceController.view];
     //控制栏
     [self.view addSubview:_mediaControlView];
    

3.开始播放视频

  • 在需要使用互动层页面开始时调用 startVideoPls

     [VPInterfaceController startVideoPls];
    
  • 调用 InterfaceController- (void)startLoading 方法

  • 设置当前播放时间,根据热点出现的精准度需求在 0.1~1s 之间选择

     //需要更新的时间为毫秒数
     [_interfaceController updateCurrentPlaybackTime:playbackTime * 1000];
    

4.旋转屏幕

  • 在旋转屏幕之后,视频大小发生变化后,需要调用 - (void)updateFrame:(CGRect)frame videoRect:(CGRect)videoRect isFullScreen:(BOOL)isFullScreen; 方法

         [_interfaceController updateFrame:self.view.bounds videoRect:_player.videoNowRect isFullScreen:_isFullScreen];
    
  • 在视频加载完成之后和互动层加载完成之后最好都调用一下 updateFrame 方法

5.停止视频,注销互动层

  • 在停止视频时,调用 stop 方法

     [_interfaceController stop];
    
  • 如果有打开多个视频页,并且都有互动层,不在关闭时调用 endVideoPls

  • 在最后关闭所有互动层时,调用 endVideoPls 方法

     [VPInterfaceController endVideoPls];
    
    

6.版本 1.8.0 新增

  • VPInterfaceController - (void)openGoodsList,用来打开子商城侧边栏,点击空白区域即可关闭
  • VPUPPubWebView,sdk 通用 webView 需要调用生成
  • ```userDelegate``,对应 VPUPUserLoginInterface 的接口,详见下方
  • - (void)closeAndRemoveFromSuperView 关闭并销毁 webView
  • - (void)loadUrl:(NSString *)url 父类方法,加载 URL
  • 新增 VPUPUserLoginInterface 和 VPUserInfo,VPUserInfo 用来组装用户实例,VPUPUserLoginInterface 用来获取关于用户数据的回调;
  • - (VPUserInfo *)getUserInfo 通过平台方得到你们的 userInfo
  • - (void)userLogined:(VPUserInfo *) userInfo 通过 sdk 的 webView 登录后会给你们对应的用户信息
  • - (void)notifyScreenChange:(NSString *)url 当需要切成竖屏时会发出这个通知,传入的 url 需要打开 VPUPPubWebView 并调用 loadUrl

作者

Zard1096,[email protected]
李少帅,[email protected]
Bill,[email protected]

许可证

VideoPlsInterfaceController 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。