手游神器红手指秀录制神器推荐人?

3752人阅读
版权声明:本文为博主原创,如需转载请注明出处。
ReplayKit 是WWDC15推出的苹果原生录屏 API。在iOS9的时候主要提供的是录屏,录制完成后可以进行查看、编辑、通过指定方式分享出去。
在WWDC16上新版的 ReplayKit 提出了了 live 功能,简单说就是通过 ReplayKit 可以进行录屏直播。这对于苹果的手游直播行业有着很重要的意义。
首先给出视频地址和API文档
弹出可以接收广播的服务列表
新建工程,然后加入ReplayKit.frameword
添加一个按钮,然后按钮点击事件弹出广播服务的列表:
- (IBAction)displayServiceViewController:(id)sender {
[RPBroadcastActivityViewController loadBroadcastActivityViewControllerWithHandler:^(RPBroadcastActivityViewController * _Nullable broadcastActivityViewController, NSError * _Nullable error) {
broadcastActivityViewController.delegate = self;
[self presentViewController:broadcastActivityViewController animated:YES completion:nil];
所以想要直播的游戏本身添加这样一个逻辑,弹出服务列表即可。而直播软件也只需要注册为直播服务,就可以直播任何支持的游戏,软件。国外最火最先支持的就是示例中左边的Mobcrush,,里面有手机游戏Tower Dash的直播,就是使用这个技术实现的,Tower Dash游戏直播页面为 - ,需要科学上网。
我录制了动态图展示:
动态图中可以看出支持摄像头录制,当然还有麦克风,这些已经满足了日常主播的基本需求。
国内现在映客直播安装就直接有注册为广播服务,所以截图中列表里就有。我还安装了熊猫TV,虎牙直播,虎牙助手,虎牙手游。熊猫TV的主播权限还没有申请下来。虎牙手游貌似使用的也是这个技术,但是实现不一样,虎牙手游直接是在虎牙手游APP内部打开直播,提示成功之后,直接就进入了录屏模式,然后退出返回到手游界面开始游戏就可以。查看了虎牙直播平台,已经有主播使用了iPhone7进行王者荣耀直播,熊猫TV暂时还没有看到用iPhone直播手游的。
下面是观看WWDC16 记录的知识片段。
Apple TV support
Live Broadcasting 直播广播,这个很有用,就是要研究的直播功能
可以记录 Face Time摄像头的内容,增强了麦克风记录API
对于录播功能之前就已经有了一个典型的demo,可以直接看下面代码,放进原始功能的第一个viewcontroller里面就Ok了。
#import "ViewController.h"
#import &ReplayKit/ReplayKit.h&
static NSString *StartRecord = @"开始";
static NSString *StopRecord = @"结束";
#if TARGET_IPHONE_SIMULATOR
#define SIMULATOR 1
#elif TARGET_OS_IPHONE
#define SIMULATOR 0
#define AnimationDuration (0.3)
@interface ViewController () &RPPreviewViewControllerDelegate&
@property (nonatomic, strong)UIButton *btnS
@property (nonatomic, strong)UIButton *btnS
@property (nonatomic, strong)NSTimer *progressT
@property (nonatomic, strong)UIProgressView *progressV
@property (nonatomic, strong)UIActivityIndicatorView *
@property (nonatomic, strong)UIView *tipV
@property (nonatomic, strong)UILabel *lbT
@property (nonatomic, strong)UILabel *lbT
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
- (void)viewDidAppear:(BOOL)animated {
BOOL isVersionOk = [self isSystemVersionOk];
if (!isVersionOk) {
NSLog(@"系统版本需要是iOS9.0及以上才支持ReplayKit");
if (SIMULATOR) {
[self showSimulatorWarning];
UILabel *lb = nil;
CGSize screenSize = [UIScreen mainScreen].bounds.size;
lb = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 140)];
lb.font = [UIFont boldSystemFontOfSize:32];
lb.backgroundColor = [UIColor clearColor];
lb.textColor = [UIColor blackColor];
lb.textAlignment = NSTextAlignmentC
lb.numberOfLines = 3;
lb.text = @"苹果ReplayKit Demo";
lb.center =
CGPointMake(screenSize.width/2, 80);
[self.view addSubview:lb];
UIButton *btn = [self createButtonWithTitle:StartRecord andCenter:CGPointMake(screenSize.width/2 - 100, 200)];
[self.view addSubview:btn];
self.btnStart =
btn = [self createButtonWithTitle:StopRecord andCenter:CGPointMake(screenSize.width/2 + 100, 200)];
[self.view addSubview:btn];
self.btnStop =
[self setButton:btn enabled:NO];
UIActivityIndicatorView *activity = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 280, 80)];
[self.view addSubview:view];
view.backgroundColor = [UIColor redColor];
view.layer.cornerRadius = 8.0f;
view.center = CGPointMake(screenSize.width/2, 300);
activity.center = CGPointMake(30, view.frame.size.height/2);
[view addSubview:activity];
[activity startAnimating];
self.activity =
lb = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 280, 80)];
lb.font = [UIFont boldSystemFontOfSize:20];
lb.backgroundColor = [UIColor clearColor];
lb.textColor = [UIColor blackColor];
lb.layer.cornerRadius = 4.0;
lb.textAlignment = NSTextAlignmentC
[view addSubview:lb];
self.lbTip =
self.tipView =
[self hideTip];
lb = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 40)];
lb.font = [UIFont boldSystemFontOfSize:20];
lb.backgroundColor = [UIColor redColor];
lb.textColor = [UIColor blackColor];
lb.layer.cornerRadius = 4.0;
NSDateFormatter * dateFormat = [[NSDateFormatter alloc] init] ;
[dateFormat setDateFormat: @"HH:mm:ss"];
NSString *dateString = [dateFormat stringFromDate:[NSDate date]];
lb.center = CGPointMake(screenSize.width/2, screenSize.height/2 + 100);
lb.textAlignment = NSTextAlignmentC
[self.view addSubview:lb];
self.lbTime =
UIProgressView *progress = [[UIProgressView alloc] initWithFrame:CGRectMake(0, 0, screenSize.width*0.8, 10)];
progress.center = CGPointMake(screenSize.width/2, screenSize.height/2 + 150);
progress.progressViewStyle = UIProgressViewStyleD
progress.progress = 0.0;
[self.view addSubview:progress];
self.progressView =
[NSTimer scheduledTimerWithTimeInterval:1.0f
target:self
selector:@selector(updateTimeString)
userInfo:nil
repeats:YES];
#pragma mark - UI控件
- (void)showTipWithText:(NSString *)tip activity:(BOOL)activity{
[self.activity startAnimating];
self.lbTip.text =
self.tipView.hidden = NO;
if (activity) {
self.activity.hidden = NO;
[self.activity startAnimating];
[self.activity stopAnimating];
self.activity.hidden = YES;
- (void)hideTip {
self.tipView.hidden = YES;
[self.activity stopAnimating];
- (UIButton *)createButtonWithTitle:(NSString *)title andCenter:(CGPoint)center {
CGRect rect = CGRectMake(0, 0, 160, 60);
UIButton *btn = [[UIButton alloc] initWithFrame:rect];
btn.layer.cornerRadius = 5.0;
btn.layer.borderWidth = 2.0;
btn.layer.borderColor = [[UIColor blackColor] CGColor];
btn.backgroundColor = [UIColor lightGrayColor];
btn.center =
[btn setTitle:title forState:UIControlStateNormal];
[btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(onBtnPressed:) forControlEvents:UIControlEventTouchDown];
- (void)setButton:(UIButton *)button enabled:(BOOL)enabled {
if (enabled) {
button.alpha = 1.0;
button.alpha = 0.2;
button.enabled =
- (void)showSimulatorWarning {
UIAlertAction *actionOK = [UIAlertAction actionWithTitle:@"好的" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
UIAlertAction *actionCancel = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action){
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"ReplayKit不支持模拟器" message:@"请使用真机运行这个Demo工程" preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:actionCancel];
[alert addAction:actionOK];
[self presentViewController:alert animated:NO completion:nil];
- (void)showAlert:(NSString *)title andMessage:(NSString *)message {
if (!title) {
title = @"";
if (!message) {
message = @"";
UIAlertAction *actionCancel = [UIAlertAction actionWithTitle:@"好的" style:UIAlertActionStyleCancel handler:nil];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:actionCancel];
[self presentViewController:alert animated:NO completion:nil];
- (void)showVideoPreviewController:(RPPreviewViewController *)previewController withAnimation:(BOOL)animation {
__weak ViewController *weakSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
CGRect rect = [UIScreen mainScreen].bounds;
if (animation) {
rect.origin.x += rect.size.width;
previewController.view.frame =
rect.origin.x -= rect.size.width;
[UIView animateWithDuration:AnimationDuration animations:^(){
previewController.view.frame =
} completion:^(BOOL finished){
previewController.view.frame =
[weakSelf.view addSubview:previewController.view];
[weakSelf addChildViewController:previewController];
- (void)hideVideoPreviewController:(RPPreviewViewController *)previewController withAnimation:(BOOL)animation {
dispatch_async(dispatch_get_main_queue(), ^{
CGRect rect = previewController.view.frame;
if (animation) {
rect.origin.x += rect.size.width;
[UIView animateWithDuration:AnimationDuration animations:^(){
previewController.view.frame =
} completion:^(BOOL finished){
[previewController.view removeFromSuperview];
[previewController removeFromParentViewController];
[previewController.view removeFromSuperview];
[previewController removeFromParentViewController];
#pragma mark - 按钮 回调
- (void)onBtnPressed:(UIButton *)sender {
sender.transform = CGAffineTransformMakeScale(0.8, 0.8);
float duration = 0.3;
[UIView animateWithDuration:duration
animations:^{
sender.transform = CGAffineTransformMakeScale(1.1, 1.1);
}completion:^(BOOL finish){
[UIView animateWithDuration:duration
animations:^{
sender.transform = CGAffineTransformMakeScale(1.0, 1.0);
}completion:^(BOOL finish){ }];
NSString *function = sender.titleLabel.text;
if ([function isEqualToString:StartRecord]) {
[self startRecord];
else if ([function isEqualToString:StopRecord]) {
[self stopRecord];
- (void)startRecord {
NSLog(@"ReplayKit只支持真机录屏,支持游戏录屏,不支持录avplayer播放的视频");
NSLog(@"检查机器和版本是否支持ReplayKit录制...");
if ([[RPScreenRecorder sharedRecorder] isAvailable]) {
NSLog(@"支持ReplayKit录制");
NSLog(@"!!不支持支持ReplayKit录制!!");
__weak ViewController *weakSelf = self;
NSLog(@"%@ 录制", StartRecord);
[self showTipWithText:@"录制初始化" activity:YES];
[[RPScreenRecorder sharedRecorder] startRecordingWithHandler:^(NSError *error){
NSLog(@"录制开始...");
[weakSelf hideTip];
if (error) {
NSLog(@"错误信息 %@", error);
[weakSelf showTipWithText:error.description activity:NO];
[weakSelf setButton:self.btnStop enabled:YES];
[weakSelf setButton:self.btnStart enabled:NO];
[weakSelf showTipWithText:@"正在录制" activity:NO];
weakSelf.progressTimer = [NSTimer scheduledTimerWithTimeInterval:0.05f
target:self
selector:@selector(changeProgressValue)
userInfo:nil
repeats:YES];
- (void)stopRecord {
NSLog(@"%@ 录制", StopRecord);
[self setButton:self.btnStart enabled:YES];
[self setButton:self.btnStop enabled:NO];
__weak ViewController *weakSelf = self;
[[RPScreenRecorder sharedRecorder] stopRecordingWithHandler:^(RPPreviewViewController *previewViewController, NSError *
if (error) {
NSLog(@"失败消息:%@", error);
[weakSelf showTipWithText:error.description activity:NO];
[weakSelf showTipWithText:@"录制完成" activity:NO];
NSLog(@"显示预览页面");
previewViewController.previewControllerDelegate = weakS
[weakSelf.progressTimer invalidate];
weakSelf.progressTimer = nil;
[self showVideoPreviewController:previewViewController withAnimation:YES];
#pragma mark - 视频预览页面 回调
- (void)previewControllerDidFinish:(RPPreviewViewController *)previewController {
[self hideVideoPreviewController:previewController withAnimation:YES];
- (void)previewController:(RPPreviewViewController *)previewController didFinishWithActivityTypes:(NSSet &NSString *& *)activityTypes {
__weak ViewController *weakSelf = self;
if ([activityTypes containsObject:@"com.apple.UIKit.activity.SaveToCameraRoll"]) {
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf showAlert:@"保存成功" andMessage:@"已经保存到系统相册"];
if ([activityTypes containsObject:@"com.apple.UIKit.activity.CopyToPasteboard"]) {
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf showAlert:@"复制成功" andMessage:@"已经复制到粘贴板"];
#pragma mark - 计时器 回调
- (void)changeProgressValue {
float progress = self.progressView.progress + 0.01;
[self.progressView setProgress:progress animated:NO];
if (progress &= 1.0) {
self.progressView.progress = 0.0;
- (void)updateTimeString {
NSDateFormatter * dateFormat = [[NSDateFormatter alloc] init] ;
[dateFormat setDateFormat: @"HH:mm:ss"];
NSString *dateString = [dateFormat stringFromDate:[NSDate date]];
self.lbTime.text =
#pragma mark - 其他
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
- (BOOL)isSystemVersionOk {
if ([[UIDevice currentDevice].systemVersion floatValue] & 9.0) {
return NO;
return YES;
新博客文章地址:
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:202265次
积分:6010
积分:6010
排名:第3574名
原创:399篇
转载:31篇
译文:10篇
评论:36条
文章:12篇
阅读:9257
(2)(4)(1)(1)(6)(32)(2)(3)(3)(18)(79)(92)(194)查看: 2709|回复: 48
【几百刀免费给你了】PC滚动长截屏、游戏视频录制神器 支持特效编辑 仅3M
头像被屏蔽
提示: 作者被禁止或删除 内容自动屏蔽
本帖被以下淘专辑推荐:
& |主题: 187, 订阅: 54
& |主题: 584, 订阅: 47
发帖求助前要善用【】功能,那里可能会有你要找的答案;如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;如何回报帮助你解决问题的坛友,一个好办法就是给对方加【热心】和【CB】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
阅读权限10
很好的截图工具
发帖求助前要善用【】功能,那里可能会有你要找的答案;如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;如何回报帮助你解决问题的坛友,一个好办法就是给对方加【热心】和【CB】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
阅读权限10
感谢正需要
发帖求助前要善用【】功能,那里可能会有你要找的答案;如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;如何回报帮助你解决问题的坛友,一个好办法就是给对方加【热心】和【CB】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
阅读权限25
软件很不错已评分!!
发帖求助前要善用【】功能,那里可能会有你要找的答案;如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;如何回报帮助你解决问题的坛友,一个好办法就是给对方加【热心】和【CB】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
阅读权限10
这玩意还要钱没,一直用不知道。
穷用户通道&&/s/1dE2plV7& &帮到的希望评分加热心哦
谢谢@Thanks!
发帖求助前要善用【】功能,那里可能会有你要找的答案;如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;如何回报帮助你解决问题的坛友,一个好办法就是给对方加【热心】和【CB】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
阅读权限10
Loongstyle 发表于
这玩意还要钱没,一直用不知道。
穷用户通道&&/s/1dE2plV7& &帮到的希望评分加热心哦
发帖求助前要善用【】功能,那里可能会有你要找的答案;如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;如何回报帮助你解决问题的坛友,一个好办法就是给对方加【热心】和【CB】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
阅读权限10
一直在用这个
发帖求助前要善用【】功能,那里可能会有你要找的答案;如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;如何回报帮助你解决问题的坛友,一个好办法就是给对方加【热心】和【CB】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
阅读权限10
楼主链接呢???
发帖求助前要善用【】功能,那里可能会有你要找的答案;如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;如何回报帮助你解决问题的坛友,一个好办法就是给对方加【热心】和【CB】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
阅读权限20
网盘里有好几个文件,到底是那个?
发帖求助前要善用【】功能,那里可能会有你要找的答案;如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;如何回报帮助你解决问题的坛友,一个好办法就是给对方加【热心】和【CB】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
阅读权限20
360浏览器和百度浏览器都支持网页另存为图片的
发帖求助前要善用【】功能,那里可能会有你要找的答案;如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;如何回报帮助你解决问题的坛友,一个好办法就是给对方加【热心】和【CB】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
阅读权限20
感谢分享,竟然没有屌丝通道
发帖求助前要善用【】功能,那里可能会有你要找的答案;如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;如何回报帮助你解决问题的坛友,一个好办法就是给对方加【热心】和【CB】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
阅读权限10
感谢分享,竟然没有屌丝通道
我给了,在你楼上
发帖求助前要善用【】功能,那里可能会有你要找的答案;如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;如何回报帮助你解决问题的坛友,一个好办法就是给对方加【热心】和【CB】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
免责声明:吾爱破解所发布的一切破解补丁、注册机和注册信息及软件的解密分析文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。
( 京ICP备号 | 京公网安备 87号 )
Powered by Discuz!
Comsenz Inc.}

我要回帖

更多关于 手游神器 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信