Ios 使用VideoCore库用实时流媒体视频填充ui视图
我正在使用VideoCore库捕获视频并将其实时流式传输到服务器。我正在使用方形uiview监控我应用程序上的实时流。但我无法用我的实时流视频输出完全填满视图。非常感谢您的帮助。谢谢我是iOS开发新手 这是我的密码: ViewController.hIos 使用VideoCore库用实时流媒体视频填充ui视图,ios,uiview,streaming,live,videocore,Ios,Uiview,Streaming,Live,Videocore,我正在使用VideoCore库捕获视频并将其实时流式传输到服务器。我正在使用方形uiview监控我应用程序上的实时流。但我无法用我的实时流视频输出完全填满视图。非常感谢您的帮助。谢谢我是iOS开发新手 这是我的密码: ViewController.h #import <UIKit/UIKit.h> #import <MediaPlayer/MediaPlayer.h> #import <MobileCoreServices/MobileCoreServices.h&
#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;
#导入
#进口
#进口
#进口
#导入“VCSimpleSession.h”
#进口
@界面ViewController:UIViewController
@属性(弱、非原子)IBUIView*previewview;
ViewController.m:
#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];
}
#导入“ViewController.h”
#导入“VCSimpleSession.h”
@界面视图控制器()
@结束
VCSimpleSession*mysession;
UIImagePickerController*选择器;
int*标志;
@实现视图控制器
@合成我的按钮;
-(无效)viewDidLoad
{
[超级视图下载];
flag=0;
self.textfield.autocorrectionType=UITextAutocorrectionTypeNo;
mysession.delegate=self;
self.previewview.hidden=否;
self.mybutton.hidden=否;
self.textfield.hidden=否;
[self.mybutton setBackgroundColor:[UIColor greenColor]];
[self.mybutton setTitle:@“开始流式处理”状态:UIControlStateNormal];
mysession=[[VCSimpleSession alloc]initWithVideoSize:CGSizeMake(1280720)帧速率:30比特率:100000 useInterfaceOrientation:YES];
mysession.previewView.frame=self.previewView.bounds;
[self.previewview addSubview:mysession.previewview];
}
我的问题解决了
而不是1280720
mysession = [[VCSimpleSession alloc]initWithVideoSize:CGSizeMake(1280,720) frameRate:30 bitrate:100000 useInterfaceOrientation: YES];
我输入了480850
mysession = [[VCSimpleSession alloc]initWithVideoSize:CGSizeMake(480,850) frameRate:30 bitrate:100000 useInterfaceOrientation: YES];
这解决了我的问题。现在,我的ui视图中充满了实时摄影机提要