首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用VideoCore库用实时流视频填充ui视图

使用VideoCore库用实时流视频填充ui视图
EN

Stack Overflow用户
提问于 2016-04-26 09:07:36
回答 1查看 201关注 0票数 1

我正在使用VideoCore库捕获和直播流视频到服务器。我正在使用一个正方形的uiview来监控我的应用程序上的实时流。但是我不能完全用我的直播视频输出来填充这个视图。任何帮助都是非常感谢的。谢谢。我是iOS开发的新手。

这是我的密码:

ViewController.h

代码语言:javascript
复制
#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>
#import <MobileCoreServices/MobileCoreServices.h>
#import <AVFoundation/AVFoundation.h>
#import "VCSimpleSession.h"
#import <CoreMedia/CoreMedia.h>

@interface ViewController : UIViewController<UIImagePickerControllerDelegate,UINavigationControllerDelegate,UITextFieldDelegate>

@property (weak, nonatomic) IBOutlet UIView *previewview;

视图控制器m:

代码语言:javascript
复制
#import "ViewController.h"
#import "VCSimpleSession.h"
@interface ViewController ()<VCSessionDelegate>


@end

VCSimpleSession *mysession;

UIImagePickerController *picker;

int *flag;

@implementation ViewController

@synthesize mybutton;

- (void)viewDidLoad
{
    [super viewDidLoad];
    flag = 0;
    self.textfield.autocorrectionType = UITextAutocorrectionTypeNo;

    mysession.delegate = self;

    self.previewview.hidden = NO;
    self.mybutton.hidden = NO;
    self.textfield.hidden = NO;

    [self.mybutton setBackgroundColor:[UIColor greenColor]];
    [self.mybutton setTitle:@"Start streaming" forState:UIControlStateNormal];
    mysession = [[VCSimpleSession alloc]initWithVideoSize:CGSizeMake(1280, 720) frameRate:30 bitrate:100000 useInterfaceOrientation:YES];

    mysession.previewView.frame = self.previewview.bounds;

    [self.previewview addSubview:mysession.previewView];
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-04-27 04:18:03

我解决了我的问题。

在这一行而不是1280 720

代码语言:javascript
复制
mysession = [[VCSimpleSession alloc]initWithVideoSize:CGSizeMake(1280,720) frameRate:30 bitrate:100000 useInterfaceOrientation: YES];

我输入了480,850

代码语言:javascript
复制
mysession = [[VCSimpleSession alloc]initWithVideoSize:CGSizeMake(480,850) frameRate:30 bitrate:100000 useInterfaceOrientation: YES];

这解决了我的问题。现在,我的ui视图中充满了实时的摄像机馈送。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36860305

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档