Reputation: 1360
I am trying to embed a youtube video using the YTPlayerView so set its frame and load the content but the video is being cropped:
-(void)viewDidLoad{
[super viewDidLoad];
NSDictionary *playerVars = @{
@"controls" : @0,
@"playsinline" : @1,
@"autohide" : @1,
@"showinfo" : @0,
@"modestbranding" : @1
};
[self.view addSubview:self.playerView];
[self.view addSubview:self.slider];
[self.view addSubview:self.playButton];
self.view.backgroundColor = [UIColor blackColor];
self.playerView.delegate = self;
[self.playerView loadWithVideoId:self.videoId playerVars:playerVars];
}
-(YTPlayerView *)playerView{
if (!_playerView) {
_playerView = [[YTPlayerView alloc] initWithFrame:CGRectMake(10, 84, self.view.frame.size.width - 10, 250)];
}
return _playerView;
}
Any way of filling the view properly?
Upvotes: 0
Views: 161
Reputation: 789
_playerView.contentMode = UIViewContentModeScaleAspectFit;
Put It After Creating Object of YTPlayerView.May be Its Works.
Upvotes: 1