本教程介绍使用暴风云视频 IOS平台 播放器的SDK,快速构建一个视频点播功能的APP。admin管理员组文章数量:1566602
下载SDK
访问暴风云视频平台官方网站的SDK页面,进入一站式视频点播,找到SDK for Objective-C下载SDK。
SDK包中player文件夹下便是播放器的SDK了。
开发准备
1. 使用xcode创建单界面工程
2. 工程引用播放器库。将SDK包中player文件夹下BFCloudPlayer.a添加到工程中。
3. 工程添加播放器界面素材。将SDK包中的resource.bundle添加到工程。
4. 工程添加系统库支持。
5. 工程添加播放器库的接口文件。将BfCloudPlayer.h文件添加到工程。
获取已上传视频的视频播放信息
播放之前要注册暴风云视频的帐号,同时使用上传工具将视频上传到暴风云视频的服务器。具体的上传请参考《暴风云视频平台SDK使用介绍(二)-- 文件上传》
访问暴风云频平台官方网站,通过注进入管理中心入口,在一站式点播页面中找到自己要播放的视频并获取播放视频的信息。
小试牛刀
在自己的controler文件中写下如下代码:
- #import "ViewController.h"
- #import "BfCloudPlayer.h"
-
- @interface ViewController ()
- @property (nonatomic, strong) BfCloudPlayer * player;
- @end
-
- @implementation ViewController
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- // Do any additional setup after loading the view, typically from a nib.
-
- // 1. 播放信息
- NSString *playURL = @"servicetype=1&uid=4995606&fid=2365827E70F28846C4484B4895AE260D";
-
- // 2. 播放器的位置和大小
- CGRect playerRec = CGRectMake(self.view.frame.origin.x,
- self.view.frame.origin.y,
- self.view.frame.size.width,
- self.view.frame.size.height/2);
-
- // 3. 创建播放器
- self.player = [[BfCloudPlayer alloc] initWithFrame:playerRec autoRotate:YES delegate:nil];
-
- // 4. 将播放器添加到自己的view上
- [self.view addSubview: self.player.playerView];
-
- // 5. 将播放信息传给播放器开始播放
- NSString *path = [NSString stringWithFormat:@"%@/Library/Caches/", NSHomeDirectory()];
- [self.player playWithURL:[NSURL URLWithString:playURL] andToken:@"" savePath:[NSURL URLWithString:path] autoPlay:YES];
- }
-
- - (void)didReceiveMemoryWarning
- {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- @end
模拟器下先run一下
版权声明:本文标题:暴风云视频平台点播SDK使用介绍(三)-- 视频播放(IOS) 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dongtai/1726782810a1084452.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论