我正在使用VideoCore库捕获和直播流视频到服务器。我正在使用一个正方形的uiview来监控我的应用程序上的实时流。但是我不能完全用我的直播视频输出来填充这个视图。任何帮助都是非常感谢的。谢谢。我是iOS开发的新手。
这是我的密码:
ViewController.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;视图控制器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];
}发布于 2016-04-27 04:18:03
我解决了我的问题。
在这一行而不是1280 720
mysession = [[VCSimpleSession alloc]initWithVideoSize:CGSizeMake(1280,720) frameRate:30 bitrate:100000 useInterfaceOrientation: YES];我输入了480,850
mysession = [[VCSimpleSession alloc]initWithVideoSize:CGSizeMake(480,850) frameRate:30 bitrate:100000 useInterfaceOrientation: YES];这解决了我的问题。现在,我的ui视图中充满了实时的摄像机馈送。
https://stackoverflow.com/questions/36860305
复制相似问题