0

I have a video button. When i press my button, i am trying to play youtube video, my program is working on portrait mode but when only playing video i want to change portrait mode to landscape mode.

Here is my code;

- (void) playVideo 
{

UIView *YoutubeView = [[UIView alloc] initWithFrame:CGRectMake(10, 80, 300, 225)];

YoutubeView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];

YoutubeView.clipsToBounds = YES;

YoutubeView.layer.cornerRadius = 10.0;

NSString *urlString = [videoButtons objectAtIndex:pageIndex];

NSLog(@"URLSTRING = %@",urlString);

NSURLRequest *requestURL = [[NSURLRequest alloc]initWithURL:[NSURL URLWithString:urlString]];

UIWebView *webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 500, 500)];

[webView loadRequest:requestURL];

[YoutubeView addSubview:webView];

[self addSubview:YoutubeView];

}

In this code i am creating webview for playing video,

I have one more question. When i press my button youtube is coming up on webview, than i press youtube, playing video. But i want to press button, i want to go to playing video part directly.

What i need to do for these questions?

Thanks for your answers and interest.Sorry my bad english :).

Kirdok
  • 1,904
  • 2
  • 22
  • 27
  • here is a solution: http://stackoverflow.com/questions/4330979/how-to-set-device-ui-orientation-programmatically – Mirko Brunner Feb 02 '14 at 15:48
  • I found answer on this link : http://stackoverflow.com/questions/13021520/how-to-play-landscape-video-with-mpmovieviewcontroller-in-a-portrait-only-app – Kirdok Feb 18 '14 at 08:34

0 Answers0