Reputation: 1492
I'm playing a video in my app from youtube via LBYouTubeView kit. I have used two way of playing the video one by pressing the button and the other once the app starts. When I press the the button it runs in full screen but, when the app starts it doesn't play in full screen while I am using the same code.
How can I solve this problem please?
Thanks from now.
-(void)viewDidLoad {
[super viewDidLoad];
self.controller = [[LBYouTubePlayerController alloc] initWithYouTubeURL:URL quality:LBYouTubeVideoQualityLarge];
self.controller.delegate = self;
self.controller.view.frame = CGRectMake(0.0f, 0.0f, 200.0f, 200.0f);
self.controller.view.center = self.view.center;
[self.view addSubview:self.controller.view];
[self.controller setFullscreen:YES];
}
-(IBAction)play{
//The same code above
}
Upvotes: 0
Views: 1341
Reputation: 107121
I just done a sample application using the above mentioned code. You are correct, I didn't get the fullscreen when I added the code in viewDidLoad.
I changed your code to viewDidAppear
method instead of viewDidLoad
and it worked perfectly.
-(void)viewDidAppear:(BOOL)animated
{
self.controller = [[LBYouTubePlayerController alloc] initWithYouTubeURL:URL quality:LBYouTubeVideoQualityLarge];
self.controller.delegate = self;
self.controller.view.frame = CGRectMake(0.0f, 0.0f, 200.0f, 200.0f);
self.controller.view.center = self.view.center;
[self.view addSubview:self.controller.view];
[self.controller setFullscreen:YES];
}
I think when you call it in the viewDidLoad
the view is being loaded, not fully loaded I think that causes the issue.
Upvotes: 1